@dotobokuri/fleet-console 1.31.0 → 1.32.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 (62) hide show
  1. package/dist/cli.mjs +9 -1
  2. package/dist/client/assets/{_baseUniq-6rANA-_q.js → _baseUniq-BcB5wmG1.js} +1 -1
  3. package/dist/client/assets/{arc-tzTBQuJE.js → arc-DdDM-o2K.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-B4MzTga_.js → architectureDiagram-Q4EWVU46-CIF7NLBh.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-BSkil4Kq.js → blockDiagram-DXYQGD6D-uTDIsi9C.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-Dwq5nIR_.js → c4Diagram-AHTNJAMY-B-L5_peH.js} +1 -1
  7. package/dist/client/assets/channel-BamKwHPs.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-BGefUfmP.js → chunk-4BX2VUAB-R3NuBeMM.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-DBUtBigu.js → chunk-4TB4RGXK-GqEsM9Hl.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-BLF4uUa8.js → chunk-55IACEB6-D4a7-QMt.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-Cc41I6y_.js → chunk-EDXVE4YY-CFnwIApt.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-C8PUZ57p.js → chunk-FMBD7UC4-Bx6k_N10.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-CYos7ODp.js → chunk-OYMX7WX6-2QjCvEfI.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-I4gCcbsX.js → chunk-QZHKN3VN-SRIQm3h2.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-CO0vuwK9.js → chunk-YZCP3GAM-D3j-Ehhn.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-sEh9Glhk.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-sEh9Glhk.js +1 -0
  18. package/dist/client/assets/clone-iMU-qXwc.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-BjXxkeBn.js → cose-bilkent-S5V4N54A-BDRpmFTS.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-DKVbTDmI.js → dagre-KV5264BT-CNnBa0oO.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-C1as30xl.js → diagram-5BDNPKRD-DmLR5VLJ.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-B_G7-yDL.js → diagram-G4DWMVQ6-D9-S4gAC.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-B2srczqP.js → diagram-MMDJMWI5-BgkkFSRH.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-pYQydnR9.js → diagram-TYMM5635-CRwM_tDY.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-AcmG-sIC.js → erDiagram-SMLLAGMA-DU-pow1m.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-BRvh-u54.js → flowDiagram-DWJPFMVM-B91EFbjc.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CuyxaGr-.js → ganttDiagram-T4ZO3ILL-B-gUVWSs.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-BWFXSUkW.js → gitGraphDiagram-UUTBAWPF-TBkviHit.js} +1 -1
  29. package/dist/client/assets/{graph-BFw4pMat.js → graph-Da2r3MMt.js} +1 -1
  30. package/dist/client/assets/index-5-y-ZMI6.js +451 -0
  31. package/dist/client/assets/index-BBOlVlPk.css +1 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-CgrEFkpl.js → infoDiagram-42DDH7IO-CAdIgU9C.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-C1PYBJVn.js → ishikawaDiagram-UXIWVN3A-DKMRplux.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-BHC_QZyQ.js → journeyDiagram-VCZTEJTY-CPR33z10.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-BTQZjl-H.js → kanban-definition-6JOO6SKY-CDsviLfH.js} +1 -1
  36. package/dist/client/assets/{layout-LyiAOink.js → layout-CkN1-8C9.js} +1 -1
  37. package/dist/client/assets/{linear-BWduiQJJ.js → linear-BxLFCpuS.js} +1 -1
  38. package/dist/client/assets/{mermaid.core-B2Lf_dRe.js → mermaid.core-DA-WJY50.js} +4 -4
  39. package/dist/client/assets/{min-BS4WshjZ.js → min-BsISxNaF.js} +1 -1
  40. package/dist/client/assets/{mindmap-definition-QFDTVHPH-uBQw-Rcf.js → mindmap-definition-QFDTVHPH-B-IUTdhh.js} +1 -1
  41. package/dist/client/assets/{pieDiagram-DEJITSTG-Daco6XeA.js → pieDiagram-DEJITSTG-hwSroJDA.js} +1 -1
  42. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-phmU55Tk.js → quadrantDiagram-34T5L4WZ-DDt9AzF7.js} +1 -1
  43. package/dist/client/assets/{requirementDiagram-MS252O5E-D7WmHJB1.js → requirementDiagram-MS252O5E-C5Xj9gqW.js} +1 -1
  44. package/dist/client/assets/{sankeyDiagram-XADWPNL6-QmItdHVw.js → sankeyDiagram-XADWPNL6-ZwBDrthi.js} +1 -1
  45. package/dist/client/assets/{sequenceDiagram-FGHM5R23-B-Wgp5TP.js → sequenceDiagram-FGHM5R23-DmyMDdrv.js} +1 -1
  46. package/dist/client/assets/{stateDiagram-FHFEXIEX-J7H1J8u1.js → stateDiagram-FHFEXIEX-VD5zvoai.js} +1 -1
  47. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CFTLlJ0p.js +1 -0
  48. package/dist/client/assets/{timeline-definition-GMOUNBTQ-BI_kLbxz.js → timeline-definition-GMOUNBTQ-DP8udMAZ.js} +1 -1
  49. package/dist/client/assets/{vennDiagram-DHZGUBPP-Do5nm7Eq.js → vennDiagram-DHZGUBPP-CiBN7TbR.js} +1 -1
  50. package/dist/client/assets/{wardley-RL74JXVD-DvA1fdMU.js → wardley-RL74JXVD-BtqeTzop.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BrigyBQU.js → wardleyDiagram-NUSXRM2D-DaRdj2RP.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-5P7HB3ND-B0Inv_Uf.js → xychartDiagram-5P7HB3ND-jlgNCyFB.js} +1 -1
  53. package/dist/client/index.html +2 -2
  54. package/dist/fleet-plugins/terminal/routes.mjs +67 -30
  55. package/package.json +1 -1
  56. package/dist/client/assets/channel-DGrgEBwr.js +0 -1
  57. package/dist/client/assets/classDiagram-6PBFFD2Q-CKhx9oUH.js +0 -1
  58. package/dist/client/assets/classDiagram-v2-HSJHXN6E-CKhx9oUH.js +0 -1
  59. package/dist/client/assets/clone-BODjA13N.js +0 -1
  60. package/dist/client/assets/index-DD3oRP6t.css +0 -1
  61. package/dist/client/assets/index-qutkoA_F.js +0 -451
  62. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-D0qZOg43.js +0 -1
@@ -0,0 +1,451 @@
1
+ function A5(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in e)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function Kb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _te(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var r=!1;try{r=this instanceof i}catch{}return 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(i){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:function(){return e[i]}})}),n}var c_={exports:{}},pu={};var lC;function G6(){if(lC)return pu;lC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,r,o){var u=null;if(o!==void 0&&(u=""+o),r.key!==void 0&&(u=""+r.key),"key"in r){o={};for(var h in r)h!=="key"&&(o[h]=r[h])}else o=r;return r=o.ref,{$$typeof:e,type:i,key:u,ref:r!==void 0?r:null,props:o}}return pu.Fragment=t,pu.jsx=n,pu.jsxs=n,pu}var cC;function K6(){return cC||(cC=1,c_.exports=G6()),c_.exports}var c=K6();const V6=Kb(c),Y6=A5({__proto__:null,default:V6},[c]);var u_={exports:{}},mt={};var uC;function X6(){if(uC)return mt;uC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),b=Symbol.iterator;function S(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,x={};function I(E,G,Y){this.props=E,this.context=G,this.refs=x,this.updater=Y||w}I.prototype.isReactComponent={},I.prototype.setState=function(E,G){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,G,"setState")},I.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function z(){}z.prototype=I.prototype;function U(E,G,Y){this.props=E,this.context=G,this.refs=x,this.updater=Y||w}var A=U.prototype=new z;A.constructor=U,C(A,I.prototype),A.isPureReactComponent=!0;var O=Array.isArray;function R(){}var $={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function J(E,G,Y){var re=Y.ref;return{$$typeof:e,type:E,key:G,ref:re!==void 0?re:null,props:Y}}function Z(E,G){return J(E.type,G,E.props)}function K(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function M(E){var G={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(Y){return G[Y]})}var N=/\/+/g;function D(E,G){return typeof E=="object"&&E!==null&&E.key!=null?M(""+E.key):G.toString(36)}function j(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(R,R):(E.status="pending",E.then(function(G){E.status==="pending"&&(E.status="fulfilled",E.value=G)},function(G){E.status==="pending"&&(E.status="rejected",E.reason=G)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function T(E,G,Y,re,he){var ae=typeof E;(ae==="undefined"||ae==="boolean")&&(E=null);var ke=!1;if(E===null)ke=!0;else switch(ae){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(E.$$typeof){case e:case t:ke=!0;break;case g:return ke=E._init,T(ke(E._payload),G,Y,re,he)}}if(ke)return he=he(E),ke=re===""?"."+D(E,0):re,O(he)?(Y="",ke!=null&&(Y=ke.replace(N,"$&/")+"/"),T(he,G,Y,"",function(Ue){return Ue})):he!=null&&(K(he)&&(he=Z(he,Y+(he.key==null||E&&E.key===he.key?"":(""+he.key).replace(N,"$&/")+"/")+ke)),G.push(he)),1;ke=0;var Re=re===""?".":re+":";if(O(E))for(var De=0;De<E.length;De++)re=E[De],ae=Re+D(re,De),ke+=T(re,G,Y,ae,he);else if(De=S(E),typeof De=="function")for(E=De.call(E),De=0;!(re=E.next()).done;)re=re.value,ae=Re+D(re,De++),ke+=T(re,G,Y,ae,he);else if(ae==="object"){if(typeof E.then=="function")return T(j(E),G,Y,re,he);throw G=String(E),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ke}function B(E,G,Y){if(E==null)return E;var re=[],he=0;return T(E,re,"","",function(ae){return G.call(Y,ae,he++)}),re}function L(E){if(E._status===-1){var G=E._result;G=G(),G.then(function(Y){(E._status===0||E._status===-1)&&(E._status=1,E._result=Y)},function(Y){(E._status===0||E._status===-1)&&(E._status=2,E._result=Y)}),E._status===-1&&(E._status=0,E._result=G)}if(E._status===1)return E._result.default;throw E._result}var F=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},W={map:B,forEach:function(E,G,Y){B(E,function(){G.apply(this,arguments)},Y)},count:function(E){var G=0;return B(E,function(){G++}),G},toArray:function(E){return B(E,function(G){return G})||[]},only:function(E){if(!K(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return mt.Activity=_,mt.Children=W,mt.Component=I,mt.Fragment=n,mt.Profiler=r,mt.PureComponent=U,mt.StrictMode=i,mt.Suspense=p,mt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,mt.__COMPILER_RUNTIME={__proto__:null,c:function(E){return $.H.useMemoCache(E)}},mt.cache=function(E){return function(){return E.apply(null,arguments)}},mt.cacheSignal=function(){return null},mt.cloneElement=function(E,G,Y){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var re=C({},E.props),he=E.key;if(G!=null)for(ae in G.key!==void 0&&(he=""+G.key),G)!H.call(G,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&G.ref===void 0||(re[ae]=G[ae]);var ae=arguments.length-2;if(ae===1)re.children=Y;else if(1<ae){for(var ke=Array(ae),Re=0;Re<ae;Re++)ke[Re]=arguments[Re+2];re.children=ke}return J(E.type,he,re)},mt.createContext=function(E){return E={$$typeof:u,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:o,_context:E},E},mt.createElement=function(E,G,Y){var re,he={},ae=null;if(G!=null)for(re in G.key!==void 0&&(ae=""+G.key),G)H.call(G,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(he[re]=G[re]);var ke=arguments.length-2;if(ke===1)he.children=Y;else if(1<ke){for(var Re=Array(ke),De=0;De<ke;De++)Re[De]=arguments[De+2];he.children=Re}if(E&&E.defaultProps)for(re in ke=E.defaultProps,ke)he[re]===void 0&&(he[re]=ke[re]);return J(E,ae,he)},mt.createRef=function(){return{current:null}},mt.forwardRef=function(E){return{$$typeof:h,render:E}},mt.isValidElement=K,mt.lazy=function(E){return{$$typeof:g,_payload:{_status:-1,_result:E},_init:L}},mt.memo=function(E,G){return{$$typeof:f,type:E,compare:G===void 0?null:G}},mt.startTransition=function(E){var G=$.T,Y={};$.T=Y;try{var re=E(),he=$.S;he!==null&&he(Y,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(R,F)}catch(ae){F(ae)}finally{G!==null&&Y.types!==null&&(G.types=Y.types),$.T=G}},mt.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},mt.use=function(E){return $.H.use(E)},mt.useActionState=function(E,G,Y){return $.H.useActionState(E,G,Y)},mt.useCallback=function(E,G){return $.H.useCallback(E,G)},mt.useContext=function(E){return $.H.useContext(E)},mt.useDebugValue=function(){},mt.useDeferredValue=function(E,G){return $.H.useDeferredValue(E,G)},mt.useEffect=function(E,G){return $.H.useEffect(E,G)},mt.useEffectEvent=function(E){return $.H.useEffectEvent(E)},mt.useId=function(){return $.H.useId()},mt.useImperativeHandle=function(E,G,Y){return $.H.useImperativeHandle(E,G,Y)},mt.useInsertionEffect=function(E,G){return $.H.useInsertionEffect(E,G)},mt.useLayoutEffect=function(E,G){return $.H.useLayoutEffect(E,G)},mt.useMemo=function(E,G){return $.H.useMemo(E,G)},mt.useOptimistic=function(E,G){return $.H.useOptimistic(E,G)},mt.useReducer=function(E,G,Y){return $.H.useReducer(E,G,Y)},mt.useRef=function(E){return $.H.useRef(E)},mt.useState=function(E){return $.H.useState(E)},mt.useSyncExternalStore=function(E,G,Y){return $.H.useSyncExternalStore(E,G,Y)},mt.useTransition=function(){return $.H.useTransition()},mt.version="19.2.7",mt}var dC;function Vb(){return dC||(dC=1,u_.exports=X6()),u_.exports}var v=Vb();const Z6=Kb(v),Zf=A5({__proto__:null,default:Z6},[v]),J6="fc-operation-body";let Ti=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function R5(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Ti(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(e4).filter(i=>i!==null):[]}function Jf(e){const t=e;if(!t||typeof t.id!="string"||typeof t.theaterId!="string"||typeof t.type!="string"||typeof t.pluginId!="string"||typeof t.title!="string"||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)||N5(t))throw new Ti(500,"Invalid operation response");return t}function N5(e){return Fv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function Q6({children:e,className:t}){return c.jsx("div",{className:n4(J6,t),children:e})}function e4(e){if(!L5(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(t4).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function t4(e){return!L5(e)||typeof e.id!="string"||typeof e.type!="string"||typeof e.title!="string"?null:{id:e.id,type:e.type,title:e.title,...typeof e.disabled=="boolean"?{disabled:e.disabled}:{},...typeof e.disabledReason=="string"?{disabledReason:e.disabledReason}:{}}}function L5(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Fv(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Fv(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||Fv(i,t))}function n4(...e){return e.filter(t=>!!t).join(" ")}const i4=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Ti,OperationBody:Q6,assertOperationNode:Jf,fetchOperationCatalog:R5,hasForbiddenBrowserPayloadKey:N5},Symbol.toStringTag,{value:"Module"}));function s4(e){return e}function r4(e){return e}function M5(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,r)=>fetch(d_(n,i),r).then(d4),subscribe:(n,i,r)=>{const o=new EventSource(d_(n,i));o.onmessage=r;const u=()=>o.close();return t.add(u),()=>{u(),t.delete(u)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,r,o)=>{const u=await fetch(d_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:r}),signal:o});if(!u.ok)throw new Ti(u.status,`Terminal ticket request failed: ${u.status}`);const h=await u.json();if(typeof h.ticket!="string"||typeof h.ttlMs!="number")throw new Ti(u.status,"Invalid terminal ticket response");return{ticket:h.ticket,ttlMs:h.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async n=>{const i=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Ti(i.status,`Operation create failed: ${i.status}`);const r=await i.json();return Jf(r.operation)},rename:async(n,i)=>{const r=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!r.ok)throw new Ti(r.status,`Operation rename failed: ${r.status}`);const o=await r.json();return Jf(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Ti(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>f4(n,i),write:(n,i)=>p4(n,i)},settings:{read:async n=>{const i=await fetch(hC(n));if(!i.ok)throw new Ti(i.status,`Plugin settings read failed: ${i.status}`);const o=(await i.json()).value;return typeof o=="object"&&o!==null&&!Array.isArray(o)?o:null},write:async(n,i)=>{const r=await fetch(hC(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok)throw new Ti(r.status,`Plugin settings write failed: ${r.status}`)}},status:{set:()=>{},clear:()=>{}}}}function j5(e,t){return v.useSyncExternalStore(e,t,t)}function a4(){const[e,t]=v.useState([]),n=v.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Ti(i.status,`Operations request failed: ${i.status}`);const r=await i.json();t(Array.isArray(r.operations)?r.operations.map(Jf):[])},[]);return v.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function o4(e,t){return v.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function l4(e,t){return v.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function c4(e,t,n){const[i,r]=v.useState(()=>e.read(t,n)),o=v.useCallback(u=>{r(u),e.write(t,u)},[e,t]);return[i,o]}function u4(e,t){return v.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function d4(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Ti(e.status,`Plugin request failed: ${e.status}`,t)}return e}function d_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Ti(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Ti(400,"Invalid plugin path");return`/plugins/${e}${n}`}const h4=/^[a-z0-9][a-z0-9._-]*$/;function hC(e){if(!h4.test(e))throw new Ti(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function f4(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(`fleet-plugin.${e}`);return n===null?t:JSON.parse(n)}catch{return t}}function p4(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const m4=Object.freeze(Object.defineProperty({__proto__:null,React:Zf,createClientCapabilities:M5,defineOperationKind:r4,definePlugin:s4,useOperationStatus:u4,useOperations:a4,usePluginApi:o4,usePluginSettings:l4,usePluginStorage:c4,useStoreSnapshot:j5},Symbol.toStringTag,{value:"Module"}));var h_={exports:{}},ki={};var fC;function g4(){if(fC)return ki;fC=1;var e=Vb();function t(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(p,f,g){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:_==null?null:""+_,children:p,containerInfo:f,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return ki.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ki.createPortal=function(p,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return o(p,f,null,g)},ki.flushSync=function(p){var f=u.T,g=i.p;try{if(u.T=null,i.p=2,p)return p()}finally{u.T=f,i.p=g,i.d.f()}},ki.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,i.d.C(p,f))},ki.prefetchDNS=function(p){typeof p=="string"&&i.d.D(p)},ki.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var g=f.as,_=h(g,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?i.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:_,integrity:b,fetchPriority:S}):g==="script"&&i.d.X(p,{crossOrigin:_,integrity:b,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},ki.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=h(f.as,f.crossOrigin);i.d.M(p,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&i.d.M(p)},ki.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,_=h(g,f.crossOrigin);i.d.L(p,g,{crossOrigin:_,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},ki.preloadModule=function(p,f){if(typeof p=="string")if(f){var g=h(f.as,f.crossOrigin);i.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else i.d.m(p)},ki.requestFormReset=function(p){i.d.r(p)},ki.unstable_batchedUpdates=function(p,f){return p(f)},ki.useFormState=function(p,f,g){return u.H.useFormState(p,f,g)},ki.useFormStatus=function(){return u.H.useHostTransitionStatus()},ki.version="19.2.7",ki}var pC;function O5(){if(pC)return h_.exports;pC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),h_.exports=g4(),h_.exports}var Qr=O5();const Qf=6,_4=232,v4=160,y4=8,b4=500;function S4(e,t,n){return Math.min(Math.max(e,t),n)}function w4(e){const t=[];for(let n=0;n<e.length;n+=1)e[n]?.disabled||t.push(n);return t}function x4(e,t,n){const i=Math.max(0,y4),r=Math.max(0,window.innerWidth),o=Math.max(0,window.innerHeight),u=Math.max(0,r-2*i),h=Math.max(0,e.width),p=Math.min(n?Math.max(v4,h):h,u),f=n?e.right-p:e.left,g=S4(f,i,Math.max(i,r-p-i));return t==="down"?{position:"fixed",left:g,width:p,top:Math.max(0,e.bottom+Qf)}:{position:"fixed",left:g,width:p,bottom:Math.max(0,o-e.top+Qf)}}function C4(e){const t=window.innerHeight-e.bottom-Qf,n=e.top-Qf;return t<_4&&n>t?"up":"down"}function D5({value:e,options:t,onChange:n,disabled:i=!1,id:r,compact:o=!1}){const u=v.useId(),h=r??`fc-select-${u.replace(/:/g,"")}`,p=v.useMemo(()=>t.map((B,L)=>`${h}-option-${L}-${B.value}`),[h,t]),f=v.useRef(null),g=v.useRef(null),_=v.useRef(null),[b,S]=v.useState(!1),[w,C]=v.useState(-1),[x,I]=v.useState("down"),[z,U]=v.useState({}),A=v.useRef(""),O=v.useRef(void 0),R=v.useMemo(()=>w4(t),[t]),$=v.useCallback(()=>{A.current="",O.current!==void 0&&(clearTimeout(O.current),O.current=void 0)},[]),H=v.useCallback(()=>{S(!1),C(-1),$()},[$]),J=v.useCallback(B=>{n(B),H(),g.current?.focus()},[H,n]),Z=v.useCallback(()=>{const B=g.current;if(!B)return;const L=B.getBoundingClientRect(),F=C4(L);I(F),U(x4(L,F,o))},[o]),K=v.useCallback((B=!0)=>{if(i||b)return;S(!0);const L=t.findIndex(F=>F.value===e&&!F.disabled);B&&L>=0?C(L):C(R[0]??-1)},[i,R,b,t,e]),M=v.useCallback(B=>{if(!R.length)return;const L=R.indexOf(w),F=L>=0?L:B>0?-1:0,W=R[(F+B+R.length)%R.length];W!==void 0&&C(W)},[w,R]);v.useLayoutEffect(()=>{if(b)return Z(),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0),()=>{window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}},[b,Z]),v.useEffect(()=>{if(!b)return;const B=F=>{const W=F.target;f.current?.contains(W)||_.current?.contains(W)||H()},L=F=>{if(F.key==="Escape"){F.stopPropagation(),H(),g.current?.focus();return}if(F.key==="Tab"){H();return}if(F.key==="ArrowDown"){F.preventDefault(),M(1);return}if(F.key==="ArrowUp"){F.preventDefault(),M(-1);return}if(F.key==="Home"){F.preventDefault();const W=R[0];W!==void 0&&C(W);return}if(F.key==="End"){F.preventDefault();const W=R.at(-1);W!==void 0&&C(W);return}if(F.key==="Enter"||F.key===" "){F.preventDefault(),F.stopPropagation();const W=t[w];W&&!W.disabled&&J(W.value);return}if(F.key.length===1&&/\S/u.test(F.key)){A.current+=F.key.toLowerCase(),clearTimeout(O.current),O.current=setTimeout(()=>{A.current=""},b4);const W=A.current,E=R.map(G=>t[G]).find(G=>G?.label.toLowerCase().startsWith(W));if(E){const G=t.indexOf(E);G>=0&&C(G)}}};return document.addEventListener("pointerdown",B,!0),document.addEventListener("keydown",L,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("keydown",L,!0)}},[w,H,J,R,b,M,t]),v.useEffect(()=>()=>$(),[$]),v.useEffect(()=>{if(!b||w<0)return;const B=p[w];if(!B)return;document.getElementById(B)?.scrollIntoView?.({block:"nearest"})},[w,b,p]);const N=b&&w>=0?p[w]:void 0,D=v.useCallback(B=>{b||["ArrowDown","ArrowUp","Enter"," "].includes(B.key)&&(B.preventDefault(),K(B.key!=="ArrowDown"),B.key==="ArrowDown"&&M(1))},[b,M,K]),j=v.useCallback(()=>{i||(b?H():K(!0))},[H,i,b,K]),T=v.useCallback(B=>{const L=t[B];return{id:p[B]??`${h}-option-${B}`,role:"option",className:"fc-select__option","data-active":w===B?"true":"false","aria-selected":L?.value===e,"aria-disabled":L?.disabled?!0:void 0,onPointerEnter:()=>C(B),onClick:()=>{L&&!L.disabled&&J(L.value)}}},[w,J,h,p,t,e]);return{isOpen:b,activeOptionId:N,placement:x,rootRef:f,triggerRef:g,popupRef:_,listboxId:h,rootProps:{ref:f,className:"fc-select"},triggerProps:{ref:g,type:"button",role:"combobox",className:"fc-select__trigger",disabled:i,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":h,"aria-activedescendant":N,onClick:j,onKeyDown:D},listboxProps:{ref:_,id:h,role:"listbox",className:o?"fc-select__popup fc-select__popup--compact":"fc-select__popup","data-open":b?"true":"false","data-placement":x,style:z},getOptionProps:T}}function Ri({value:e,options:t,onChange:n,disabled:i=!1,compact:r=!1,className:o,id:u,label:h,"aria-labelledby":p}){const f=D5({value:e,options:t,onChange:n,disabled:i,id:u,compact:r}),g=t.find(S=>S.value===e),_=[f.rootProps.className,r?"fc-select--compact":"",o??""].filter(Boolean).join(" "),b=p?{"aria-labelledby":p}:h?{"aria-label":h}:{};return c.jsxs("div",{ref:f.rootRef,className:_,children:[c.jsxs("button",{...f.triggerProps,...b,children:[c.jsx("span",{className:"fc-select__value",children:g?.label??""}),c.jsx("span",{className:"fc-select__caret","aria-hidden":"true",children:"⌄"})]}),f.isOpen?Qr.createPortal(c.jsx("ul",{...f.listboxProps,...b,children:t.map((S,w)=>c.jsx("li",{...f.getOptionProps(w),children:S.label},S.value))}),document.body):null]})}function k4(e){return e}function E4({title:e,description:t,children:n}){return c.jsxs("section",{className:"fc-settings-card",children:[e?c.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?c.jsx("p",{className:"fc-settings-card__desc",children:t}):null,c.jsx("div",{className:"fc-settings-card__body",children:n})]})}function T4({label:e,hint:t,children:n}){const i=v.useId(),r=v.useId();return c.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsxs("div",{className:"fc-settings-row__copy",children:[c.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-row__hint",id:r,children:t}):null]}),c.jsx("div",{className:"fc-settings-row__control",children:n})]})}function A4({checked:e,onChange:t,label:n,disabled:i=!1}){const r=v.useId();return c.jsxs("label",{className:"fc-settings-toggle",htmlFor:r,children:[c.jsx("input",{id:r,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),c.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?c.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function R4({value:e,options:t,onChange:n,label:i,disabled:r=!1}){const o=v.useId(),u=t.map(p=>({value:p.value,label:p.label})),h=c.jsx(Ri,{value:e,options:u,onChange:n,disabled:r,label:i?void 0:"Select setting","aria-labelledby":i?o:void 0});return i?c.jsxs("label",{className:"fc-settings-select",children:[c.jsx("span",{className:"fc-settings-select__label",id:o,children:i}),h]}):c.jsx("div",{className:"fc-settings-select",children:h})}function N4({label:e,hint:t,children:n}){const i=v.useId(),r=v.useId();return c.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?r:void 0,children:[c.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-field__hint",id:r,children:t}):null,c.jsx("div",{className:"fc-settings-field__control",children:n})]})}const L4=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:E4,SettingsField:N4,SettingsRow:T4,SettingsSelect:R4,SettingsToggle:A4,defineSettingsSection:k4},Symbol.toStringTag,{value:"Module"}));function M4(e){return e}const j4=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:M4},Symbol.toStringTag,{value:"Module"})),O4=c.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class ep extends v.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??O4:this.props.children}}const D4=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:ep,React:Zf,Select:Ri,default:Zf,useSelect:D5},Symbol.toStringTag,{value:"Module"}));var f_={exports:{}},mu={},p_={exports:{}},m_={};var mC;function I4(){return mC||(mC=1,(function(e){function t(T,B){var L=T.length;T.push(B);e:for(;0<L;){var F=L-1>>>1,W=T[F];if(0<r(W,B))T[F]=B,T[L]=W,L=F;else break e}}function n(T){return T.length===0?null:T[0]}function i(T){if(T.length===0)return null;var B=T[0],L=T.pop();if(L!==B){T[0]=L;e:for(var F=0,W=T.length,E=W>>>1;F<E;){var G=2*(F+1)-1,Y=T[G],re=G+1,he=T[re];if(0>r(Y,L))re<W&&0>r(he,Y)?(T[F]=he,T[re]=L,F=re):(T[F]=Y,T[G]=L,F=G);else if(re<W&&0>r(he,L))T[F]=he,T[re]=L,F=re;else break e}}return B}function r(T,B){var L=T.sortIndex-B.sortIndex;return L!==0?L:T.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var p=[],f=[],g=1,_=null,b=3,S=!1,w=!1,C=!1,x=!1,I=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function A(T){for(var B=n(f);B!==null;){if(B.callback===null)i(f);else if(B.startTime<=T)i(f),B.sortIndex=B.expirationTime,t(p,B);else break;B=n(f)}}function O(T){if(C=!1,A(T),!w)if(n(p)!==null)w=!0,R||(R=!0,M());else{var B=n(f);B!==null&&j(O,B.startTime-T)}}var R=!1,$=-1,H=5,J=-1;function Z(){return x?!0:!(e.unstable_now()-J<H)}function K(){if(x=!1,R){var T=e.unstable_now();J=T;var B=!0;try{e:{w=!1,C&&(C=!1,z($),$=-1),S=!0;var L=b;try{t:{for(A(T),_=n(p);_!==null&&!(_.expirationTime>T&&Z());){var F=_.callback;if(typeof F=="function"){_.callback=null,b=_.priorityLevel;var W=F(_.expirationTime<=T);if(T=e.unstable_now(),typeof W=="function"){_.callback=W,A(T),B=!0;break t}_===n(p)&&i(p),A(T)}else i(p);_=n(p)}if(_!==null)B=!0;else{var E=n(f);E!==null&&j(O,E.startTime-T),B=!1}}break e}finally{_=null,b=L,S=!1}B=void 0}}finally{B?M():R=!1}}}var M;if(typeof U=="function")M=function(){U(K)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,D=N.port2;N.port1.onmessage=K,M=function(){D.postMessage(null)}}else M=function(){I(K,0)};function j(T,B){$=I(function(){T(e.unstable_now())},B)}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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(T){switch(b){case 1:case 2:case 3:var B=3;break;default:B=b}var L=b;b=B;try{return T()}finally{b=L}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(T,B){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var L=b;b=T;try{return B()}finally{b=L}},e.unstable_scheduleCallback=function(T,B,L){var F=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?F+L:F):L=F,T){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=L+W,T={id:g++,callback:B,priorityLevel:T,startTime:L,expirationTime:W,sortIndex:-1},L>F?(T.sortIndex=L,t(f,T),n(p)===null&&T===n(f)&&(C?(z($),$=-1):C=!0,j(O,L-F))):(T.sortIndex=W,t(p,T),w||S||(w=!0,R||(R=!0,M()))),T},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(T){var B=b;return function(){var L=b;b=B;try{return T.apply(this,arguments)}finally{b=L}}}})(m_)),m_}var gC;function B4(){return gC||(gC=1,p_.exports=I4()),p_.exports}var _C;function P4(){if(_C)return mu;_C=1;var e=B4(),t=Vb(),n=O5();function i(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,l=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(l=a.return),s=a.return;while(s)}return a.tag===3?l:null}function u(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function h(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function p(s){if(o(s)!==s)throw Error(i(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(i(188));return a!==s?null:s}for(var l=s,d=a;;){var m=l.return;if(m===null)break;var y=m.alternate;if(y===null){if(d=m.return,d!==null){l=d;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===l)return p(m),s;if(y===d)return p(m),a;y=y.sibling}throw Error(i(188))}if(l.return!==d.return)l=m,d=y;else{for(var k=!1,P=m.child;P;){if(P===l){k=!0,l=m,d=y;break}if(P===d){k=!0,d=m,l=y;break}P=P.sibling}if(!k){for(P=y.child;P;){if(P===l){k=!0,l=y,d=m;break}if(P===d){k=!0,d=y,l=m;break}P=P.sibling}if(!k)throw Error(i(189))}}if(l.alternate!==d)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?s:a}function g(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=g(s),a!==null)return a;s=s.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),U=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),J=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function M(s){return s===null||typeof s!="object"?null:(s=K&&s[K]||s["@@iterator"],typeof s=="function"?s:null)}var N=Symbol.for("react.client.reference");function D(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===N?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case I:return"Profiler";case x:return"StrictMode";case O:return"Suspense";case R:return"SuspenseList";case J:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case U:return s.displayName||"Context";case z:return(s._context.displayName||"Context")+".Consumer";case A:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case $:return a=s.displayName||null,a!==null?a:D(s.type)||"Memo";case H:a=s._payload,s=s._init;try{return D(s(a))}catch{}}return null}var j=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},F=[],W=-1;function E(s){return{current:s}}function G(s){0>W||(s.current=F[W],F[W]=null,W--)}function Y(s,a){W++,F[W]=s.current,s.current=a}var re=E(null),he=E(null),ae=E(null),ke=E(null);function Re(s,a){switch(Y(ae,a),Y(he,s),Y(re,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Lx(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Lx(a),s=Mx(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}G(re),Y(re,s)}function De(){G(re),G(he),G(ae)}function Ue(s){s.memoizedState!==null&&Y(ke,s);var a=re.current,l=Mx(a,s.type);a!==l&&(Y(he,s),Y(re,l))}function Oe(s){he.current===s&&(G(re),G(he)),ke.current===s&&(G(ke),uu._currentValue=L)}var Le,we;function Ie(s){if(Le===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);Le=a&&a[1]||"",we=-1<l.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Le+s+we}var Qe=!1;function dt(s,a){if(!s||Qe)return"";Qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(de){var oe=de}Reflect.construct(s,[],_e)}else{try{_e.call()}catch(de){oe=de}s.call(_e.prototype)}}else{try{throw Error()}catch(de){oe=de}(_e=s())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(de){if(de&&oe&&typeof de.stack=="string")return[de.stack,oe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),k=y[0],P=y[1];if(k&&P){var X=k.split(`
4
+ `),ie=P.split(`
5
+ `);for(m=d=0;d<X.length&&!X[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ie.length&&!ie[m].includes("DetermineComponentFrameRoot");)m++;if(d===X.length||m===ie.length)for(d=X.length-1,m=ie.length-1;1<=d&&0<=m&&X[d]!==ie[m];)m--;for(;1<=d&&0<=m;d--,m--)if(X[d]!==ie[m]){if(d!==1||m!==1)do if(d--,m--,0>m||X[d]!==ie[m]){var pe=`
6
+ `+X[d].replace(" at new "," at ");return s.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",s.displayName)),pe}while(1<=d&&0<=m);break}}}finally{Qe=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ie(l):""}function Je(s,a){switch(s.tag){case 26:case 27:case 5:return Ie(s.type);case 16:return Ie("Lazy");case 13:return s.child!==a&&a!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return dt(s.type,!1);case 11:return dt(s.type.render,!1);case 1:return dt(s.type,!0);case 31:return Ie("Activity");default:return""}}function le(s){try{var a="",l=null;do a+=Je(s,l),l=s,s=s.return;while(s);return a}catch(d){return`
7
+ Error generating stack: `+d.message+`
8
+ `+d.stack}}var Ye=Object.prototype.hasOwnProperty,Pe=e.unstable_scheduleCallback,At=e.unstable_cancelCallback,Zt=e.unstable_shouldYield,fn=e.unstable_requestPaint,wt=e.unstable_now,Kt=e.unstable_getCurrentPriorityLevel,xt=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,We=e.unstable_NormalPriority,xn=e.unstable_LowPriority,$e=e.unstable_IdlePriority,xe=e.log,it=e.unstable_setDisableYieldValue,ht=null,Dt=null;function Ct(s){if(typeof xe=="function"&&it(s),Dt&&typeof Dt.setStrictMode=="function")try{Dt.setStrictMode(ht,s)}catch{}}var Bt=Math.clz32?Math.clz32:me,Ni=Math.log,se=Math.LN2;function me(s){return s>>>=0,s===0?32:31-(Ni(s)/se|0)|0}var et=256,Ne=262144,Ge=4194304;function vt(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function V(s,a,l){var d=s.pendingLanes;if(d===0)return 0;var m=0,y=s.suspendedLanes,k=s.pingedLanes;s=s.warmLanes;var P=d&134217727;return P!==0?(d=P&~y,d!==0?m=vt(d):(k&=P,k!==0?m=vt(k):l||(l=P&~s,l!==0&&(m=vt(l))))):(P=d&~y,P!==0?m=vt(P):k!==0?m=vt(k):l||(l=d&~s,l!==0&&(m=vt(l)))),m===0?0:a!==0&&a!==m&&(a&y)===0&&(y=m&-m,l=a&-a,y>=l||y===32&&(l&4194048)!==0)?a:m}function ue(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function be(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ze(){var s=Ge;return Ge<<=1,(Ge&62914560)===0&&(Ge=4194304),s}function Pt(s){for(var a=[],l=0;31>l;l++)a.push(s);return a}function gt(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function je(s,a,l,d,m,y){var k=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var P=s.entanglements,X=s.expirationTimes,ie=s.hiddenUpdates;for(l=k&~l;0<l;){var pe=31-Bt(l),_e=1<<pe;P[pe]=0,X[pe]=-1;var oe=ie[pe];if(oe!==null)for(ie[pe]=null,pe=0;pe<oe.length;pe++){var de=oe[pe];de!==null&&(de.lane&=-536870913)}l&=~_e}d!==0&&Me(s,d,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(k&~a))}function Me(s,a,l){s.pendingLanes|=a,s.suspendedLanes&=~a;var d=31-Bt(a);s.entangledLanes|=a,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function nt(s,a){var l=s.entangledLanes|=a;for(s=s.entanglements;l;){var d=31-Bt(l),m=1<<d;m&a|s[d]&a&&(s[d]|=a),l&=~m}}function un(s,a){var l=a&-a;return l=(l&42)!==0?1:Tt(l),(l&(s.suspendedLanes|a))!==0?0:l}function Tt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Yn(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function _s(){var s=B.p;return s!==0?s:(s=window.event,s===void 0?32:tC(s.type))}function $s(s,a){var l=B.p;try{return B.p=s,a()}finally{B.p=l}}var xi=Math.random().toString(36).slice(2),on="__reactFiber$"+xi,Gt="__reactProps$"+xi,Fi="__reactContainer$"+xi,zs="__reactEvents$"+xi,Sr="__reactListeners$"+xi,ce="__reactHandles$"+xi,ot="__reactResources$"+xi,Jt="__reactMarker$"+xi;function Ce(s){delete s[on],delete s[Gt],delete s[zs],delete s[Sr],delete s[ce]}function q(s){var a=s[on];if(a)return a;for(var l=s.parentNode;l;){if(a=l[Fi]||l[on]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(s=$x(s);s!==null;){if(l=s[on])return l;s=$x(s)}return a}s=l,l=s.parentNode}return null}function fe(s){if(s=s[on]||s[Fi]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Ee(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(i(33))}function lt(s){var a=s[ot];return a||(a=s[ot]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function ft(s){s[Jt]=!0}var He=new Set,$t={};function zt(s,a){ye(s,a),ye(s+"Capture",a)}function ye(s,a){for($t[s]=a,s=0;s<a.length;s++)He.add(a[s])}var ze=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),qe={},pt={};function Qt(s){return Ye.call(pt,s)?!0:Ye.call(qe,s)?!1:ze.test(s)?pt[s]=!0:(qe[s]=!0,!1)}function Pn(s,a,l){if(Qt(a))if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+l)}}function dn(s,a,l){if(l===null)s.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+l)}}function ti(s,a,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(a,l,""+d)}}function en(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ci(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Yo(s,a,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,y=d.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return m.call(this)},set:function(k){l=""+k,y.call(this,k)}}),Object.defineProperty(s,a,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(k){l=""+k},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function ia(s){if(!s._valueTracker){var a=Ci(s)?"checked":"value";s._valueTracker=Yo(s,a,""+s[a])}}function to(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var l=a.getValue(),d="";return s&&(d=Ci(s)?s.checked?"true":"false":s.value),s=d,s!==l?(a.setValue(s),!0):!1}function Xo(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var lm=/[\n"\\]/g;function Ui(s){return s.replace(lm,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Cc(s,a,l,d,m,y,k,P){s.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.type=k:s.removeAttribute("type"),a!=null?k==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+en(a)):s.value!==""+en(a)&&(s.value=""+en(a)):k!=="submit"&&k!=="reset"||s.removeAttribute("value"),a!=null?Zo(s,k,en(a)):l!=null?Zo(s,k,en(l)):d!=null&&s.removeAttribute("value"),m==null&&y!=null&&(s.defaultChecked=!!y),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?s.name=""+en(P):s.removeAttribute("name")}function no(s,a,l,d,m,y,k,P){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),a!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){ia(s);return}l=l!=null?""+en(l):"",a=a!=null?""+en(a):l,P||a===s.value||(s.value=a),s.defaultValue=a}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=P?s.checked:!!d,s.defaultChecked=!!d,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(s.name=k),ia(s)}function Zo(s,a,l){a==="number"&&Xo(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function pi(s,a,l,d){if(s=s.options,a){a={};for(var m=0;m<l.length;m++)a["$"+l[m]]=!0;for(l=0;l<s.length;l++)m=a.hasOwnProperty("$"+s[l].value),s[l].selected!==m&&(s[l].selected=m),m&&d&&(s[l].defaultSelected=!0)}else{for(l=""+en(l),a=null,m=0;m<s.length;m++){if(s[m].value===l){s[m].selected=!0,d&&(s[m].defaultSelected=!0);return}a!==null||s[m].disabled||(a=s[m])}a!==null&&(a.selected=!0)}}function Od(s,a,l){if(a!=null&&(a=""+en(a),a!==s.value&&(s.value=a),l==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=l!=null?""+en(l):""}function Jo(s,a,l,d){if(a==null){if(d!=null){if(l!=null)throw Error(i(92));if(j(d)){if(1<d.length)throw Error(i(93));d=d[0]}l=d}l==null&&(l=""),a=l}l=en(a),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),ia(s)}function at(s,a){if(a){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=a;return}}s.textContent=a}var Dd=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $n(s,a,l){var d=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":d?s.setProperty(a,l):typeof l!="number"||l===0||Dd.has(a)?a==="float"?s.cssFloat=l:s[a]=(""+l).trim():s[a]=l+"px"}function Vt(s,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var m in a)d=a[m],a.hasOwnProperty(m)&&l[m]!==d&&$n(s,m,d)}else for(var y in a)a.hasOwnProperty(y)&&$n(s,y,a[y])}function sa(s){if(s.indexOf("-")===-1)return!1;switch(s){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 wr=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kc=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ra(s){return kc.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ae(){}var Ke=null;function _t(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Mt=null,Cn=null;function vs(s){var a=fe(s);if(a&&(s=a.stateNode)){var l=s[Gt]||null;e:switch(s=a.stateNode,a.type){case"input":if(Cc(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Ui(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var d=l[a];if(d!==s&&d.form===s.form){var m=d[Gt]||null;if(!m)throw Error(i(90));Cc(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(a=0;a<l.length;a++)d=l[a],d.form===s.form&&to(d)}break e;case"textarea":Od(s,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&pi(s,!!l.multiple,a,!1)}}}var Ec=!1;function Id(s,a,l){if(Ec)return s(a,l);Ec=!0;try{var d=s(a);return d}finally{if(Ec=!1,(Mt!==null||Cn!==null)&&(xh(),Mt&&(a=Mt,s=Cn,Cn=Mt=null,vs(a),s)))for(a=0;a<s.length;a++)vs(s[a])}}function Tc(s,a){var l=s.stateNode;if(l===null)return null;var d=l[Gt]||null;if(d===null)return null;l=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cm=!1;if(xr)try{var Ac={};Object.defineProperty(Ac,"passive",{get:function(){cm=!0}}),window.addEventListener("test",Ac,Ac),window.removeEventListener("test",Ac,Ac)}catch{cm=!1}var aa=null,um=null,Bd=null;function M1(){if(Bd)return Bd;var s,a=um,l=a.length,d,m="value"in aa?aa.value:aa.textContent,y=m.length;for(s=0;s<l&&a[s]===m[s];s++);var k=l-s;for(d=1;d<=k&&a[l-d]===m[y-d];d++);return Bd=m.slice(s,1<d?1-d:void 0)}function Pd(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function $d(){return!0}function j1(){return!1}function Wi(s){function a(l,d,m,y,k){this._reactName=l,this._targetInst=m,this.type=d,this.nativeEvent=y,this.target=k,this.currentTarget=null;for(var P in s)s.hasOwnProperty(P)&&(l=s[P],this[P]=l?l(y):y[P]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?$d:j1,this.isPropagationStopped=j1,this}return _(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=$d)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=$d)},persist:function(){},isPersistent:$d}),a}var io={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=Wi(io),Rc=_({},io,{view:0,detail:0}),WM=Wi(Rc),dm,hm,Nc,Hd=_({},Rc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Nc&&(Nc&&s.type==="mousemove"?(dm=s.screenX-Nc.screenX,hm=s.screenY-Nc.screenY):hm=dm=0,Nc=s),dm)},movementY:function(s){return"movementY"in s?s.movementY:hm}}),O1=Wi(Hd),qM=_({},Hd,{dataTransfer:0}),GM=Wi(qM),KM=_({},Rc,{relatedTarget:0}),fm=Wi(KM),VM=_({},io,{animationName:0,elapsedTime:0,pseudoElement:0}),YM=Wi(VM),XM=_({},io,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),ZM=Wi(XM),JM=_({},io,{data:0}),D1=Wi(JM),QM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e3={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"},t3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function n3(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=t3[s])?!!a[s]:!1}function pm(){return n3}var i3=_({},Rc,{key:function(s){if(s.key){var a=QM[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=Pd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?e3[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pm,charCode:function(s){return s.type==="keypress"?Pd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Pd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),s3=Wi(i3),r3=_({},Hd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),I1=Wi(r3),a3=_({},Rc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pm}),o3=Wi(a3),l3=_({},io,{propertyName:0,elapsedTime:0,pseudoElement:0}),c3=Wi(l3),u3=_({},Hd,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),d3=Wi(u3),h3=_({},io,{newState:0,oldState:0}),f3=Wi(h3),p3=[9,13,27,32],mm=xr&&"CompositionEvent"in window,Lc=null;xr&&"documentMode"in document&&(Lc=document.documentMode);var m3=xr&&"TextEvent"in window&&!Lc,B1=xr&&(!mm||Lc&&8<Lc&&11>=Lc),P1=" ",$1=!1;function z1(s,a){switch(s){case"keyup":return p3.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function H1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Qo=!1;function g3(s,a){switch(s){case"compositionend":return H1(a);case"keypress":return a.which!==32?null:($1=!0,P1);case"textInput":return s=a.data,s===P1&&$1?null:s;default:return null}}function _3(s,a){if(Qo)return s==="compositionend"||!mm&&z1(s,a)?(s=M1(),Bd=um=aa=null,Qo=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return B1&&a.locale!=="ko"?null:a.data;default:return null}}var v3={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 F1(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!v3[s.type]:a==="textarea"}function U1(s,a,l,d){Mt?Cn?Cn.push(d):Cn=[d]:Mt=d,a=Nh(a,"onChange"),0<a.length&&(l=new zd("onChange","change",null,l,d),s.push({event:l,listeners:a}))}var Mc=null,jc=null;function y3(s){kx(s,0)}function Fd(s){var a=Ee(s);if(to(a))return s}function W1(s,a){if(s==="change")return a}var q1=!1;if(xr){var gm;if(xr){var _m="oninput"in document;if(!_m){var G1=document.createElement("div");G1.setAttribute("oninput","return;"),_m=typeof G1.oninput=="function"}gm=_m}else gm=!1;q1=gm&&(!document.documentMode||9<document.documentMode)}function K1(){Mc&&(Mc.detachEvent("onpropertychange",V1),jc=Mc=null)}function V1(s){if(s.propertyName==="value"&&Fd(jc)){var a=[];U1(a,jc,s,_t(s)),Id(y3,a)}}function b3(s,a,l){s==="focusin"?(K1(),Mc=a,jc=l,Mc.attachEvent("onpropertychange",V1)):s==="focusout"&&K1()}function S3(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Fd(jc)}function w3(s,a){if(s==="click")return Fd(a)}function x3(s,a){if(s==="input"||s==="change")return Fd(a)}function C3(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var ns=typeof Object.is=="function"?Object.is:C3;function Oc(s,a){if(ns(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var l=Object.keys(s),d=Object.keys(a);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var m=l[d];if(!Ye.call(a,m)||!ns(s[m],a[m]))return!1}return!0}function Y1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function X1(s,a){var l=Y1(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=a&&d>=a)return{node:l,offset:a-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Y1(l)}}function Z1(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?Z1(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function J1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Xo(s.document);a instanceof s.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)s=a.contentWindow;else break;a=Xo(s.document)}return a}function vm(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var k3=xr&&"documentMode"in document&&11>=document.documentMode,el=null,ym=null,Dc=null,bm=!1;function Q1(s,a,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;bm||el==null||el!==Xo(d)||(d=el,"selectionStart"in d&&vm(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Dc&&Oc(Dc,d)||(Dc=d,d=Nh(ym,"onSelect"),0<d.length&&(a=new zd("onSelect","select",null,a,l),s.push({event:a,listeners:d}),a.target=el)))}function so(s,a){var l={};return l[s.toLowerCase()]=a.toLowerCase(),l["Webkit"+s]="webkit"+a,l["Moz"+s]="moz"+a,l}var tl={animationend:so("Animation","AnimationEnd"),animationiteration:so("Animation","AnimationIteration"),animationstart:so("Animation","AnimationStart"),transitionrun:so("Transition","TransitionRun"),transitionstart:so("Transition","TransitionStart"),transitioncancel:so("Transition","TransitionCancel"),transitionend:so("Transition","TransitionEnd")},Sm={},eS={};xr&&(eS=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function ro(s){if(Sm[s])return Sm[s];if(!tl[s])return s;var a=tl[s],l;for(l in a)if(a.hasOwnProperty(l)&&l in eS)return Sm[s]=a[l];return s}var tS=ro("animationend"),nS=ro("animationiteration"),iS=ro("animationstart"),E3=ro("transitionrun"),T3=ro("transitionstart"),A3=ro("transitioncancel"),sS=ro("transitionend"),rS=new Map,wm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");wm.push("scrollEnd");function Hs(s,a){rS.set(s,a),zt(a,[s])}var Ud=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},ys=[],nl=0,xm=0;function Wd(){for(var s=nl,a=xm=nl=0;a<s;){var l=ys[a];ys[a++]=null;var d=ys[a];ys[a++]=null;var m=ys[a];ys[a++]=null;var y=ys[a];if(ys[a++]=null,d!==null&&m!==null){var k=d.pending;k===null?m.next=m:(m.next=k.next,k.next=m),d.pending=m}y!==0&&aS(l,m,y)}}function qd(s,a,l,d){ys[nl++]=s,ys[nl++]=a,ys[nl++]=l,ys[nl++]=d,xm|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Cm(s,a,l,d){return qd(s,a,l,d),Gd(s)}function ao(s,a){return qd(s,null,null,a),Gd(s)}function aS(s,a,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var m=!1,y=s.return;y!==null;)y.childLanes|=l,d=y.alternate,d!==null&&(d.childLanes|=l),y.tag===22&&(s=y.stateNode,s===null||s._visibility&1||(m=!0)),s=y,y=y.return;return s.tag===3?(y=s.stateNode,m&&a!==null&&(m=31-Bt(l),s=y.hiddenUpdates,d=s[m],d===null?s[m]=[a]:d.push(a),a.lane=l|536870912),y):null}function Gd(s){if(50<iu)throw iu=0,jg=null,Error(i(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var il={};function R3(s,a,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function is(s,a,l,d){return new R3(s,a,l,d)}function km(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Cr(s,a){var l=s.alternate;return l===null?(l=is(s.tag,a,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=a,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,a=s.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function oS(s,a){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,a=l.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Kd(s,a,l,d,m,y){var k=0;if(d=s,typeof s=="function")km(s)&&(k=1);else if(typeof s=="string")k=O6(s,l,re.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case J:return s=is(31,l,a,m),s.elementType=J,s.lanes=y,s;case C:return oo(l.children,m,y,a);case x:k=8,m|=24;break;case I:return s=is(12,l,a,m|2),s.elementType=I,s.lanes=y,s;case O:return s=is(13,l,a,m),s.elementType=O,s.lanes=y,s;case R:return s=is(19,l,a,m),s.elementType=R,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case U:k=10;break e;case z:k=9;break e;case A:k=11;break e;case $:k=14;break e;case H:k=16,d=null;break e}k=29,l=Error(i(130,s===null?"null":typeof s,"")),d=null}return a=is(k,l,a,m),a.elementType=s,a.type=d,a.lanes=y,a}function oo(s,a,l,d){return s=is(7,s,d,a),s.lanes=l,s}function Em(s,a,l){return s=is(6,s,null,a),s.lanes=l,s}function lS(s){var a=is(18,null,null,0);return a.stateNode=s,a}function Tm(s,a,l){return a=is(4,s.children!==null?s.children:[],s.key,a),a.lanes=l,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var cS=new WeakMap;function bs(s,a){if(typeof s=="object"&&s!==null){var l=cS.get(s);return l!==void 0?l:(a={value:s,source:a,stack:le(a)},cS.set(s,a),a)}return{value:s,source:a,stack:le(a)}}var sl=[],rl=0,Vd=null,Ic=0,Ss=[],ws=0,oa=null,er=1,tr="";function kr(s,a){sl[rl++]=Ic,sl[rl++]=Vd,Vd=s,Ic=a}function uS(s,a,l){Ss[ws++]=er,Ss[ws++]=tr,Ss[ws++]=oa,oa=s;var d=er;s=tr;var m=32-Bt(d)-1;d&=~(1<<m),l+=1;var y=32-Bt(a)+m;if(30<y){var k=m-m%5;y=(d&(1<<k)-1).toString(32),d>>=k,m-=k,er=1<<32-Bt(a)+m|l<<m|d,tr=y+s}else er=1<<y|l<<m|d,tr=s}function Am(s){s.return!==null&&(kr(s,1),uS(s,1,0))}function Rm(s){for(;s===Vd;)Vd=sl[--rl],sl[rl]=null,Ic=sl[--rl],sl[rl]=null;for(;s===oa;)oa=Ss[--ws],Ss[ws]=null,tr=Ss[--ws],Ss[ws]=null,er=Ss[--ws],Ss[ws]=null}function dS(s,a){Ss[ws++]=er,Ss[ws++]=tr,Ss[ws++]=oa,er=a.id,tr=a.overflow,oa=s}var mi=null,pn=null,It=!1,la=null,xs=!1,Nm=Error(i(519));function ca(s){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bc(bs(a,s)),Nm}function hS(s){var a=s.stateNode,l=s.type,d=s.memoizedProps;switch(a[on]=s,a[Gt]=d,l){case"dialog":Nt("cancel",a),Nt("close",a);break;case"iframe":case"object":case"embed":Nt("load",a);break;case"video":case"audio":for(l=0;l<ru.length;l++)Nt(ru[l],a);break;case"source":Nt("error",a);break;case"img":case"image":case"link":Nt("error",a),Nt("load",a);break;case"details":Nt("toggle",a);break;case"input":Nt("invalid",a),no(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Nt("invalid",a);break;case"textarea":Nt("invalid",a),Jo(a,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||d.suppressHydrationWarning===!0||Rx(a.textContent,l)?(d.popover!=null&&(Nt("beforetoggle",a),Nt("toggle",a)),d.onScroll!=null&&Nt("scroll",a),d.onScrollEnd!=null&&Nt("scrollend",a),d.onClick!=null&&(a.onclick=Ae),a=!0):a=!1,a||ca(s,!0)}function fS(s){for(mi=s.return;mi;)switch(mi.tag){case 5:case 31:case 13:xs=!1;return;case 27:case 3:xs=!0;return;default:mi=mi.return}}function al(s){if(s!==mi)return!1;if(!It)return fS(s),It=!0,!1;var a=s.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Vg(s.type,s.memoizedProps)),l=!l),l&&pn&&ca(s),fS(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));pn=Px(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));pn=Px(s)}else a===27?(a=pn,xa(s.type)?(s=Qg,Qg=null,pn=s):pn=a):pn=mi?ks(s.stateNode.nextSibling):null;return!0}function lo(){pn=mi=null,It=!1}function Lm(){var s=la;return s!==null&&(Vi===null?Vi=s:Vi.push.apply(Vi,s),la=null),s}function Bc(s){la===null?la=[s]:la.push(s)}var Mm=E(null),co=null,Er=null;function ua(s,a,l){Y(Mm,a._currentValue),a._currentValue=l}function Tr(s){s._currentValue=Mm.current,G(Mm)}function jm(s,a,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),s===l)break;s=s.return}}function Om(s,a,l,d){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var y=m.dependencies;if(y!==null){var k=m.child;y=y.firstContext;e:for(;y!==null;){var P=y;y=m;for(var X=0;X<a.length;X++)if(P.context===a[X]){y.lanes|=l,P=y.alternate,P!==null&&(P.lanes|=l),jm(y.return,l,s),d||(k=null);break e}y=P.next}}else if(m.tag===18){if(k=m.return,k===null)throw Error(i(341));k.lanes|=l,y=k.alternate,y!==null&&(y.lanes|=l),jm(k,l,s),k=null}else k=m.child;if(k!==null)k.return=m;else for(k=m;k!==null;){if(k===s){k=null;break}if(m=k.sibling,m!==null){m.return=k.return,k=m;break}k=k.return}m=k}}function ol(s,a,l,d){s=null;for(var m=a,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var k=m.alternate;if(k===null)throw Error(i(387));if(k=k.memoizedProps,k!==null){var P=m.type;ns(m.pendingProps.value,k.value)||(s!==null?s.push(P):s=[P])}}else if(m===ke.current){if(k=m.alternate,k===null)throw Error(i(387));k.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(uu):s=[uu])}m=m.return}s!==null&&Om(a,s,l,d),a.flags|=262144}function Yd(s){for(s=s.firstContext;s!==null;){if(!ns(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function uo(s){co=s,Er=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function gi(s){return pS(co,s)}function Xd(s,a){return co===null&&uo(s),pS(s,a)}function pS(s,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Er===null){if(s===null)throw Error(i(308));Er=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else Er=Er.next=a;return l}var N3=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){a.aborted=!0,s.forEach(function(l){return l()})}},L3=e.unstable_scheduleCallback,M3=e.unstable_NormalPriority,zn={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dm(){return{controller:new N3,data:new Map,refCount:0}}function Pc(s){s.refCount--,s.refCount===0&&L3(M3,function(){s.controller.abort()})}var $c=null,Im=0,ll=0,cl=null;function j3(s,a){if($c===null){var l=$c=[];Im=0,ll=$g(),cl={status:"pending",value:void 0,then:function(d){l.push(d)}}}return Im++,a.then(mS,mS),a}function mS(){if(--Im===0&&$c!==null){cl!==null&&(cl.status="fulfilled");var s=$c;$c=null,ll=0,cl=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function O3(s,a){var l=[],d={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return s.then(function(){d.status="fulfilled",d.value=a;for(var m=0;m<l.length;m++)(0,l[m])(a)},function(m){for(d.status="rejected",d.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),d}var gS=T.S;T.S=function(s,a){Qw=wt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&j3(s,a),gS!==null&&gS(s,a)};var ho=E(null);function Bm(){var s=ho.current;return s!==null?s:ln.pooledCache}function Zd(s,a){a===null?Y(ho,ho.current):Y(ho,a.pool)}function _S(){var s=Bm();return s===null?null:{parent:zn._currentValue,pool:s}}var ul=Error(i(460)),Pm=Error(i(474)),Jd=Error(i(542)),Qd={then:function(){}};function vS(s){return s=s.status,s==="fulfilled"||s==="rejected"}function yS(s,a,l){switch(l=s[l],l===void 0?s.push(a):l!==a&&(a.then(Ae,Ae),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,SS(s),s;default:if(typeof a.status=="string")a.then(Ae,Ae);else{if(s=ln,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=a,s.status="pending",s.then(function(d){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=d}},function(d){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,SS(s),s}throw po=a,ul}}function fo(s){try{var a=s._init;return a(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(po=l,ul):l}}var po=null;function bS(){if(po===null)throw Error(i(459));var s=po;return po=null,s}function SS(s){if(s===ul||s===Jd)throw Error(i(483))}var dl=null,zc=0;function eh(s){var a=zc;return zc+=1,dl===null&&(dl=[]),yS(dl,s,a)}function Hc(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function th(s,a){throw a.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(a),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function wS(s){function a(ee,Q){if(s){var ne=ee.deletions;ne===null?(ee.deletions=[Q],ee.flags|=16):ne.push(Q)}}function l(ee,Q){if(!s)return null;for(;Q!==null;)a(ee,Q),Q=Q.sibling;return null}function d(ee){for(var Q=new Map;ee!==null;)ee.key!==null?Q.set(ee.key,ee):Q.set(ee.index,ee),ee=ee.sibling;return Q}function m(ee,Q){return ee=Cr(ee,Q),ee.index=0,ee.sibling=null,ee}function y(ee,Q,ne){return ee.index=ne,s?(ne=ee.alternate,ne!==null?(ne=ne.index,ne<Q?(ee.flags|=67108866,Q):ne):(ee.flags|=67108866,Q)):(ee.flags|=1048576,Q)}function k(ee){return s&&ee.alternate===null&&(ee.flags|=67108866),ee}function P(ee,Q,ne,ge){return Q===null||Q.tag!==6?(Q=Em(ne,ee.mode,ge),Q.return=ee,Q):(Q=m(Q,ne),Q.return=ee,Q)}function X(ee,Q,ne,ge){var tt=ne.type;return tt===C?pe(ee,Q,ne.props.children,ge,ne.key):Q!==null&&(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===H&&fo(tt)===Q.type)?(Q=m(Q,ne.props),Hc(Q,ne),Q.return=ee,Q):(Q=Kd(ne.type,ne.key,ne.props,null,ee.mode,ge),Hc(Q,ne),Q.return=ee,Q)}function ie(ee,Q,ne,ge){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ne.containerInfo||Q.stateNode.implementation!==ne.implementation?(Q=Tm(ne,ee.mode,ge),Q.return=ee,Q):(Q=m(Q,ne.children||[]),Q.return=ee,Q)}function pe(ee,Q,ne,ge,tt){return Q===null||Q.tag!==7?(Q=oo(ne,ee.mode,ge,tt),Q.return=ee,Q):(Q=m(Q,ne),Q.return=ee,Q)}function _e(ee,Q,ne){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Em(""+Q,ee.mode,ne),Q.return=ee,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case S:return ne=Kd(Q.type,Q.key,Q.props,null,ee.mode,ne),Hc(ne,Q),ne.return=ee,ne;case w:return Q=Tm(Q,ee.mode,ne),Q.return=ee,Q;case H:return Q=fo(Q),_e(ee,Q,ne)}if(j(Q)||M(Q))return Q=oo(Q,ee.mode,ne,null),Q.return=ee,Q;if(typeof Q.then=="function")return _e(ee,eh(Q),ne);if(Q.$$typeof===U)return _e(ee,Xd(ee,Q),ne);th(ee,Q)}return null}function oe(ee,Q,ne,ge){var tt=Q!==null?Q.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return tt!==null?null:P(ee,Q,""+ne,ge);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return ne.key===tt?X(ee,Q,ne,ge):null;case w:return ne.key===tt?ie(ee,Q,ne,ge):null;case H:return ne=fo(ne),oe(ee,Q,ne,ge)}if(j(ne)||M(ne))return tt!==null?null:pe(ee,Q,ne,ge,null);if(typeof ne.then=="function")return oe(ee,Q,eh(ne),ge);if(ne.$$typeof===U)return oe(ee,Q,Xd(ee,ne),ge);th(ee,ne)}return null}function de(ee,Q,ne,ge,tt){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ee=ee.get(ne)||null,P(Q,ee,""+ge,tt);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case S:return ee=ee.get(ge.key===null?ne:ge.key)||null,X(Q,ee,ge,tt);case w:return ee=ee.get(ge.key===null?ne:ge.key)||null,ie(Q,ee,ge,tt);case H:return ge=fo(ge),de(ee,Q,ne,ge,tt)}if(j(ge)||M(ge))return ee=ee.get(ne)||null,pe(Q,ee,ge,tt,null);if(typeof ge.then=="function")return de(ee,Q,ne,eh(ge),tt);if(ge.$$typeof===U)return de(ee,Q,ne,Xd(Q,ge),tt);th(Q,ge)}return null}function Fe(ee,Q,ne,ge){for(var tt=null,Ht=null,Ve=Q,bt=Q=0,Ot=null;Ve!==null&&bt<ne.length;bt++){Ve.index>bt?(Ot=Ve,Ve=null):Ot=Ve.sibling;var Ft=oe(ee,Ve,ne[bt],ge);if(Ft===null){Ve===null&&(Ve=Ot);break}s&&Ve&&Ft.alternate===null&&a(ee,Ve),Q=y(Ft,Q,bt),Ht===null?tt=Ft:Ht.sibling=Ft,Ht=Ft,Ve=Ot}if(bt===ne.length)return l(ee,Ve),It&&kr(ee,bt),tt;if(Ve===null){for(;bt<ne.length;bt++)Ve=_e(ee,ne[bt],ge),Ve!==null&&(Q=y(Ve,Q,bt),Ht===null?tt=Ve:Ht.sibling=Ve,Ht=Ve);return It&&kr(ee,bt),tt}for(Ve=d(Ve);bt<ne.length;bt++)Ot=de(Ve,ee,bt,ne[bt],ge),Ot!==null&&(s&&Ot.alternate!==null&&Ve.delete(Ot.key===null?bt:Ot.key),Q=y(Ot,Q,bt),Ht===null?tt=Ot:Ht.sibling=Ot,Ht=Ot);return s&&Ve.forEach(function(Aa){return a(ee,Aa)}),It&&kr(ee,bt),tt}function st(ee,Q,ne,ge){if(ne==null)throw Error(i(151));for(var tt=null,Ht=null,Ve=Q,bt=Q=0,Ot=null,Ft=ne.next();Ve!==null&&!Ft.done;bt++,Ft=ne.next()){Ve.index>bt?(Ot=Ve,Ve=null):Ot=Ve.sibling;var Aa=oe(ee,Ve,Ft.value,ge);if(Aa===null){Ve===null&&(Ve=Ot);break}s&&Ve&&Aa.alternate===null&&a(ee,Ve),Q=y(Aa,Q,bt),Ht===null?tt=Aa:Ht.sibling=Aa,Ht=Aa,Ve=Ot}if(Ft.done)return l(ee,Ve),It&&kr(ee,bt),tt;if(Ve===null){for(;!Ft.done;bt++,Ft=ne.next())Ft=_e(ee,Ft.value,ge),Ft!==null&&(Q=y(Ft,Q,bt),Ht===null?tt=Ft:Ht.sibling=Ft,Ht=Ft);return It&&kr(ee,bt),tt}for(Ve=d(Ve);!Ft.done;bt++,Ft=ne.next())Ft=de(Ve,ee,bt,Ft.value,ge),Ft!==null&&(s&&Ft.alternate!==null&&Ve.delete(Ft.key===null?bt:Ft.key),Q=y(Ft,Q,bt),Ht===null?tt=Ft:Ht.sibling=Ft,Ht=Ft);return s&&Ve.forEach(function(q6){return a(ee,q6)}),It&&kr(ee,bt),tt}function sn(ee,Q,ne,ge){if(typeof ne=="object"&&ne!==null&&ne.type===C&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:e:{for(var tt=ne.key;Q!==null;){if(Q.key===tt){if(tt=ne.type,tt===C){if(Q.tag===7){l(ee,Q.sibling),ge=m(Q,ne.props.children),ge.return=ee,ee=ge;break e}}else if(Q.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===H&&fo(tt)===Q.type){l(ee,Q.sibling),ge=m(Q,ne.props),Hc(ge,ne),ge.return=ee,ee=ge;break e}l(ee,Q);break}else a(ee,Q);Q=Q.sibling}ne.type===C?(ge=oo(ne.props.children,ee.mode,ge,ne.key),ge.return=ee,ee=ge):(ge=Kd(ne.type,ne.key,ne.props,null,ee.mode,ge),Hc(ge,ne),ge.return=ee,ee=ge)}return k(ee);case w:e:{for(tt=ne.key;Q!==null;){if(Q.key===tt)if(Q.tag===4&&Q.stateNode.containerInfo===ne.containerInfo&&Q.stateNode.implementation===ne.implementation){l(ee,Q.sibling),ge=m(Q,ne.children||[]),ge.return=ee,ee=ge;break e}else{l(ee,Q);break}else a(ee,Q);Q=Q.sibling}ge=Tm(ne,ee.mode,ge),ge.return=ee,ee=ge}return k(ee);case H:return ne=fo(ne),sn(ee,Q,ne,ge)}if(j(ne))return Fe(ee,Q,ne,ge);if(M(ne)){if(tt=M(ne),typeof tt!="function")throw Error(i(150));return ne=tt.call(ne),st(ee,Q,ne,ge)}if(typeof ne.then=="function")return sn(ee,Q,eh(ne),ge);if(ne.$$typeof===U)return sn(ee,Q,Xd(ee,ne),ge);th(ee,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Q!==null&&Q.tag===6?(l(ee,Q.sibling),ge=m(Q,ne),ge.return=ee,ee=ge):(l(ee,Q),ge=Em(ne,ee.mode,ge),ge.return=ee,ee=ge),k(ee)):l(ee,Q)}return function(ee,Q,ne,ge){try{zc=0;var tt=sn(ee,Q,ne,ge);return dl=null,tt}catch(Ve){if(Ve===ul||Ve===Jd)throw Ve;var Ht=is(29,Ve,null,ee.mode);return Ht.lanes=ge,Ht.return=ee,Ht}}}var mo=wS(!0),xS=wS(!1),da=!1;function $m(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zm(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ha(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function fa(s,a,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(qt&2)!==0){var m=d.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),d.pending=a,a=Gd(s),aS(s,null,l),a}return qd(s,d,a,l),Gd(s)}function Fc(s,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var d=a.lanes;d&=s.pendingLanes,l|=d,a.lanes=l,nt(s,l)}}function Hm(s,a){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var m=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var k={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?m=y=k:y=y.next=k,l=l.next}while(l!==null);y===null?m=y=a:y=y.next=a}else m=y=a;l={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=a:s.next=a,l.lastBaseUpdate=a}var Fm=!1;function Uc(){if(Fm){var s=cl;if(s!==null)throw s}}function Wc(s,a,l,d){Fm=!1;var m=s.updateQueue;da=!1;var y=m.firstBaseUpdate,k=m.lastBaseUpdate,P=m.shared.pending;if(P!==null){m.shared.pending=null;var X=P,ie=X.next;X.next=null,k===null?y=ie:k.next=ie,k=X;var pe=s.alternate;pe!==null&&(pe=pe.updateQueue,P=pe.lastBaseUpdate,P!==k&&(P===null?pe.firstBaseUpdate=ie:P.next=ie,pe.lastBaseUpdate=X))}if(y!==null){var _e=m.baseState;k=0,pe=ie=X=null,P=y;do{var oe=P.lane&-536870913,de=oe!==P.lane;if(de?(jt&oe)===oe:(d&oe)===oe){oe!==0&&oe===ll&&(Fm=!0),pe!==null&&(pe=pe.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Fe=s,st=P;oe=a;var sn=l;switch(st.tag){case 1:if(Fe=st.payload,typeof Fe=="function"){_e=Fe.call(sn,_e,oe);break e}_e=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=st.payload,oe=typeof Fe=="function"?Fe.call(sn,_e,oe):Fe,oe==null)break e;_e=_({},_e,oe);break e;case 2:da=!0}}oe=P.callback,oe!==null&&(s.flags|=64,de&&(s.flags|=8192),de=m.callbacks,de===null?m.callbacks=[oe]:de.push(oe))}else de={lane:oe,tag:P.tag,payload:P.payload,callback:P.callback,next:null},pe===null?(ie=pe=de,X=_e):pe=pe.next=de,k|=oe;if(P=P.next,P===null){if(P=m.shared.pending,P===null)break;de=P,P=de.next,de.next=null,m.lastBaseUpdate=de,m.shared.pending=null}}while(!0);pe===null&&(X=_e),m.baseState=X,m.firstBaseUpdate=ie,m.lastBaseUpdate=pe,y===null&&(m.shared.lanes=0),va|=k,s.lanes=k,s.memoizedState=_e}}function CS(s,a){if(typeof s!="function")throw Error(i(191,s));s.call(a)}function kS(s,a){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)CS(l[s],a)}var hl=E(null),nh=E(0);function ES(s,a){s=Ir,Y(nh,s),Y(hl,a),Ir=s|a.baseLanes}function Um(){Y(nh,Ir),Y(hl,hl.current)}function Wm(){Ir=nh.current,G(hl),G(nh)}var ss=E(null),Cs=null;function pa(s){var a=s.alternate;Y(Dn,Dn.current&1),Y(ss,s),Cs===null&&(a===null||hl.current!==null||a.memoizedState!==null)&&(Cs=s)}function qm(s){Y(Dn,Dn.current),Y(ss,s),Cs===null&&(Cs=s)}function TS(s){s.tag===22?(Y(Dn,Dn.current),Y(ss,s),Cs===null&&(Cs=s)):ma()}function ma(){Y(Dn,Dn.current),Y(ss,ss.current)}function rs(s){G(ss),Cs===s&&(Cs=null),G(Dn)}var Dn=E(0);function ih(s){for(var a=s;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Zg(l)||Jg(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ar=0,yt=null,tn=null,Hn=null,sh=!1,fl=!1,go=!1,rh=0,qc=0,pl=null,D3=0;function Tn(){throw Error(i(321))}function Gm(s,a){if(a===null)return!1;for(var l=0;l<a.length&&l<s.length;l++)if(!ns(s[l],a[l]))return!1;return!0}function Km(s,a,l,d,m,y){return Ar=y,yt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,T.H=s===null||s.memoizedState===null?uw:lg,go=!1,y=l(d,m),go=!1,fl&&(y=RS(a,l,d,m)),AS(s),y}function AS(s){T.H=Vc;var a=tn!==null&&tn.next!==null;if(Ar=0,Hn=tn=yt=null,sh=!1,qc=0,pl=null,a)throw Error(i(300));s===null||Fn||(s=s.dependencies,s!==null&&Yd(s)&&(Fn=!0))}function RS(s,a,l,d){yt=s;var m=0;do{if(fl&&(pl=null),qc=0,fl=!1,25<=m)throw Error(i(301));if(m+=1,Hn=tn=null,s.updateQueue!=null){var y=s.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}T.H=dw,y=a(l,d)}while(fl);return y}function I3(){var s=T.H,a=s.useState()[0];return a=typeof a.then=="function"?Gc(a):a,s=s.useState()[0],(tn!==null?tn.memoizedState:null)!==s&&(yt.flags|=1024),a}function Vm(){var s=rh!==0;return rh=0,s}function Ym(s,a,l){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~l}function Xm(s){if(sh){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}sh=!1}Ar=0,Hn=tn=yt=null,fl=!1,qc=rh=0,pl=null}function Li(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Hn===null?yt.memoizedState=Hn=s:Hn=Hn.next=s,Hn}function In(){if(tn===null){var s=yt.alternate;s=s!==null?s.memoizedState:null}else s=tn.next;var a=Hn===null?yt.memoizedState:Hn.next;if(a!==null)Hn=a,tn=s;else{if(s===null)throw yt.alternate===null?Error(i(467)):Error(i(310));tn=s,s={memoizedState:tn.memoizedState,baseState:tn.baseState,baseQueue:tn.baseQueue,queue:tn.queue,next:null},Hn===null?yt.memoizedState=Hn=s:Hn=Hn.next=s}return Hn}function ah(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gc(s){var a=qc;return qc+=1,pl===null&&(pl=[]),s=yS(pl,s,a),a=yt,(Hn===null?a.memoizedState:Hn.next)===null&&(a=a.alternate,T.H=a===null||a.memoizedState===null?uw:lg),s}function oh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Gc(s);if(s.$$typeof===U)return gi(s)}throw Error(i(438,String(s)))}function Zm(s){var a=null,l=yt.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var d=yt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=ah(),yt.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(s),d=0;d<s;d++)l[d]=Z;return a.index++,l}function Rr(s,a){return typeof a=="function"?a(s):a}function lh(s){var a=In();return Jm(a,tn,s)}function Jm(s,a,l){var d=s.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=l;var m=s.baseQueue,y=d.pending;if(y!==null){if(m!==null){var k=m.next;m.next=y.next,y.next=k}a.baseQueue=m=y,d.pending=null}if(y=s.baseState,m===null)s.memoizedState=y;else{a=m.next;var P=k=null,X=null,ie=a,pe=!1;do{var _e=ie.lane&-536870913;if(_e!==ie.lane?(jt&_e)===_e:(Ar&_e)===_e){var oe=ie.revertLane;if(oe===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),_e===ll&&(pe=!0);else if((Ar&oe)===oe){ie=ie.next,oe===ll&&(pe=!0);continue}else _e={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},X===null?(P=X=_e,k=y):X=X.next=_e,yt.lanes|=oe,va|=oe;_e=ie.action,go&&l(y,_e),y=ie.hasEagerState?ie.eagerState:l(y,_e)}else oe={lane:_e,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},X===null?(P=X=oe,k=y):X=X.next=oe,yt.lanes|=_e,va|=_e;ie=ie.next}while(ie!==null&&ie!==a);if(X===null?k=y:X.next=P,!ns(y,s.memoizedState)&&(Fn=!0,pe&&(l=cl,l!==null)))throw l;s.memoizedState=y,s.baseState=k,s.baseQueue=X,d.lastRenderedState=y}return m===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Qm(s){var a=In(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=s;var d=l.dispatch,m=l.pending,y=a.memoizedState;if(m!==null){l.pending=null;var k=m=m.next;do y=s(y,k.action),k=k.next;while(k!==m);ns(y,a.memoizedState)||(Fn=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),l.lastRenderedState=y}return[y,d]}function NS(s,a,l){var d=yt,m=In(),y=It;if(y){if(l===void 0)throw Error(i(407));l=l()}else l=a();var k=!ns((tn||m).memoizedState,l);if(k&&(m.memoizedState=l,Fn=!0),m=m.queue,ng(jS.bind(null,d,m,s),[s]),m.getSnapshot!==a||k||Hn!==null&&Hn.memoizedState.tag&1){if(d.flags|=2048,ml(9,{destroy:void 0},MS.bind(null,d,m,l,a),null),ln===null)throw Error(i(349));y||(Ar&127)!==0||LS(d,a,l)}return l}function LS(s,a,l){s.flags|=16384,s={getSnapshot:a,value:l},a=yt.updateQueue,a===null?(a=ah(),yt.updateQueue=a,a.stores=[s]):(l=a.stores,l===null?a.stores=[s]:l.push(s))}function MS(s,a,l,d){a.value=l,a.getSnapshot=d,OS(a)&&DS(s)}function jS(s,a,l){return l(function(){OS(a)&&DS(s)})}function OS(s){var a=s.getSnapshot;s=s.value;try{var l=a();return!ns(s,l)}catch{return!0}}function DS(s){var a=ao(s,2);a!==null&&Yi(a,s,2)}function eg(s){var a=Li();if(typeof s=="function"){var l=s;if(s=l(),go){Ct(!0);try{l()}finally{Ct(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:s},a}function IS(s,a,l,d){return s.baseState=l,Jm(s,tn,typeof d=="function"?d:Rr)}function B3(s,a,l,d,m){if(dh(s))throw Error(i(485));if(s=a.action,s!==null){var y={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){y.listeners.push(k)}};T.T!==null?l(!0):y.isTransition=!1,d(y),l=a.pending,l===null?(y.next=a.pending=y,BS(a,y)):(y.next=l.next,a.pending=l.next=y)}}function BS(s,a){var l=a.action,d=a.payload,m=s.state;if(a.isTransition){var y=T.T,k={};T.T=k;try{var P=l(m,d),X=T.S;X!==null&&X(k,P),PS(s,a,P)}catch(ie){tg(s,a,ie)}finally{y!==null&&k.types!==null&&(y.types=k.types),T.T=y}}else try{y=l(m,d),PS(s,a,y)}catch(ie){tg(s,a,ie)}}function PS(s,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){$S(s,a,d)},function(d){return tg(s,a,d)}):$S(s,a,l)}function $S(s,a,l){a.status="fulfilled",a.value=l,zS(a),s.state=l,a=s.pending,a!==null&&(l=a.next,l===a?s.pending=null:(l=l.next,a.next=l,BS(s,l)))}function tg(s,a,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=l,zS(a),a=a.next;while(a!==d)}s.action=null}function zS(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function HS(s,a){return a}function FS(s,a){if(It){var l=ln.formState;if(l!==null){e:{var d=yt;if(It){if(pn){t:{for(var m=pn,y=xs;m.nodeType!==8;){if(!y){m=null;break t}if(m=ks(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){pn=ks(m.nextSibling),d=m.data==="F!";break e}}ca(d)}d=!1}d&&(a=l[0])}}return l=Li(),l.memoizedState=l.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:HS,lastRenderedState:a},l.queue=d,l=ow.bind(null,yt,d),d.dispatch=l,d=eg(!1),y=og.bind(null,yt,!1,d.queue),d=Li(),m={state:a,dispatch:null,action:s,pending:null},d.queue=m,l=B3.bind(null,yt,m,y,l),m.dispatch=l,d.memoizedState=s,[a,l,!1]}function US(s){var a=In();return WS(a,tn,s)}function WS(s,a,l){if(a=Jm(s,a,HS)[0],s=lh(Rr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=Gc(a)}catch(k){throw k===ul?Jd:k}else d=a;a=In();var m=a.queue,y=m.dispatch;return l!==a.memoizedState&&(yt.flags|=2048,ml(9,{destroy:void 0},P3.bind(null,m,l),null)),[d,y,s]}function P3(s,a){s.action=a}function qS(s){var a=In(),l=tn;if(l!==null)return WS(a,l,s);In(),a=a.memoizedState,l=In();var d=l.queue.dispatch;return l.memoizedState=s,[a,d,!1]}function ml(s,a,l,d){return s={tag:s,create:l,deps:d,inst:a,next:null},a=yt.updateQueue,a===null&&(a=ah(),yt.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,a.lastEffect=s),s}function GS(){return In().memoizedState}function ch(s,a,l,d){var m=Li();yt.flags|=s,m.memoizedState=ml(1|a,{destroy:void 0},l,d===void 0?null:d)}function uh(s,a,l,d){var m=In();d=d===void 0?null:d;var y=m.memoizedState.inst;tn!==null&&d!==null&&Gm(d,tn.memoizedState.deps)?m.memoizedState=ml(a,y,l,d):(yt.flags|=s,m.memoizedState=ml(1|a,y,l,d))}function KS(s,a){ch(8390656,8,s,a)}function ng(s,a){uh(2048,8,s,a)}function $3(s){yt.flags|=4;var a=yt.updateQueue;if(a===null)a=ah(),yt.updateQueue=a,a.events=[s];else{var l=a.events;l===null?a.events=[s]:l.push(s)}}function VS(s){var a=In().memoizedState;return $3({ref:a,nextImpl:s}),function(){if((qt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function YS(s,a){return uh(4,2,s,a)}function XS(s,a){return uh(4,4,s,a)}function ZS(s,a){if(typeof a=="function"){s=s();var l=a(s);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function JS(s,a,l){l=l!=null?l.concat([s]):null,uh(4,4,ZS.bind(null,a,s),l)}function ig(){}function QS(s,a){var l=In();a=a===void 0?null:a;var d=l.memoizedState;return a!==null&&Gm(a,d[1])?d[0]:(l.memoizedState=[s,a],s)}function ew(s,a){var l=In();a=a===void 0?null:a;var d=l.memoizedState;if(a!==null&&Gm(a,d[1]))return d[0];if(d=s(),go){Ct(!0);try{s()}finally{Ct(!1)}}return l.memoizedState=[d,a],d}function sg(s,a,l){return l===void 0||(Ar&1073741824)!==0&&(jt&261930)===0?s.memoizedState=a:(s.memoizedState=l,s=tx(),yt.lanes|=s,va|=s,l)}function tw(s,a,l,d){return ns(l,a)?l:hl.current!==null?(s=sg(s,l,d),ns(s,a)||(Fn=!0),s):(Ar&42)===0||(Ar&1073741824)!==0&&(jt&261930)===0?(Fn=!0,s.memoizedState=l):(s=tx(),yt.lanes|=s,va|=s,a)}function nw(s,a,l,d,m){var y=B.p;B.p=y!==0&&8>y?y:8;var k=T.T,P={};T.T=P,og(s,!1,a,l);try{var X=m(),ie=T.S;if(ie!==null&&ie(P,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var pe=O3(X,d);Kc(s,a,pe,ls(s))}else Kc(s,a,d,ls(s))}catch(_e){Kc(s,a,{then:function(){},status:"rejected",reason:_e},ls())}finally{B.p=y,k!==null&&P.types!==null&&(k.types=P.types),T.T=k}}function z3(){}function rg(s,a,l,d){if(s.tag!==5)throw Error(i(476));var m=iw(s).queue;nw(s,m,a,L,l===null?z3:function(){return sw(s),l(d)})}function iw(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:L},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:l},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function sw(s){var a=iw(s);a.next===null&&(a=s.alternate.memoizedState),Kc(s,a.next.queue,{},ls())}function ag(){return gi(uu)}function rw(){return In().memoizedState}function aw(){return In().memoizedState}function H3(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var l=ls();s=ha(l);var d=fa(a,s,l);d!==null&&(Yi(d,a,l),Fc(d,a,l)),a={cache:Dm()},s.payload=a;return}a=a.return}}function F3(s,a,l){var d=ls();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},dh(s)?lw(a,l):(l=Cm(s,a,l,d),l!==null&&(Yi(l,s,d),cw(l,a,d)))}function ow(s,a,l){var d=ls();Kc(s,a,l,d)}function Kc(s,a,l,d){var m={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(dh(s))lw(a,m);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var k=a.lastRenderedState,P=y(k,l);if(m.hasEagerState=!0,m.eagerState=P,ns(P,k))return qd(s,a,m,0),ln===null&&Wd(),!1}catch{}if(l=Cm(s,a,m,d),l!==null)return Yi(l,s,d),cw(l,a,d),!0}return!1}function og(s,a,l,d){if(d={lane:2,revertLane:$g(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},dh(s)){if(a)throw Error(i(479))}else a=Cm(s,l,d,2),a!==null&&Yi(a,s,2)}function dh(s){var a=s.alternate;return s===yt||a!==null&&a===yt}function lw(s,a){fl=sh=!0;var l=s.pending;l===null?a.next=a:(a.next=l.next,l.next=a),s.pending=a}function cw(s,a,l){if((l&4194048)!==0){var d=a.lanes;d&=s.pendingLanes,l|=d,a.lanes=l,nt(s,l)}}var Vc={readContext:gi,use:oh,useCallback:Tn,useContext:Tn,useEffect:Tn,useImperativeHandle:Tn,useLayoutEffect:Tn,useInsertionEffect:Tn,useMemo:Tn,useReducer:Tn,useRef:Tn,useState:Tn,useDebugValue:Tn,useDeferredValue:Tn,useTransition:Tn,useSyncExternalStore:Tn,useId:Tn,useHostTransitionStatus:Tn,useFormState:Tn,useActionState:Tn,useOptimistic:Tn,useMemoCache:Tn,useCacheRefresh:Tn};Vc.useEffectEvent=Tn;var uw={readContext:gi,use:oh,useCallback:function(s,a){return Li().memoizedState=[s,a===void 0?null:a],s},useContext:gi,useEffect:KS,useImperativeHandle:function(s,a,l){l=l!=null?l.concat([s]):null,ch(4194308,4,ZS.bind(null,a,s),l)},useLayoutEffect:function(s,a){return ch(4194308,4,s,a)},useInsertionEffect:function(s,a){ch(4,2,s,a)},useMemo:function(s,a){var l=Li();a=a===void 0?null:a;var d=s();if(go){Ct(!0);try{s()}finally{Ct(!1)}}return l.memoizedState=[d,a],d},useReducer:function(s,a,l){var d=Li();if(l!==void 0){var m=l(a);if(go){Ct(!0);try{l(a)}finally{Ct(!1)}}}else m=a;return d.memoizedState=d.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},d.queue=s,s=s.dispatch=F3.bind(null,yt,s),[d.memoizedState,s]},useRef:function(s){var a=Li();return s={current:s},a.memoizedState=s},useState:function(s){s=eg(s);var a=s.queue,l=ow.bind(null,yt,a);return a.dispatch=l,[s.memoizedState,l]},useDebugValue:ig,useDeferredValue:function(s,a){var l=Li();return sg(l,s,a)},useTransition:function(){var s=eg(!1);return s=nw.bind(null,yt,s.queue,!0,!1),Li().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,l){var d=yt,m=Li();if(It){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),ln===null)throw Error(i(349));(jt&127)!==0||LS(d,a,l)}m.memoizedState=l;var y={value:l,getSnapshot:a};return m.queue=y,KS(jS.bind(null,d,y,s),[s]),d.flags|=2048,ml(9,{destroy:void 0},MS.bind(null,d,y,l,a),null),l},useId:function(){var s=Li(),a=ln.identifierPrefix;if(It){var l=tr,d=er;l=(d&~(1<<32-Bt(d)-1)).toString(32)+l,a="_"+a+"R_"+l,l=rh++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=D3++,a="_"+a+"r_"+l.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:ag,useFormState:FS,useActionState:FS,useOptimistic:function(s){var a=Li();a.memoizedState=a.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=og.bind(null,yt,!0,l),l.dispatch=a,[s,a]},useMemoCache:Zm,useCacheRefresh:function(){return Li().memoizedState=H3.bind(null,yt)},useEffectEvent:function(s){var a=Li(),l={impl:s};return a.memoizedState=l,function(){if((qt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},lg={readContext:gi,use:oh,useCallback:QS,useContext:gi,useEffect:ng,useImperativeHandle:JS,useInsertionEffect:YS,useLayoutEffect:XS,useMemo:ew,useReducer:lh,useRef:GS,useState:function(){return lh(Rr)},useDebugValue:ig,useDeferredValue:function(s,a){var l=In();return tw(l,tn.memoizedState,s,a)},useTransition:function(){var s=lh(Rr)[0],a=In().memoizedState;return[typeof s=="boolean"?s:Gc(s),a]},useSyncExternalStore:NS,useId:rw,useHostTransitionStatus:ag,useFormState:US,useActionState:US,useOptimistic:function(s,a){var l=In();return IS(l,tn,s,a)},useMemoCache:Zm,useCacheRefresh:aw};lg.useEffectEvent=VS;var dw={readContext:gi,use:oh,useCallback:QS,useContext:gi,useEffect:ng,useImperativeHandle:JS,useInsertionEffect:YS,useLayoutEffect:XS,useMemo:ew,useReducer:Qm,useRef:GS,useState:function(){return Qm(Rr)},useDebugValue:ig,useDeferredValue:function(s,a){var l=In();return tn===null?sg(l,s,a):tw(l,tn.memoizedState,s,a)},useTransition:function(){var s=Qm(Rr)[0],a=In().memoizedState;return[typeof s=="boolean"?s:Gc(s),a]},useSyncExternalStore:NS,useId:rw,useHostTransitionStatus:ag,useFormState:qS,useActionState:qS,useOptimistic:function(s,a){var l=In();return tn!==null?IS(l,tn,s,a):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Zm,useCacheRefresh:aw};dw.useEffectEvent=VS;function cg(s,a,l,d){a=s.memoizedState,l=l(d,a),l=l==null?a:_({},a,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var ug={enqueueSetState:function(s,a,l){s=s._reactInternals;var d=ls(),m=ha(d);m.payload=a,l!=null&&(m.callback=l),a=fa(s,m,d),a!==null&&(Yi(a,s,d),Fc(a,s,d))},enqueueReplaceState:function(s,a,l){s=s._reactInternals;var d=ls(),m=ha(d);m.tag=1,m.payload=a,l!=null&&(m.callback=l),a=fa(s,m,d),a!==null&&(Yi(a,s,d),Fc(a,s,d))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var l=ls(),d=ha(l);d.tag=2,a!=null&&(d.callback=a),a=fa(s,d,l),a!==null&&(Yi(a,s,l),Fc(a,s,l))}};function hw(s,a,l,d,m,y,k){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,y,k):a.prototype&&a.prototype.isPureReactComponent?!Oc(l,d)||!Oc(m,y):!0}function fw(s,a,l,d){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,d),a.state!==s&&ug.enqueueReplaceState(a,a.state,null)}function _o(s,a){var l=a;if("ref"in a){l={};for(var d in a)d!=="ref"&&(l[d]=a[d])}if(s=s.defaultProps){l===a&&(l=_({},l));for(var m in s)l[m]===void 0&&(l[m]=s[m])}return l}function pw(s){Ud(s)}function mw(s){console.error(s)}function gw(s){Ud(s)}function hh(s,a){try{var l=s.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function _w(s,a,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function dg(s,a,l){return l=ha(l),l.tag=3,l.payload={element:null},l.callback=function(){hh(s,a)},l}function vw(s){return s=ha(s),s.tag=3,s}function yw(s,a,l,d){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var y=d.value;s.payload=function(){return m(y)},s.callback=function(){_w(a,l,d)}}var k=l.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(s.callback=function(){_w(a,l,d),typeof m!="function"&&(ya===null?ya=new Set([this]):ya.add(this));var P=d.stack;this.componentDidCatch(d.value,{componentStack:P!==null?P:""})})}function U3(s,a,l,d,m){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=l.alternate,a!==null&&ol(a,l,m,!0),l=ss.current,l!==null){switch(l.tag){case 31:case 13:return Cs===null?Ch():l.alternate===null&&An===0&&(An=3),l.flags&=-257,l.flags|=65536,l.lanes=m,d===Qd?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([d]):a.add(d),Ig(s,d,m)),!1;case 22:return l.flags|=65536,d===Qd?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([d]):l.add(d)),Ig(s,d,m)),!1}throw Error(i(435,l.tag))}return Ig(s,d,m),Ch(),!1}if(It)return a=ss.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,d!==Nm&&(s=Error(i(422),{cause:d}),Bc(bs(s,l)))):(d!==Nm&&(a=Error(i(423),{cause:d}),Bc(bs(a,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,d=bs(d,l),m=dg(s.stateNode,d,m),Hm(s,m),An!==4&&(An=2)),!1;var y=Error(i(520),{cause:d});if(y=bs(y,l),nu===null?nu=[y]:nu.push(y),An!==4&&(An=2),a===null)return!0;d=bs(d,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,s=m&-m,l.lanes|=s,s=dg(l.stateNode,d,s),Hm(l,s),!1;case 1:if(a=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(ya===null||!ya.has(y))))return l.flags|=65536,m&=-m,l.lanes|=m,m=vw(m),yw(m,s,l,d),Hm(l,m),!1}l=l.return}while(l!==null);return!1}var hg=Error(i(461)),Fn=!1;function _i(s,a,l,d){a.child=s===null?xS(a,null,l,d):mo(a,s.child,l,d)}function bw(s,a,l,d,m){l=l.render;var y=a.ref;if("ref"in d){var k={};for(var P in d)P!=="ref"&&(k[P]=d[P])}else k=d;return uo(a),d=Km(s,a,l,k,y,m),P=Vm(),s!==null&&!Fn?(Ym(s,a,m),Nr(s,a,m)):(It&&P&&Am(a),a.flags|=1,_i(s,a,d,m),a.child)}function Sw(s,a,l,d,m){if(s===null){var y=l.type;return typeof y=="function"&&!km(y)&&y.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=y,ww(s,a,y,d,m)):(s=Kd(l.type,null,d,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(y=s.child,!bg(s,m)){var k=y.memoizedProps;if(l=l.compare,l=l!==null?l:Oc,l(k,d)&&s.ref===a.ref)return Nr(s,a,m)}return a.flags|=1,s=Cr(y,d),s.ref=a.ref,s.return=a,a.child=s}function ww(s,a,l,d,m){if(s!==null){var y=s.memoizedProps;if(Oc(y,d)&&s.ref===a.ref)if(Fn=!1,a.pendingProps=d=y,bg(s,m))(s.flags&131072)!==0&&(Fn=!0);else return a.lanes=s.lanes,Nr(s,a,m)}return fg(s,a,l,d,m)}function xw(s,a,l,d){var m=d.children,y=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,s!==null){for(d=a.child=s.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~y}else d=0,a.child=null;return Cw(s,a,y,l,d)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Zd(a,y!==null?y.cachePool:null),y!==null?ES(a,y):Um(),TS(a);else return d=a.lanes=536870912,Cw(s,a,y!==null?y.baseLanes|l:l,l,d)}else y!==null?(Zd(a,y.cachePool),ES(a,y),ma(),a.memoizedState=null):(s!==null&&Zd(a,null),Um(),ma());return _i(s,a,m,l),a.child}function Yc(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Cw(s,a,l,d,m){var y=Bm();return y=y===null?null:{parent:zn._currentValue,pool:y},a.memoizedState={baseLanes:l,cachePool:y},s!==null&&Zd(a,null),Um(),TS(a),s!==null&&ol(s,a,d,!0),a.childLanes=m,null}function fh(s,a){return a=mh({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function kw(s,a,l){return mo(a,s.child,null,l),s=fh(a,a.pendingProps),s.flags|=2,rs(a),a.memoizedState=null,s}function W3(s,a,l){var d=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(It){if(d.mode==="hidden")return s=fh(a,d),a.lanes=536870912,Yc(null,s);if(qm(a),(s=pn)?(s=Bx(s,xs),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:oa!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},l=lS(s),l.return=a,a.child=l,mi=a,pn=null)):s=null,s===null)throw ca(a);return a.lanes=536870912,null}return fh(a,d)}var y=s.memoizedState;if(y!==null){var k=y.dehydrated;if(qm(a),m)if(a.flags&256)a.flags&=-257,a=kw(s,a,l);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(i(558));else if(Fn||ol(s,a,l,!1),m=(l&s.childLanes)!==0,Fn||m){if(d=ln,d!==null&&(k=un(d,l),k!==0&&k!==y.retryLane))throw y.retryLane=k,ao(s,k),Yi(d,s,k),hg;Ch(),a=kw(s,a,l)}else s=y.treeContext,pn=ks(k.nextSibling),mi=a,It=!0,la=null,xs=!1,s!==null&&dS(a,s),a=fh(a,d),a.flags|=4096;return a}return s=Cr(s.child,{mode:d.mode,children:d.children}),s.ref=a.ref,a.child=s,s.return=a,s}function ph(s,a){var l=a.ref;if(l===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(s===null||s.ref!==l)&&(a.flags|=4194816)}}function fg(s,a,l,d,m){return uo(a),l=Km(s,a,l,d,void 0,m),d=Vm(),s!==null&&!Fn?(Ym(s,a,m),Nr(s,a,m)):(It&&d&&Am(a),a.flags|=1,_i(s,a,l,m),a.child)}function Ew(s,a,l,d,m,y){return uo(a),a.updateQueue=null,l=RS(a,d,l,m),AS(s),d=Vm(),s!==null&&!Fn?(Ym(s,a,y),Nr(s,a,y)):(It&&d&&Am(a),a.flags|=1,_i(s,a,l,y),a.child)}function Tw(s,a,l,d,m){if(uo(a),a.stateNode===null){var y=il,k=l.contextType;typeof k=="object"&&k!==null&&(y=gi(k)),y=new l(d,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=ug,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=d,y.state=a.memoizedState,y.refs={},$m(a),k=l.contextType,y.context=typeof k=="object"&&k!==null?gi(k):il,y.state=a.memoizedState,k=l.getDerivedStateFromProps,typeof k=="function"&&(cg(a,l,k,d),y.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(k=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),k!==y.state&&ug.enqueueReplaceState(y,y.state,null),Wc(a,d,y,m),Uc(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(s===null){y=a.stateNode;var P=a.memoizedProps,X=_o(l,P);y.props=X;var ie=y.context,pe=l.contextType;k=il,typeof pe=="object"&&pe!==null&&(k=gi(pe));var _e=l.getDerivedStateFromProps;pe=typeof _e=="function"||typeof y.getSnapshotBeforeUpdate=="function",P=a.pendingProps!==P,pe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(P||ie!==k)&&fw(a,y,d,k),da=!1;var oe=a.memoizedState;y.state=oe,Wc(a,d,y,m),Uc(),ie=a.memoizedState,P||oe!==ie||da?(typeof _e=="function"&&(cg(a,l,_e,d),ie=a.memoizedState),(X=da||hw(a,l,X,d,oe,ie,k))?(pe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ie),y.props=d,y.state=ie,y.context=k,d=X):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{y=a.stateNode,zm(s,a),k=a.memoizedProps,pe=_o(l,k),y.props=pe,_e=a.pendingProps,oe=y.context,ie=l.contextType,X=il,typeof ie=="object"&&ie!==null&&(X=gi(ie)),P=l.getDerivedStateFromProps,(ie=typeof P=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(k!==_e||oe!==X)&&fw(a,y,d,X),da=!1,oe=a.memoizedState,y.state=oe,Wc(a,d,y,m),Uc();var de=a.memoizedState;k!==_e||oe!==de||da||s!==null&&s.dependencies!==null&&Yd(s.dependencies)?(typeof P=="function"&&(cg(a,l,P,d),de=a.memoizedState),(pe=da||hw(a,l,pe,d,oe,de,X)||s!==null&&s.dependencies!==null&&Yd(s.dependencies))?(ie||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,de,X),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,de,X)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=de),y.props=d,y.state=de,y.context=X,d=pe):(typeof y.componentDidUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||k===s.memoizedProps&&oe===s.memoizedState||(a.flags|=1024),d=!1)}return y=d,ph(s,a),d=(a.flags&128)!==0,y||d?(y=a.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,s!==null&&d?(a.child=mo(a,s.child,null,m),a.child=mo(a,null,l,m)):_i(s,a,l,m),a.memoizedState=y.state,s=a.child):s=Nr(s,a,m),s}function Aw(s,a,l,d){return lo(),a.flags|=256,_i(s,a,l,d),a.child}var pg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mg(s){return{baseLanes:s,cachePool:_S()}}function gg(s,a,l){return s=s!==null?s.childLanes&~l:0,a&&(s|=os),s}function Rw(s,a,l){var d=a.pendingProps,m=!1,y=(a.flags&128)!==0,k;if((k=y)||(k=s!==null&&s.memoizedState===null?!1:(Dn.current&2)!==0),k&&(m=!0,a.flags&=-129),k=(a.flags&32)!==0,a.flags&=-33,s===null){if(It){if(m?pa(a):ma(),(s=pn)?(s=Bx(s,xs),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:oa!==null?{id:er,overflow:tr}:null,retryLane:536870912,hydrationErrors:null},l=lS(s),l.return=a,a.child=l,mi=a,pn=null)):s=null,s===null)throw ca(a);return Jg(s)?a.lanes=32:a.lanes=536870912,null}var P=d.children;return d=d.fallback,m?(ma(),m=a.mode,P=mh({mode:"hidden",children:P},m),d=oo(d,m,l,null),P.return=a,d.return=a,P.sibling=d,a.child=P,d=a.child,d.memoizedState=mg(l),d.childLanes=gg(s,k,l),a.memoizedState=pg,Yc(null,d)):(pa(a),_g(a,P))}var X=s.memoizedState;if(X!==null&&(P=X.dehydrated,P!==null)){if(y)a.flags&256?(pa(a),a.flags&=-257,a=vg(s,a,l)):a.memoizedState!==null?(ma(),a.child=s.child,a.flags|=128,a=null):(ma(),P=d.fallback,m=a.mode,d=mh({mode:"visible",children:d.children},m),P=oo(P,m,l,null),P.flags|=2,d.return=a,P.return=a,d.sibling=P,a.child=d,mo(a,s.child,null,l),d=a.child,d.memoizedState=mg(l),d.childLanes=gg(s,k,l),a.memoizedState=pg,a=Yc(null,d));else if(pa(a),Jg(P)){if(k=P.nextSibling&&P.nextSibling.dataset,k)var ie=k.dgst;k=ie,d=Error(i(419)),d.stack="",d.digest=k,Bc({value:d,source:null,stack:null}),a=vg(s,a,l)}else if(Fn||ol(s,a,l,!1),k=(l&s.childLanes)!==0,Fn||k){if(k=ln,k!==null&&(d=un(k,l),d!==0&&d!==X.retryLane))throw X.retryLane=d,ao(s,d),Yi(k,s,d),hg;Zg(P)||Ch(),a=vg(s,a,l)}else Zg(P)?(a.flags|=192,a.child=s.child,a=null):(s=X.treeContext,pn=ks(P.nextSibling),mi=a,It=!0,la=null,xs=!1,s!==null&&dS(a,s),a=_g(a,d.children),a.flags|=4096);return a}return m?(ma(),P=d.fallback,m=a.mode,X=s.child,ie=X.sibling,d=Cr(X,{mode:"hidden",children:d.children}),d.subtreeFlags=X.subtreeFlags&65011712,ie!==null?P=Cr(ie,P):(P=oo(P,m,l,null),P.flags|=2),P.return=a,d.return=a,d.sibling=P,a.child=d,Yc(null,d),d=a.child,P=s.child.memoizedState,P===null?P=mg(l):(m=P.cachePool,m!==null?(X=zn._currentValue,m=m.parent!==X?{parent:X,pool:X}:m):m=_S(),P={baseLanes:P.baseLanes|l,cachePool:m}),d.memoizedState=P,d.childLanes=gg(s,k,l),a.memoizedState=pg,Yc(s.child,d)):(pa(a),l=s.child,s=l.sibling,l=Cr(l,{mode:"visible",children:d.children}),l.return=a,l.sibling=null,s!==null&&(k=a.deletions,k===null?(a.deletions=[s],a.flags|=16):k.push(s)),a.child=l,a.memoizedState=null,l)}function _g(s,a){return a=mh({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function mh(s,a){return s=is(22,s,null,a),s.lanes=0,s}function vg(s,a,l){return mo(a,s.child,null,l),s=_g(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Nw(s,a,l){s.lanes|=a;var d=s.alternate;d!==null&&(d.lanes|=a),jm(s.return,a,l)}function yg(s,a,l,d,m,y){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:m,treeForkCount:y}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=d,k.tail=l,k.tailMode=m,k.treeForkCount=y)}function Lw(s,a,l){var d=a.pendingProps,m=d.revealOrder,y=d.tail;d=d.children;var k=Dn.current,P=(k&2)!==0;if(P?(k=k&1|2,a.flags|=128):k&=1,Y(Dn,k),_i(s,a,d,l),d=It?Ic:0,!P&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Nw(s,l,a);else if(s.tag===19)Nw(s,l,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(l=a.child,m=null;l!==null;)s=l.alternate,s!==null&&ih(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=a.child,a.child=null):(m=l.sibling,l.sibling=null),yg(a,!1,m,l,y,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=a.child,a.child=null;m!==null;){if(s=m.alternate,s!==null&&ih(s)===null){a.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}yg(a,!0,l,null,y,d);break;case"together":yg(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Nr(s,a,l){if(s!==null&&(a.dependencies=s.dependencies),va|=a.lanes,(l&a.childLanes)===0)if(s!==null){if(ol(s,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(i(153));if(a.child!==null){for(s=a.child,l=Cr(s,s.pendingProps),a.child=l,l.return=a;s.sibling!==null;)s=s.sibling,l=l.sibling=Cr(s,s.pendingProps),l.return=a;l.sibling=null}return a.child}function bg(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Yd(s)))}function q3(s,a,l){switch(a.tag){case 3:Re(a,a.stateNode.containerInfo),ua(a,zn,s.memoizedState.cache),lo();break;case 27:case 5:Ue(a);break;case 4:Re(a,a.stateNode.containerInfo);break;case 10:ua(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,qm(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(pa(a),a.flags|=128,null):(l&a.child.childLanes)!==0?Rw(s,a,l):(pa(a),s=Nr(s,a,l),s!==null?s.sibling:null);pa(a);break;case 19:var m=(s.flags&128)!==0;if(d=(l&a.childLanes)!==0,d||(ol(s,a,l,!1),d=(l&a.childLanes)!==0),m){if(d)return Lw(s,a,l);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Y(Dn,Dn.current),d)break;return null;case 22:return a.lanes=0,xw(s,a,l,a.pendingProps);case 24:ua(a,zn,s.memoizedState.cache)}return Nr(s,a,l)}function Mw(s,a,l){if(s!==null)if(s.memoizedProps!==a.pendingProps)Fn=!0;else{if(!bg(s,l)&&(a.flags&128)===0)return Fn=!1,q3(s,a,l);Fn=(s.flags&131072)!==0}else Fn=!1,It&&(a.flags&1048576)!==0&&uS(a,Ic,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(s=fo(a.elementType),a.type=s,typeof s=="function")km(s)?(d=_o(s,d),a.tag=1,a=Tw(null,a,s,d,l)):(a.tag=0,a=fg(null,a,s,d,l));else{if(s!=null){var m=s.$$typeof;if(m===A){a.tag=11,a=bw(null,a,s,d,l);break e}else if(m===$){a.tag=14,a=Sw(null,a,s,d,l);break e}}throw a=D(s)||s,Error(i(306,a,""))}}return a;case 0:return fg(s,a,a.type,a.pendingProps,l);case 1:return d=a.type,m=_o(d,a.pendingProps),Tw(s,a,d,m,l);case 3:e:{if(Re(a,a.stateNode.containerInfo),s===null)throw Error(i(387));d=a.pendingProps;var y=a.memoizedState;m=y.element,zm(s,a),Wc(a,d,null,l);var k=a.memoizedState;if(d=k.cache,ua(a,zn,d),d!==y.cache&&Om(a,[zn],l,!0),Uc(),d=k.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:k.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Aw(s,a,d,l);break e}else if(d!==m){m=bs(Error(i(424)),a),Bc(m),a=Aw(s,a,d,l);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,pn=ks(s.firstChild),mi=a,It=!0,la=null,xs=!0,l=xS(a,null,d,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(lo(),d===m){a=Nr(s,a,l);break e}_i(s,a,d,l)}a=a.child}return a;case 26:return ph(s,a),s===null?(l=Ux(a.type,null,a.pendingProps,null))?a.memoizedState=l:It||(l=a.type,s=a.pendingProps,d=Lh(ae.current).createElement(l),d[on]=a,d[Gt]=s,vi(d,l,s),ft(d),a.stateNode=d):a.memoizedState=Ux(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return Ue(a),s===null&&It&&(d=a.stateNode=zx(a.type,a.pendingProps,ae.current),mi=a,xs=!0,m=pn,xa(a.type)?(Qg=m,pn=ks(d.firstChild)):pn=m),_i(s,a,a.pendingProps.children,l),ph(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&It&&((m=d=pn)&&(d=S6(d,a.type,a.pendingProps,xs),d!==null?(a.stateNode=d,mi=a,pn=ks(d.firstChild),xs=!1,m=!0):m=!1),m||ca(a)),Ue(a),m=a.type,y=a.pendingProps,k=s!==null?s.memoizedProps:null,d=y.children,Vg(m,y)?d=null:k!==null&&Vg(m,k)&&(a.flags|=32),a.memoizedState!==null&&(m=Km(s,a,I3,null,null,l),uu._currentValue=m),ph(s,a),_i(s,a,d,l),a.child;case 6:return s===null&&It&&((s=l=pn)&&(l=w6(l,a.pendingProps,xs),l!==null?(a.stateNode=l,mi=a,pn=null,s=!0):s=!1),s||ca(a)),null;case 13:return Rw(s,a,l);case 4:return Re(a,a.stateNode.containerInfo),d=a.pendingProps,s===null?a.child=mo(a,null,d,l):_i(s,a,d,l),a.child;case 11:return bw(s,a,a.type,a.pendingProps,l);case 7:return _i(s,a,a.pendingProps,l),a.child;case 8:return _i(s,a,a.pendingProps.children,l),a.child;case 12:return _i(s,a,a.pendingProps.children,l),a.child;case 10:return d=a.pendingProps,ua(a,a.type,d.value),_i(s,a,d.children,l),a.child;case 9:return m=a.type._context,d=a.pendingProps.children,uo(a),m=gi(m),d=d(m),a.flags|=1,_i(s,a,d,l),a.child;case 14:return Sw(s,a,a.type,a.pendingProps,l);case 15:return ww(s,a,a.type,a.pendingProps,l);case 19:return Lw(s,a,l);case 31:return W3(s,a,l);case 22:return xw(s,a,l,a.pendingProps);case 24:return uo(a),d=gi(zn),s===null?(m=Bm(),m===null&&(m=ln,y=Dm(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=l),m=y),a.memoizedState={parent:d,cache:m},$m(a),ua(a,zn,m)):((s.lanes&l)!==0&&(zm(s,a),Wc(a,null,null,l),Uc()),m=s.memoizedState,y=a.memoizedState,m.parent!==d?(m={parent:d,cache:d},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),ua(a,zn,d)):(d=y.cache,ua(a,zn,d),d!==m.cache&&Om(a,[zn],l,!0))),_i(s,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function Lr(s){s.flags|=4}function Sg(s,a,l,d,m){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(rx())s.flags|=8192;else throw po=Qd,Pm}else s.flags&=-16777217}function jw(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Vx(a))if(rx())s.flags|=8192;else throw po=Qd,Pm}function gh(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?Ze():536870912,s.lanes|=a,yl|=a)}function Xc(s,a){if(!It)switch(s.tailMode){case"hidden":a=s.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function mn(s){var a=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(a)for(var m=s.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)l|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=d,s.childLanes=l,a}function G3(s,a,l){var d=a.pendingProps;switch(Rm(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mn(a),null;case 1:return mn(a),null;case 3:return l=a.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Tr(zn),De(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(al(a)?Lr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Lm())),mn(a),null;case 26:var m=a.type,y=a.memoizedState;return s===null?(Lr(a),y!==null?(mn(a),jw(a,y)):(mn(a),Sg(a,m,null,d,l))):y?y!==s.memoizedState?(Lr(a),mn(a),jw(a,y)):(mn(a),a.flags&=-16777217):(s=s.memoizedProps,s!==d&&Lr(a),mn(a),Sg(a,m,s,d,l)),null;case 27:if(Oe(a),l=ae.current,m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==d&&Lr(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return mn(a),null}s=re.current,al(a)?hS(a):(s=zx(m,d,l),a.stateNode=s,Lr(a))}return mn(a),null;case 5:if(Oe(a),m=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==d&&Lr(a);else{if(!d){if(a.stateNode===null)throw Error(i(166));return mn(a),null}if(y=re.current,al(a))hS(a);else{var k=Lh(ae.current);switch(y){case 1:y=k.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=k.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=k.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=k.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=k.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?k.createElement("select",{is:d.is}):k.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?k.createElement(m,{is:d.is}):k.createElement(m)}}y[on]=a,y[Gt]=d;e:for(k=a.child;k!==null;){if(k.tag===5||k.tag===6)y.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===a)break e;for(;k.sibling===null;){if(k.return===null||k.return===a)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}a.stateNode=y;e:switch(vi(y,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Lr(a)}}return mn(a),Sg(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,l),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==d&&Lr(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(i(166));if(s=ae.current,al(a)){if(s=a.stateNode,l=a.memoizedProps,d=null,m=mi,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}s[on]=a,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||Rx(s.nodeValue,l)),s||ca(a,!0)}else s=Lh(s).createTextNode(d),s[on]=a,a.stateNode=s}return mn(a),null;case 31:if(l=a.memoizedState,s===null||s.memoizedState!==null){if(d=al(a),l!==null){if(s===null){if(!d)throw Error(i(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[on]=a}else lo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;mn(a),s=!1}else l=Lm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return a.flags&256?(rs(a),a):(rs(a),null);if((a.flags&128)!==0)throw Error(i(558))}return mn(a),null;case 13:if(d=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=al(a),d!==null&&d.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[on]=a}else lo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;mn(a),m=!1}else m=Lm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(rs(a),a):(rs(a),null)}return rs(a),(a.flags&128)!==0?(a.lanes=l,a):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=a.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==m&&(d.flags|=2048)),l!==s&&l&&(a.child.flags|=8192),gh(a,a.updateQueue),mn(a),null);case 4:return De(),s===null&&Ug(a.stateNode.containerInfo),mn(a),null;case 10:return Tr(a.type),mn(a),null;case 19:if(G(Dn),d=a.memoizedState,d===null)return mn(a),null;if(m=(a.flags&128)!==0,y=d.rendering,y===null)if(m)Xc(d,!1);else{if(An!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(y=ih(s),y!==null){for(a.flags|=128,Xc(d,!1),s=y.updateQueue,a.updateQueue=s,gh(a,s),a.subtreeFlags=0,s=l,l=a.child;l!==null;)oS(l,s),l=l.sibling;return Y(Dn,Dn.current&1|2),It&&kr(a,d.treeForkCount),a.child}s=s.sibling}d.tail!==null&&wt()>Sh&&(a.flags|=128,m=!0,Xc(d,!1),a.lanes=4194304)}else{if(!m)if(s=ih(y),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,gh(a,s),Xc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!It)return mn(a),null}else 2*wt()-d.renderingStartTime>Sh&&l!==536870912&&(a.flags|=128,m=!0,Xc(d,!1),a.lanes=4194304);d.isBackwards?(y.sibling=a.child,a.child=y):(s=d.last,s!==null?s.sibling=y:a.child=y,d.last=y)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=wt(),s.sibling=null,l=Dn.current,Y(Dn,m?l&1|2:l&1),It&&kr(a,d.treeForkCount),s):(mn(a),null);case 22:case 23:return rs(a),Wm(),d=a.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(l&536870912)!==0&&(a.flags&128)===0&&(mn(a),a.subtreeFlags&6&&(a.flags|=8192)):mn(a),l=a.updateQueue,l!==null&&gh(a,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==l&&(a.flags|=2048),s!==null&&G(ho),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Tr(zn),mn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function K3(s,a){switch(Rm(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return Tr(zn),De(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return Oe(a),null;case 31:if(a.memoizedState!==null){if(rs(a),a.alternate===null)throw Error(i(340));lo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(rs(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(i(340));lo()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return G(Dn),null;case 4:return De(),null;case 10:return Tr(a.type),null;case 22:case 23:return rs(a),Wm(),s!==null&&G(ho),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return Tr(zn),null;case 25:return null;default:return null}}function Ow(s,a){switch(Rm(a),a.tag){case 3:Tr(zn),De();break;case 26:case 27:case 5:Oe(a);break;case 4:De();break;case 31:a.memoizedState!==null&&rs(a);break;case 13:rs(a);break;case 19:G(Dn);break;case 10:Tr(a.type);break;case 22:case 23:rs(a),Wm(),s!==null&&G(ho);break;case 24:Tr(zn)}}function Zc(s,a){try{var l=a.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var m=d.next;l=m;do{if((l.tag&s)===s){d=void 0;var y=l.create,k=l.inst;d=y(),k.destroy=d}l=l.next}while(l!==m)}}catch(P){Xt(a,a.return,P)}}function ga(s,a,l){try{var d=a.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var y=m.next;d=y;do{if((d.tag&s)===s){var k=d.inst,P=k.destroy;if(P!==void 0){k.destroy=void 0,m=a;var X=l,ie=P;try{ie()}catch(pe){Xt(m,X,pe)}}}d=d.next}while(d!==y)}}catch(pe){Xt(a,a.return,pe)}}function Dw(s){var a=s.updateQueue;if(a!==null){var l=s.stateNode;try{kS(a,l)}catch(d){Xt(s,s.return,d)}}}function Iw(s,a,l){l.props=_o(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){Xt(s,a,d)}}function Jc(s,a){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(m){Xt(s,a,m)}}function nr(s,a){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(m){Xt(s,a,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){Xt(s,a,m)}else l.current=null}function Bw(s){var a=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(m){Xt(s,s.return,m)}}function wg(s,a,l){try{var d=s.stateNode;m6(d,s.type,l,a),d[Gt]=a}catch(m){Xt(s,s.return,m)}}function Pw(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xa(s.type)||s.tag===4}function xg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Pw(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xa(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Cg(s,a,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(s),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Ae));else if(d!==4&&(d===27&&xa(s.type)&&(l=s.stateNode,a=null),s=s.child,s!==null))for(Cg(s,a,l),s=s.sibling;s!==null;)Cg(s,a,l),s=s.sibling}function _h(s,a,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,a?l.insertBefore(s,a):l.appendChild(s);else if(d!==4&&(d===27&&xa(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(_h(s,a,l),s=s.sibling;s!==null;)_h(s,a,l),s=s.sibling}function $w(s){var a=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,m=a.attributes;m.length;)a.removeAttributeNode(m[0]);vi(a,d,l),a[on]=s,a[Gt]=l}catch(y){Xt(s,s.return,y)}}var Mr=!1,Un=!1,kg=!1,zw=typeof WeakSet=="function"?WeakSet:Set,ni=null;function V3(s,a){if(s=s.containerInfo,Gg=Ph,s=J1(s),vm(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var m=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var k=0,P=-1,X=-1,ie=0,pe=0,_e=s,oe=null;t:for(;;){for(var de;_e!==l||m!==0&&_e.nodeType!==3||(P=k+m),_e!==y||d!==0&&_e.nodeType!==3||(X=k+d),_e.nodeType===3&&(k+=_e.nodeValue.length),(de=_e.firstChild)!==null;)oe=_e,_e=de;for(;;){if(_e===s)break t;if(oe===l&&++ie===m&&(P=k),oe===y&&++pe===d&&(X=k),(de=_e.nextSibling)!==null)break;_e=oe,oe=_e.parentNode}_e=de}l=P===-1||X===-1?null:{start:P,end:X}}else l=null}l=l||{start:0,end:0}}else l=null;for(Kg={focusedElem:s,selectionRange:l},Ph=!1,ni=a;ni!==null;)if(a=ni,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,ni=s;else for(;ni!==null;){switch(a=ni,y=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)m=s[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&y!==null){s=void 0,l=a,m=y.memoizedProps,y=y.memoizedState,d=l.stateNode;try{var Fe=_o(l.type,m);s=d.getSnapshotBeforeUpdate(Fe,y),d.__reactInternalSnapshotBeforeUpdate=s}catch(st){Xt(l,l.return,st)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,l=s.nodeType,l===9)Xg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Xg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=a.sibling,s!==null){s.return=a.return,ni=s;break}ni=a.return}}function Hw(s,a,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Or(s,l),d&4&&Zc(5,l);break;case 1:if(Or(s,l),d&4)if(s=l.stateNode,a===null)try{s.componentDidMount()}catch(k){Xt(l,l.return,k)}else{var m=_o(l.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(k){Xt(l,l.return,k)}}d&64&&Dw(l),d&512&&Jc(l,l.return);break;case 3:if(Or(s,l),d&64&&(s=l.updateQueue,s!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{kS(s,a)}catch(k){Xt(l,l.return,k)}}break;case 27:a===null&&d&4&&$w(l);case 26:case 5:Or(s,l),a===null&&d&4&&Bw(l),d&512&&Jc(l,l.return);break;case 12:Or(s,l);break;case 31:Or(s,l),d&4&&Ww(s,l);break;case 13:Or(s,l),d&4&&qw(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=i6.bind(null,l),x6(s,l))));break;case 22:if(d=l.memoizedState!==null||Mr,!d){a=a!==null&&a.memoizedState!==null||Un,m=Mr;var y=Un;Mr=d,(Un=a)&&!y?Dr(s,l,(l.subtreeFlags&8772)!==0):Or(s,l),Mr=m,Un=y}break;case 30:break;default:Or(s,l)}}function Fw(s){var a=s.alternate;a!==null&&(s.alternate=null,Fw(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&Ce(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var bn=null,qi=!1;function jr(s,a,l){for(l=l.child;l!==null;)Uw(s,a,l),l=l.sibling}function Uw(s,a,l){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(ht,l)}catch{}switch(l.tag){case 26:Un||nr(l,a),jr(s,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Un||nr(l,a);var d=bn,m=qi;xa(l.type)&&(bn=l.stateNode,qi=!1),jr(s,a,l),ou(l.stateNode),bn=d,qi=m;break;case 5:Un||nr(l,a);case 6:if(d=bn,m=qi,bn=null,jr(s,a,l),bn=d,qi=m,bn!==null)if(qi)try{(bn.nodeType===9?bn.body:bn.nodeName==="HTML"?bn.ownerDocument.body:bn).removeChild(l.stateNode)}catch(y){Xt(l,a,y)}else try{bn.removeChild(l.stateNode)}catch(y){Xt(l,a,y)}break;case 18:bn!==null&&(qi?(s=bn,Dx(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Tl(s)):Dx(bn,l.stateNode));break;case 4:d=bn,m=qi,bn=l.stateNode.containerInfo,qi=!0,jr(s,a,l),bn=d,qi=m;break;case 0:case 11:case 14:case 15:ga(2,l,a),Un||ga(4,l,a),jr(s,a,l);break;case 1:Un||(nr(l,a),d=l.stateNode,typeof d.componentWillUnmount=="function"&&Iw(l,a,d)),jr(s,a,l);break;case 21:jr(s,a,l);break;case 22:Un=(d=Un)||l.memoizedState!==null,jr(s,a,l),Un=d;break;default:jr(s,a,l)}}function Ww(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Tl(s)}catch(l){Xt(a,a.return,l)}}}function qw(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Tl(s)}catch(l){Xt(a,a.return,l)}}function Y3(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new zw),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new zw),a;default:throw Error(i(435,s.tag))}}function vh(s,a){var l=Y3(s);a.forEach(function(d){if(!l.has(d)){l.add(d);var m=s6.bind(null,s,d);d.then(m,m)}})}function Gi(s,a){var l=a.deletions;if(l!==null)for(var d=0;d<l.length;d++){var m=l[d],y=s,k=a,P=k;e:for(;P!==null;){switch(P.tag){case 27:if(xa(P.type)){bn=P.stateNode,qi=!1;break e}break;case 5:bn=P.stateNode,qi=!1;break e;case 3:case 4:bn=P.stateNode.containerInfo,qi=!0;break e}P=P.return}if(bn===null)throw Error(i(160));Uw(y,k,m),bn=null,qi=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Gw(a,s),a=a.sibling}var Fs=null;function Gw(s,a){var l=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Gi(a,s),Ki(s),d&4&&(ga(3,s,s.return),Zc(3,s),ga(5,s,s.return));break;case 1:Gi(a,s),Ki(s),d&512&&(Un||l===null||nr(l,l.return)),d&64&&Mr&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var m=Fs;if(Gi(a,s),Ki(s),d&512&&(Un||l===null||nr(l,l.return)),d&4){var y=l!==null?l.memoizedState:null;if(d=s.memoizedState,l===null)if(d===null)if(s.stateNode===null){e:{d=s.type,l=s.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":y=m.getElementsByTagName("title")[0],(!y||y[Jt]||y[on]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(d),m.head.insertBefore(y,m.querySelector("head > title"))),vi(y,d,l),y[on]=s,ft(y),d=y;break e;case"link":var k=Gx("link","href",m).get(d+(l.href||""));if(k){for(var P=0;P<k.length;P++)if(y=k[P],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){k.splice(P,1);break t}}y=m.createElement(d),vi(y,d,l),m.head.appendChild(y);break;case"meta":if(k=Gx("meta","content",m).get(d+(l.content||""))){for(P=0;P<k.length;P++)if(y=k[P],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){k.splice(P,1);break t}}y=m.createElement(d),vi(y,d,l),m.head.appendChild(y);break;default:throw Error(i(468,d))}y[on]=s,ft(y),d=y}s.stateNode=d}else Kx(m,s.type,s.stateNode);else s.stateNode=qx(m,d,s.memoizedProps);else y!==d?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,d===null?Kx(m,s.type,s.stateNode):qx(m,d,s.memoizedProps)):d===null&&s.stateNode!==null&&wg(s,s.memoizedProps,l.memoizedProps)}break;case 27:Gi(a,s),Ki(s),d&512&&(Un||l===null||nr(l,l.return)),l!==null&&d&4&&wg(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Gi(a,s),Ki(s),d&512&&(Un||l===null||nr(l,l.return)),s.flags&32){m=s.stateNode;try{at(m,"")}catch(Fe){Xt(s,s.return,Fe)}}d&4&&s.stateNode!=null&&(m=s.memoizedProps,wg(s,m,l!==null?l.memoizedProps:m)),d&1024&&(kg=!0);break;case 6:if(Gi(a,s),Ki(s),d&4){if(s.stateNode===null)throw Error(i(162));d=s.memoizedProps,l=s.stateNode;try{l.nodeValue=d}catch(Fe){Xt(s,s.return,Fe)}}break;case 3:if(Oh=null,m=Fs,Fs=Mh(a.containerInfo),Gi(a,s),Fs=m,Ki(s),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Tl(a.containerInfo)}catch(Fe){Xt(s,s.return,Fe)}kg&&(kg=!1,Kw(s));break;case 4:d=Fs,Fs=Mh(s.stateNode.containerInfo),Gi(a,s),Ki(s),Fs=d;break;case 12:Gi(a,s),Ki(s);break;case 31:Gi(a,s),Ki(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,vh(s,d)));break;case 13:Gi(a,s),Ki(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(bh=wt()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,vh(s,d)));break;case 22:m=s.memoizedState!==null;var X=l!==null&&l.memoizedState!==null,ie=Mr,pe=Un;if(Mr=ie||m,Un=pe||X,Gi(a,s),Un=pe,Mr=ie,Ki(s),d&8192)e:for(a=s.stateNode,a._visibility=m?a._visibility&-2:a._visibility|1,m&&(l===null||X||Mr||Un||vo(s)),l=null,a=s;;){if(a.tag===5||a.tag===26){if(l===null){X=l=a;try{if(y=X.stateNode,m)k=y.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{P=X.stateNode;var _e=X.memoizedProps.style,oe=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;P.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Fe){Xt(X,X.return,Fe)}}}else if(a.tag===6){if(l===null){X=a;try{X.stateNode.nodeValue=m?"":X.memoizedProps}catch(Fe){Xt(X,X.return,Fe)}}}else if(a.tag===18){if(l===null){X=a;try{var de=X.stateNode;m?Ix(de,!0):Ix(X.stateNode,!1)}catch(Fe){Xt(X,X.return,Fe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=s.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,vh(s,l))));break;case 19:Gi(a,s),Ki(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,vh(s,d)));break;case 30:break;case 21:break;default:Gi(a,s),Ki(s)}}function Ki(s){var a=s.flags;if(a&2){try{for(var l,d=s.return;d!==null;){if(Pw(d)){l=d;break}d=d.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var m=l.stateNode,y=xg(s);_h(s,y,m);break;case 5:var k=l.stateNode;l.flags&32&&(at(k,""),l.flags&=-33);var P=xg(s);_h(s,P,k);break;case 3:case 4:var X=l.stateNode.containerInfo,ie=xg(s);Cg(s,ie,X);break;default:throw Error(i(161))}}catch(pe){Xt(s,s.return,pe)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function Kw(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;Kw(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Or(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Hw(s,a.alternate,a),a=a.sibling}function vo(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ga(4,a,a.return),vo(a);break;case 1:nr(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&Iw(a,a.return,l),vo(a);break;case 27:ou(a.stateNode);case 26:case 5:nr(a,a.return),vo(a);break;case 22:a.memoizedState===null&&vo(a);break;case 30:vo(a);break;default:vo(a)}s=s.sibling}}function Dr(s,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,m=s,y=a,k=y.flags;switch(y.tag){case 0:case 11:case 15:Dr(m,y,l),Zc(4,y);break;case 1:if(Dr(m,y,l),d=y,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ie){Xt(d,d.return,ie)}if(d=y,m=d.updateQueue,m!==null){var P=d.stateNode;try{var X=m.shared.hiddenCallbacks;if(X!==null)for(m.shared.hiddenCallbacks=null,m=0;m<X.length;m++)CS(X[m],P)}catch(ie){Xt(d,d.return,ie)}}l&&k&64&&Dw(y),Jc(y,y.return);break;case 27:$w(y);case 26:case 5:Dr(m,y,l),l&&d===null&&k&4&&Bw(y),Jc(y,y.return);break;case 12:Dr(m,y,l);break;case 31:Dr(m,y,l),l&&k&4&&Ww(m,y);break;case 13:Dr(m,y,l),l&&k&4&&qw(m,y);break;case 22:y.memoizedState===null&&Dr(m,y,l),Jc(y,y.return);break;case 30:break;default:Dr(m,y,l)}a=a.sibling}}function Eg(s,a){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Pc(l))}function Tg(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Pc(s))}function Us(s,a,l,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Vw(s,a,l,d),a=a.sibling}function Vw(s,a,l,d){var m=a.flags;switch(a.tag){case 0:case 11:case 15:Us(s,a,l,d),m&2048&&Zc(9,a);break;case 1:Us(s,a,l,d);break;case 3:Us(s,a,l,d),m&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&Pc(s)));break;case 12:if(m&2048){Us(s,a,l,d),s=a.stateNode;try{var y=a.memoizedProps,k=y.id,P=y.onPostCommit;typeof P=="function"&&P(k,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(X){Xt(a,a.return,X)}}else Us(s,a,l,d);break;case 31:Us(s,a,l,d);break;case 13:Us(s,a,l,d);break;case 23:break;case 22:y=a.stateNode,k=a.alternate,a.memoizedState!==null?y._visibility&2?Us(s,a,l,d):Qc(s,a):y._visibility&2?Us(s,a,l,d):(y._visibility|=2,gl(s,a,l,d,(a.subtreeFlags&10256)!==0||!1)),m&2048&&Eg(k,a);break;case 24:Us(s,a,l,d),m&2048&&Tg(a.alternate,a);break;default:Us(s,a,l,d)}}function gl(s,a,l,d,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=s,k=a,P=l,X=d,ie=k.flags;switch(k.tag){case 0:case 11:case 15:gl(y,k,P,X,m),Zc(8,k);break;case 23:break;case 22:var pe=k.stateNode;k.memoizedState!==null?pe._visibility&2?gl(y,k,P,X,m):Qc(y,k):(pe._visibility|=2,gl(y,k,P,X,m)),m&&ie&2048&&Eg(k.alternate,k);break;case 24:gl(y,k,P,X,m),m&&ie&2048&&Tg(k.alternate,k);break;default:gl(y,k,P,X,m)}a=a.sibling}}function Qc(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=s,d=a,m=d.flags;switch(d.tag){case 22:Qc(l,d),m&2048&&Eg(d.alternate,d);break;case 24:Qc(l,d),m&2048&&Tg(d.alternate,d);break;default:Qc(l,d)}a=a.sibling}}var eu=8192;function _l(s,a,l){if(s.subtreeFlags&eu)for(s=s.child;s!==null;)Yw(s,a,l),s=s.sibling}function Yw(s,a,l){switch(s.tag){case 26:_l(s,a,l),s.flags&eu&&s.memoizedState!==null&&D6(l,Fs,s.memoizedState,s.memoizedProps);break;case 5:_l(s,a,l);break;case 3:case 4:var d=Fs;Fs=Mh(s.stateNode.containerInfo),_l(s,a,l),Fs=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=eu,eu=16777216,_l(s,a,l),eu=d):_l(s,a,l));break;default:_l(s,a,l)}}function Xw(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function tu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var d=a[l];ni=d,Jw(d,s)}Xw(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Zw(s),s=s.sibling}function Zw(s){switch(s.tag){case 0:case 11:case 15:tu(s),s.flags&2048&&ga(9,s,s.return);break;case 3:tu(s);break;case 12:tu(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,yh(s)):tu(s);break;default:tu(s)}}function yh(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var d=a[l];ni=d,Jw(d,s)}Xw(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ga(8,a,a.return),yh(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,yh(a));break;default:yh(a)}s=s.sibling}}function Jw(s,a){for(;ni!==null;){var l=ni;switch(l.tag){case 0:case 11:case 15:ga(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Pc(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,ni=d;else e:for(l=s;ni!==null;){d=ni;var m=d.sibling,y=d.return;if(Fw(d),d===l){ni=null;break e}if(m!==null){m.return=y,ni=m;break e}ni=y}}}var X3={getCacheForType:function(s){var a=gi(zn),l=a.data.get(s);return l===void 0&&(l=s(),a.data.set(s,l)),l},cacheSignal:function(){return gi(zn).controller.signal}},Z3=typeof WeakMap=="function"?WeakMap:Map,qt=0,ln=null,Rt=null,jt=0,Yt=0,as=null,_a=!1,vl=!1,Ag=!1,Ir=0,An=0,va=0,yo=0,Rg=0,os=0,yl=0,nu=null,Vi=null,Ng=!1,bh=0,Qw=0,Sh=1/0,wh=null,ya=null,Xn=0,ba=null,bl=null,Br=0,Lg=0,Mg=null,ex=null,iu=0,jg=null;function ls(){return(qt&2)!==0&&jt!==0?jt&-jt:T.T!==null?$g():_s()}function tx(){if(os===0)if((jt&536870912)===0||It){var s=Ne;Ne<<=1,(Ne&3932160)===0&&(Ne=262144),os=s}else os=536870912;return s=ss.current,s!==null&&(s.flags|=32),os}function Yi(s,a,l){(s===ln&&(Yt===2||Yt===9)||s.cancelPendingCommit!==null)&&(Sl(s,0),Sa(s,jt,os,!1)),gt(s,l),((qt&2)===0||s!==ln)&&(s===ln&&((qt&2)===0&&(yo|=l),An===4&&Sa(s,jt,os,!1)),ir(s))}function nx(s,a,l){if((qt&6)!==0)throw Error(i(327));var d=!l&&(a&127)===0&&(a&s.expiredLanes)===0||ue(s,a),m=d?e6(s,a):Dg(s,a,!0),y=d;do{if(m===0){vl&&!d&&Sa(s,a,0,!1);break}else{if(l=s.current.alternate,y&&!J3(l)){m=Dg(s,a,!1),y=!1;continue}if(m===2){if(y=a,s.errorRecoveryDisabledLanes&y)var k=0;else k=s.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){a=k;e:{var P=s;m=nu;var X=P.current.memoizedState.isDehydrated;if(X&&(Sl(P,k).flags|=256),k=Dg(P,k,!1),k!==2){if(Ag&&!X){P.errorRecoveryDisabledLanes|=y,yo|=y,m=4;break e}y=Vi,Vi=m,y!==null&&(Vi===null?Vi=y:Vi.push.apply(Vi,y))}m=k}if(y=!1,m!==2)continue}}if(m===1){Sl(s,0),Sa(s,a,0,!0);break}e:{switch(d=s,y=m,y){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Sa(d,a,os,!_a);break e;case 2:Vi=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(m=bh+300-wt(),10<m)){if(Sa(d,a,os,!_a),V(d,0,!0)!==0)break e;Br=a,d.timeoutHandle=jx(ix.bind(null,d,l,Vi,wh,Ng,a,os,yo,yl,_a,y,"Throttled",-0,0),m);break e}ix(d,l,Vi,wh,Ng,a,os,yo,yl,_a,y,null,-0,0)}}break}while(!0);ir(s)}function ix(s,a,l,d,m,y,k,P,X,ie,pe,_e,oe,de){if(s.timeoutHandle=-1,_e=a.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ae},Yw(a,y,_e);var Fe=(y&62914560)===y?bh-wt():(y&4194048)===y?Qw-wt():0;if(Fe=I6(_e,Fe),Fe!==null){Br=y,s.cancelPendingCommit=Fe(dx.bind(null,s,a,y,l,d,m,k,P,X,pe,_e,null,oe,de)),Sa(s,y,k,!ie);return}}dx(s,a,y,l,d,m,k,P,X)}function J3(s){for(var a=s;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var m=l[d],y=m.getSnapshot;m=m.value;try{if(!ns(y(),m))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Sa(s,a,l,d){a&=~Rg,a&=~yo,s.suspendedLanes|=a,s.pingedLanes&=~a,d&&(s.warmLanes|=a),d=s.expirationTimes;for(var m=a;0<m;){var y=31-Bt(m),k=1<<y;d[y]=-1,m&=~k}l!==0&&Me(s,l,a)}function xh(){return(qt&6)===0?(su(0),!1):!0}function Og(){if(Rt!==null){if(Yt===0)var s=Rt.return;else s=Rt,Er=co=null,Xm(s),dl=null,zc=0,s=Rt;for(;s!==null;)Ow(s.alternate,s),s=s.return;Rt=null}}function Sl(s,a){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,v6(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Br=0,Og(),ln=s,Rt=l=Cr(s.current,null),jt=a,Yt=0,as=null,_a=!1,vl=ue(s,a),Ag=!1,yl=os=Rg=yo=va=An=0,Vi=nu=null,Ng=!1,(a&8)!==0&&(a|=a&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=a;0<d;){var m=31-Bt(d),y=1<<m;a|=s[m],d&=~y}return Ir=a,Wd(),l}function sx(s,a){yt=null,T.H=Vc,a===ul||a===Jd?(a=bS(),Yt=3):a===Pm?(a=bS(),Yt=4):Yt=a===hg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,as=a,Rt===null&&(An=1,hh(s,bs(a,s.current)))}function rx(){var s=ss.current;return s===null?!0:(jt&4194048)===jt?Cs===null:(jt&62914560)===jt||(jt&536870912)!==0?s===Cs:!1}function ax(){var s=T.H;return T.H=Vc,s===null?Vc:s}function ox(){var s=T.A;return T.A=X3,s}function Ch(){An=4,_a||(jt&4194048)!==jt&&ss.current!==null||(vl=!0),(va&134217727)===0&&(yo&134217727)===0||ln===null||Sa(ln,jt,os,!1)}function Dg(s,a,l){var d=qt;qt|=2;var m=ax(),y=ox();(ln!==s||jt!==a)&&(wh=null,Sl(s,a)),a=!1;var k=An;e:do try{if(Yt!==0&&Rt!==null){var P=Rt,X=as;switch(Yt){case 8:Og(),k=6;break e;case 3:case 2:case 9:case 6:ss.current===null&&(a=!0);var ie=Yt;if(Yt=0,as=null,wl(s,P,X,ie),l&&vl){k=0;break e}break;default:ie=Yt,Yt=0,as=null,wl(s,P,X,ie)}}Q3(),k=An;break}catch(pe){sx(s,pe)}while(!0);return a&&s.shellSuspendCounter++,Er=co=null,qt=d,T.H=m,T.A=y,Rt===null&&(ln=null,jt=0,Wd()),k}function Q3(){for(;Rt!==null;)lx(Rt)}function e6(s,a){var l=qt;qt|=2;var d=ax(),m=ox();ln!==s||jt!==a?(wh=null,Sh=wt()+500,Sl(s,a)):vl=ue(s,a);e:do try{if(Yt!==0&&Rt!==null){a=Rt;var y=as;t:switch(Yt){case 1:Yt=0,as=null,wl(s,a,y,1);break;case 2:case 9:if(vS(y)){Yt=0,as=null,cx(a);break}a=function(){Yt!==2&&Yt!==9||ln!==s||(Yt=7),ir(s)},y.then(a,a);break e;case 3:Yt=7;break e;case 4:Yt=5;break e;case 7:vS(y)?(Yt=0,as=null,cx(a)):(Yt=0,as=null,wl(s,a,y,7));break;case 5:var k=null;switch(Rt.tag){case 26:k=Rt.memoizedState;case 5:case 27:var P=Rt;if(k?Vx(k):P.stateNode.complete){Yt=0,as=null;var X=P.sibling;if(X!==null)Rt=X;else{var ie=P.return;ie!==null?(Rt=ie,kh(ie)):Rt=null}break t}}Yt=0,as=null,wl(s,a,y,5);break;case 6:Yt=0,as=null,wl(s,a,y,6);break;case 8:Og(),An=6;break e;default:throw Error(i(462))}}t6();break}catch(pe){sx(s,pe)}while(!0);return Er=co=null,T.H=d,T.A=m,qt=l,Rt!==null?0:(ln=null,jt=0,Wd(),An)}function t6(){for(;Rt!==null&&!Zt();)lx(Rt)}function lx(s){var a=Mw(s.alternate,s,Ir);s.memoizedProps=s.pendingProps,a===null?kh(s):Rt=a}function cx(s){var a=s,l=a.alternate;switch(a.tag){case 15:case 0:a=Ew(l,a,a.pendingProps,a.type,void 0,jt);break;case 11:a=Ew(l,a,a.pendingProps,a.type.render,a.ref,jt);break;case 5:Xm(a);default:Ow(l,a),a=Rt=oS(a,Ir),a=Mw(l,a,Ir)}s.memoizedProps=s.pendingProps,a===null?kh(s):Rt=a}function wl(s,a,l,d){Er=co=null,Xm(a),dl=null,zc=0;var m=a.return;try{if(U3(s,m,a,l,jt)){An=1,hh(s,bs(l,s.current)),Rt=null;return}}catch(y){if(m!==null)throw Rt=m,y;An=1,hh(s,bs(l,s.current)),Rt=null;return}a.flags&32768?(It||d===1?s=!0:vl||(jt&536870912)!==0?s=!1:(_a=s=!0,(d===2||d===9||d===3||d===6)&&(d=ss.current,d!==null&&d.tag===13&&(d.flags|=16384))),ux(a,s)):kh(a)}function kh(s){var a=s;do{if((a.flags&32768)!==0){ux(a,_a);return}s=a.return;var l=G3(a.alternate,a,Ir);if(l!==null){Rt=l;return}if(a=a.sibling,a!==null){Rt=a;return}Rt=a=s}while(a!==null);An===0&&(An=5)}function ux(s,a){do{var l=K3(s.alternate,s);if(l!==null){l.flags&=32767,Rt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(s=s.sibling,s!==null)){Rt=s;return}Rt=s=l}while(s!==null);An=6,Rt=null}function dx(s,a,l,d,m,y,k,P,X){s.cancelPendingCommit=null;do Eh();while(Xn!==0);if((qt&6)!==0)throw Error(i(327));if(a!==null){if(a===s.current)throw Error(i(177));if(y=a.lanes|a.childLanes,y|=xm,je(s,l,y,k,P,X),s===ln&&(Rt=ln=null,jt=0),bl=a,ba=s,Br=l,Lg=y,Mg=m,ex=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,r6(We,function(){return gx(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=T.T,T.T=null,m=B.p,B.p=2,k=qt,qt|=4;try{V3(s,a,l)}finally{qt=k,B.p=m,T.T=d}}Xn=1,hx(),fx(),px()}}function hx(){if(Xn===1){Xn=0;var s=ba,a=bl,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var d=B.p;B.p=2;var m=qt;qt|=4;try{Gw(a,s);var y=Kg,k=J1(s.containerInfo),P=y.focusedElem,X=y.selectionRange;if(k!==P&&P&&P.ownerDocument&&Z1(P.ownerDocument.documentElement,P)){if(X!==null&&vm(P)){var ie=X.start,pe=X.end;if(pe===void 0&&(pe=ie),"selectionStart"in P)P.selectionStart=ie,P.selectionEnd=Math.min(pe,P.value.length);else{var _e=P.ownerDocument||document,oe=_e&&_e.defaultView||window;if(oe.getSelection){var de=oe.getSelection(),Fe=P.textContent.length,st=Math.min(X.start,Fe),sn=X.end===void 0?st:Math.min(X.end,Fe);!de.extend&&st>sn&&(k=sn,sn=st,st=k);var ee=X1(P,st),Q=X1(P,sn);if(ee&&Q&&(de.rangeCount!==1||de.anchorNode!==ee.node||de.anchorOffset!==ee.offset||de.focusNode!==Q.node||de.focusOffset!==Q.offset)){var ne=_e.createRange();ne.setStart(ee.node,ee.offset),de.removeAllRanges(),st>sn?(de.addRange(ne),de.extend(Q.node,Q.offset)):(ne.setEnd(Q.node,Q.offset),de.addRange(ne))}}}}for(_e=[],de=P;de=de.parentNode;)de.nodeType===1&&_e.push({element:de,left:de.scrollLeft,top:de.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<_e.length;P++){var ge=_e[P];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}Ph=!!Gg,Kg=Gg=null}finally{qt=m,B.p=d,T.T=l}}s.current=a,Xn=2}}function fx(){if(Xn===2){Xn=0;var s=ba,a=bl,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var d=B.p;B.p=2;var m=qt;qt|=4;try{Hw(s,a.alternate,a)}finally{qt=m,B.p=d,T.T=l}}Xn=3}}function px(){if(Xn===4||Xn===3){Xn=0,fn();var s=ba,a=bl,l=Br,d=ex;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Xn=5:(Xn=0,bl=ba=null,mx(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ya=null),Yn(l),a=a.stateNode,Dt&&typeof Dt.onCommitFiberRoot=="function")try{Dt.onCommitFiberRoot(ht,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=T.T,m=B.p,B.p=2,T.T=null;try{for(var y=s.onRecoverableError,k=0;k<d.length;k++){var P=d[k];y(P.value,{componentStack:P.stack})}}finally{T.T=a,B.p=m}}(Br&3)!==0&&Eh(),ir(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===jg?iu++:(iu=0,jg=s):iu=0,su(0)}}function mx(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,Pc(a)))}function Eh(){return hx(),fx(),px(),gx()}function gx(){if(Xn!==5)return!1;var s=ba,a=Lg;Lg=0;var l=Yn(Br),d=T.T,m=B.p;try{B.p=32>l?32:l,T.T=null,l=Mg,Mg=null;var y=ba,k=Br;if(Xn=0,bl=ba=null,Br=0,(qt&6)!==0)throw Error(i(331));var P=qt;if(qt|=4,Zw(y.current),Vw(y,y.current,k,l),qt=P,su(0,!1),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(ht,y)}catch{}return!0}finally{B.p=m,T.T=d,mx(s,a)}}function _x(s,a,l){a=bs(l,a),a=dg(s.stateNode,a,2),s=fa(s,a,2),s!==null&&(gt(s,2),ir(s))}function Xt(s,a,l){if(s.tag===3)_x(s,s,l);else for(;a!==null;){if(a.tag===3){_x(a,s,l);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ya===null||!ya.has(d))){s=bs(l,s),l=vw(2),d=fa(a,l,2),d!==null&&(yw(l,d,a,s),gt(d,2),ir(d));break}}a=a.return}}function Ig(s,a,l){var d=s.pingCache;if(d===null){d=s.pingCache=new Z3;var m=new Set;d.set(a,m)}else m=d.get(a),m===void 0&&(m=new Set,d.set(a,m));m.has(l)||(Ag=!0,m.add(l),s=n6.bind(null,s,a,l),a.then(s,s))}function n6(s,a,l){var d=s.pingCache;d!==null&&d.delete(a),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,ln===s&&(jt&l)===l&&(An===4||An===3&&(jt&62914560)===jt&&300>wt()-bh?(qt&2)===0&&Sl(s,0):Rg|=l,yl===jt&&(yl=0)),ir(s)}function vx(s,a){a===0&&(a=Ze()),s=ao(s,a),s!==null&&(gt(s,a),ir(s))}function i6(s){var a=s.memoizedState,l=0;a!==null&&(l=a.retryLane),vx(s,l)}function s6(s,a){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,m=s.memoizedState;m!==null&&(l=m.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(a),vx(s,l)}function r6(s,a){return Pe(s,a)}var Th=null,xl=null,Bg=!1,Ah=!1,Pg=!1,wa=0;function ir(s){s!==xl&&s.next===null&&(xl===null?Th=xl=s:xl=xl.next=s),Ah=!0,Bg||(Bg=!0,o6())}function su(s,a){if(!Pg&&Ah){Pg=!0;do for(var l=!1,d=Th;d!==null;){if(s!==0){var m=d.pendingLanes;if(m===0)var y=0;else{var k=d.suspendedLanes,P=d.pingedLanes;y=(1<<31-Bt(42|s)+1)-1,y&=m&~(k&~P),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,wx(d,y))}else y=jt,y=V(d,d===ln?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||ue(d,y)||(l=!0,wx(d,y));d=d.next}while(l);Pg=!1}}function a6(){yx()}function yx(){Ah=Bg=!1;var s=0;wa!==0&&_6()&&(s=wa);for(var a=wt(),l=null,d=Th;d!==null;){var m=d.next,y=bx(d,a);y===0?(d.next=null,l===null?Th=m:l.next=m,m===null&&(xl=l)):(l=d,(s!==0||(y&3)!==0)&&(Ah=!0)),d=m}Xn!==0&&Xn!==5||su(s),wa!==0&&(wa=0)}function bx(s,a){for(var l=s.suspendedLanes,d=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var k=31-Bt(y),P=1<<k,X=m[k];X===-1?((P&l)===0||(P&d)!==0)&&(m[k]=be(P,a)):X<=a&&(s.expiredLanes|=P),y&=~P}if(a=ln,l=jt,l=V(s,s===a?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===a&&(Yt===2||Yt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&At(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||ue(s,l)){if(a=l&-l,a===s.callbackPriority)return a;switch(d!==null&&At(d),Yn(l)){case 2:case 8:l=Se;break;case 32:l=We;break;case 268435456:l=$e;break;default:l=We}return d=Sx.bind(null,s),l=Pe(l,d),s.callbackPriority=a,s.callbackNode=l,a}return d!==null&&d!==null&&At(d),s.callbackPriority=2,s.callbackNode=null,2}function Sx(s,a){if(Xn!==0&&Xn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(Eh()&&s.callbackNode!==l)return null;var d=jt;return d=V(s,s===ln?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(nx(s,d,a),bx(s,wt()),s.callbackNode!=null&&s.callbackNode===l?Sx.bind(null,s):null)}function wx(s,a){if(Eh())return null;nx(s,a,!0)}function o6(){y6(function(){(qt&6)!==0?Pe(xt,a6):yx()})}function $g(){if(wa===0){var s=ll;s===0&&(s=et,et<<=1,(et&261888)===0&&(et=256)),wa=s}return wa}function xx(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:ra(""+s)}function Cx(s,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,s.id&&l.setAttribute("form",s.id),a.parentNode.insertBefore(l,a),s=new FormData(s),l.parentNode.removeChild(l),s}function l6(s,a,l,d,m){if(a==="submit"&&l&&l.stateNode===m){var y=xx((m[Gt]||null).action),k=d.submitter;k&&(a=(a=k[Gt]||null)?xx(a.formAction):k.getAttribute("formAction"),a!==null&&(y=a,k=null));var P=new zd("action","action",null,d,m);s.push({event:P,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(wa!==0){var X=k?Cx(m,k):new FormData(m);rg(l,{pending:!0,data:X,method:m.method,action:y},null,X)}}else typeof y=="function"&&(P.preventDefault(),X=k?Cx(m,k):new FormData(m),rg(l,{pending:!0,data:X,method:m.method,action:y},y,X))},currentTarget:m}]})}}for(var zg=0;zg<wm.length;zg++){var Hg=wm[zg],c6=Hg.toLowerCase(),u6=Hg[0].toUpperCase()+Hg.slice(1);Hs(c6,"on"+u6)}Hs(tS,"onAnimationEnd"),Hs(nS,"onAnimationIteration"),Hs(iS,"onAnimationStart"),Hs("dblclick","onDoubleClick"),Hs("focusin","onFocus"),Hs("focusout","onBlur"),Hs(E3,"onTransitionRun"),Hs(T3,"onTransitionStart"),Hs(A3,"onTransitionCancel"),Hs(sS,"onTransitionEnd"),ye("onMouseEnter",["mouseout","mouseover"]),ye("onMouseLeave",["mouseout","mouseover"]),ye("onPointerEnter",["pointerout","pointerover"]),ye("onPointerLeave",["pointerout","pointerover"]),zt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zt("onBeforeInput",["compositionend","keypress","textInput","paste"]),zt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ru="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(" "),d6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ru));function kx(s,a){a=(a&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],m=d.event;d=d.listeners;e:{var y=void 0;if(a)for(var k=d.length-1;0<=k;k--){var P=d[k],X=P.instance,ie=P.currentTarget;if(P=P.listener,X!==y&&m.isPropagationStopped())break e;y=P,m.currentTarget=ie;try{y(m)}catch(pe){Ud(pe)}m.currentTarget=null,y=X}else for(k=0;k<d.length;k++){if(P=d[k],X=P.instance,ie=P.currentTarget,P=P.listener,X!==y&&m.isPropagationStopped())break e;y=P,m.currentTarget=ie;try{y(m)}catch(pe){Ud(pe)}m.currentTarget=null,y=X}}}}function Nt(s,a){var l=a[zs];l===void 0&&(l=a[zs]=new Set);var d=s+"__bubble";l.has(d)||(Ex(a,s,2,!1),l.add(d))}function Fg(s,a,l){var d=0;a&&(d|=4),Ex(l,s,d,a)}var Rh="_reactListening"+Math.random().toString(36).slice(2);function Ug(s){if(!s[Rh]){s[Rh]=!0,He.forEach(function(l){l!=="selectionchange"&&(d6.has(l)||Fg(l,!1,s),Fg(l,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Rh]||(a[Rh]=!0,Fg("selectionchange",!1,a))}}function Ex(s,a,l,d){switch(tC(a)){case 2:var m=$6;break;case 8:m=z6;break;default:m=s_}l=m.bind(null,a,l,s),m=void 0,!cm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(m=!0),d?m!==void 0?s.addEventListener(a,l,{capture:!0,passive:m}):s.addEventListener(a,l,!0):m!==void 0?s.addEventListener(a,l,{passive:m}):s.addEventListener(a,l,!1)}function Wg(s,a,l,d,m){var y=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var k=d.tag;if(k===3||k===4){var P=d.stateNode.containerInfo;if(P===m)break;if(k===4)for(k=d.return;k!==null;){var X=k.tag;if((X===3||X===4)&&k.stateNode.containerInfo===m)return;k=k.return}for(;P!==null;){if(k=q(P),k===null)return;if(X=k.tag,X===5||X===6||X===26||X===27){d=y=k;continue e}P=P.parentNode}}d=d.return}Id(function(){var ie=y,pe=_t(l),_e=[];e:{var oe=rS.get(s);if(oe!==void 0){var de=zd,Fe=s;switch(s){case"keypress":if(Pd(l)===0)break e;case"keydown":case"keyup":de=s3;break;case"focusin":Fe="focus",de=fm;break;case"focusout":Fe="blur",de=fm;break;case"beforeblur":case"afterblur":de=fm;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":de=O1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":de=GM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":de=o3;break;case tS:case nS:case iS:de=YM;break;case sS:de=c3;break;case"scroll":case"scrollend":de=WM;break;case"wheel":de=d3;break;case"copy":case"cut":case"paste":de=ZM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":de=I1;break;case"toggle":case"beforetoggle":de=f3}var st=(a&4)!==0,sn=!st&&(s==="scroll"||s==="scrollend"),ee=st?oe!==null?oe+"Capture":null:oe;st=[];for(var Q=ie,ne;Q!==null;){var ge=Q;if(ne=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ne===null||ee===null||(ge=Tc(Q,ee),ge!=null&&st.push(au(Q,ge,ne))),sn)break;Q=Q.return}0<st.length&&(oe=new de(oe,Fe,null,l,pe),_e.push({event:oe,listeners:st}))}}if((a&7)===0){e:{if(oe=s==="mouseover"||s==="pointerover",de=s==="mouseout"||s==="pointerout",oe&&l!==Ke&&(Fe=l.relatedTarget||l.fromElement)&&(q(Fe)||Fe[Fi]))break e;if((de||oe)&&(oe=pe.window===pe?pe:(oe=pe.ownerDocument)?oe.defaultView||oe.parentWindow:window,de?(Fe=l.relatedTarget||l.toElement,de=ie,Fe=Fe?q(Fe):null,Fe!==null&&(sn=o(Fe),st=Fe.tag,Fe!==sn||st!==5&&st!==27&&st!==6)&&(Fe=null)):(de=null,Fe=ie),de!==Fe)){if(st=O1,ge="onMouseLeave",ee="onMouseEnter",Q="mouse",(s==="pointerout"||s==="pointerover")&&(st=I1,ge="onPointerLeave",ee="onPointerEnter",Q="pointer"),sn=de==null?oe:Ee(de),ne=Fe==null?oe:Ee(Fe),oe=new st(ge,Q+"leave",de,l,pe),oe.target=sn,oe.relatedTarget=ne,ge=null,q(pe)===ie&&(st=new st(ee,Q+"enter",Fe,l,pe),st.target=ne,st.relatedTarget=sn,ge=st),sn=ge,de&&Fe)t:{for(st=h6,ee=de,Q=Fe,ne=0,ge=ee;ge;ge=st(ge))ne++;ge=0;for(var tt=Q;tt;tt=st(tt))ge++;for(;0<ne-ge;)ee=st(ee),ne--;for(;0<ge-ne;)Q=st(Q),ge--;for(;ne--;){if(ee===Q||Q!==null&&ee===Q.alternate){st=ee;break t}ee=st(ee),Q=st(Q)}st=null}else st=null;de!==null&&Tx(_e,oe,de,st,!1),Fe!==null&&sn!==null&&Tx(_e,sn,Fe,st,!0)}}e:{if(oe=ie?Ee(ie):window,de=oe.nodeName&&oe.nodeName.toLowerCase(),de==="select"||de==="input"&&oe.type==="file")var Ht=W1;else if(F1(oe))if(q1)Ht=x3;else{Ht=S3;var Ve=b3}else de=oe.nodeName,!de||de.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&sa(ie.elementType)&&(Ht=W1):Ht=w3;if(Ht&&(Ht=Ht(s,ie))){U1(_e,Ht,l,pe);break e}Ve&&Ve(s,oe,ie),s==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&Zo(oe,"number",oe.value)}switch(Ve=ie?Ee(ie):window,s){case"focusin":(F1(Ve)||Ve.contentEditable==="true")&&(el=Ve,ym=ie,Dc=null);break;case"focusout":Dc=ym=el=null;break;case"mousedown":bm=!0;break;case"contextmenu":case"mouseup":case"dragend":bm=!1,Q1(_e,l,pe);break;case"selectionchange":if(k3)break;case"keydown":case"keyup":Q1(_e,l,pe)}var bt;if(mm)e:{switch(s){case"compositionstart":var Ot="onCompositionStart";break e;case"compositionend":Ot="onCompositionEnd";break e;case"compositionupdate":Ot="onCompositionUpdate";break e}Ot=void 0}else Qo?z1(s,l)&&(Ot="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ot="onCompositionStart");Ot&&(B1&&l.locale!=="ko"&&(Qo||Ot!=="onCompositionStart"?Ot==="onCompositionEnd"&&Qo&&(bt=M1()):(aa=pe,um="value"in aa?aa.value:aa.textContent,Qo=!0)),Ve=Nh(ie,Ot),0<Ve.length&&(Ot=new D1(Ot,s,null,l,pe),_e.push({event:Ot,listeners:Ve}),bt?Ot.data=bt:(bt=H1(l),bt!==null&&(Ot.data=bt)))),(bt=m3?g3(s,l):_3(s,l))&&(Ot=Nh(ie,"onBeforeInput"),0<Ot.length&&(Ve=new D1("onBeforeInput","beforeinput",null,l,pe),_e.push({event:Ve,listeners:Ot}),Ve.data=bt)),l6(_e,s,ie,l,pe)}kx(_e,a)})}function au(s,a,l){return{instance:s,listener:a,currentTarget:l}}function Nh(s,a){for(var l=a+"Capture",d=[];s!==null;){var m=s,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Tc(s,l),m!=null&&d.unshift(au(s,m,y)),m=Tc(s,a),m!=null&&d.push(au(s,m,y))),s.tag===3)return d;s=s.return}return[]}function h6(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Tx(s,a,l,d,m){for(var y=a._reactName,k=[];l!==null&&l!==d;){var P=l,X=P.alternate,ie=P.stateNode;if(P=P.tag,X!==null&&X===d)break;P!==5&&P!==26&&P!==27||ie===null||(X=ie,m?(ie=Tc(l,y),ie!=null&&k.unshift(au(l,ie,X))):m||(ie=Tc(l,y),ie!=null&&k.push(au(l,ie,X)))),l=l.return}k.length!==0&&s.push({event:a,listeners:k})}var f6=/\r\n?/g,p6=/\u0000|\uFFFD/g;function Ax(s){return(typeof s=="string"?s:""+s).replace(f6,`
9
+ `).replace(p6,"")}function Rx(s,a){return a=Ax(a),Ax(s)===a}function nn(s,a,l,d,m,y){switch(l){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||at(s,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&at(s,""+d);break;case"className":dn(s,"class",d);break;case"tabIndex":dn(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":dn(s,l,d);break;case"style":Vt(s,d,y);break;case"data":if(a!=="object"){dn(s,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=ra(""+d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(l==="formAction"?(a!=="input"&&nn(s,a,"name",m.name,m,null),nn(s,a,"formEncType",m.formEncType,m,null),nn(s,a,"formMethod",m.formMethod,m,null),nn(s,a,"formTarget",m.formTarget,m,null)):(nn(s,a,"encType",m.encType,m,null),nn(s,a,"method",m.method,m,null),nn(s,a,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=ra(""+d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=Ae);break;case"onScroll":d!=null&&Nt("scroll",s);break;case"onScrollEnd":d!=null&&Nt("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(l=d.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}l=ra(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""+d):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":Nt("beforetoggle",s),Nt("toggle",s),Pn(s,"popover",d);break;case"xlinkActuate":ti(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ti(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ti(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ti(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ti(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ti(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ti(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ti(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ti(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Pn(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=wr.get(l)||l,Pn(s,l,d))}}function qg(s,a,l,d,m,y){switch(l){case"style":Vt(s,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(l=d.__html,l!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=l}}break;case"children":typeof d=="string"?at(s,d):(typeof d=="number"||typeof d=="bigint")&&at(s,""+d);break;case"onScroll":d!=null&&Nt("scroll",s);break;case"onScrollEnd":d!=null&&Nt("scrollend",s);break;case"onClick":d!=null&&(s.onclick=Ae);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$t.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),a=l.slice(2,m?l.length-7:void 0),y=s[Gt]||null,y=y!=null?y[l]:null,typeof y=="function"&&s.removeEventListener(a,y,m),typeof d=="function")){typeof y!="function"&&y!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(a,d,m);break e}l in s?s[l]=d:d===!0?s.setAttribute(l,""):Pn(s,l,d)}}}function vi(s,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Nt("error",s),Nt("load",s);var d=!1,m=!1,y;for(y in l)if(l.hasOwnProperty(y)){var k=l[y];if(k!=null)switch(y){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:nn(s,a,y,k,l,null)}}m&&nn(s,a,"srcSet",l.srcSet,l,null),d&&nn(s,a,"src",l.src,l,null);return;case"input":Nt("invalid",s);var P=y=k=m=null,X=null,ie=null;for(d in l)if(l.hasOwnProperty(d)){var pe=l[d];if(pe!=null)switch(d){case"name":m=pe;break;case"type":k=pe;break;case"checked":X=pe;break;case"defaultChecked":ie=pe;break;case"value":y=pe;break;case"defaultValue":P=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(i(137,a));break;default:nn(s,a,d,pe,l,null)}}no(s,y,P,X,ie,k,m,!1);return;case"select":Nt("invalid",s),d=k=y=null;for(m in l)if(l.hasOwnProperty(m)&&(P=l[m],P!=null))switch(m){case"value":y=P;break;case"defaultValue":k=P;break;case"multiple":d=P;default:nn(s,a,m,P,l,null)}a=y,l=k,s.multiple=!!d,a!=null?pi(s,!!d,a,!1):l!=null&&pi(s,!!d,l,!0);return;case"textarea":Nt("invalid",s),y=m=d=null;for(k in l)if(l.hasOwnProperty(k)&&(P=l[k],P!=null))switch(k){case"value":d=P;break;case"defaultValue":m=P;break;case"children":y=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(91));break;default:nn(s,a,k,P,l,null)}Jo(s,d,m,y);return;case"option":for(X in l)l.hasOwnProperty(X)&&(d=l[X],d!=null)&&(X==="selected"?s.selected=d&&typeof d!="function"&&typeof d!="symbol":nn(s,a,X,d,l,null));return;case"dialog":Nt("beforetoggle",s),Nt("toggle",s),Nt("cancel",s),Nt("close",s);break;case"iframe":case"object":Nt("load",s);break;case"video":case"audio":for(d=0;d<ru.length;d++)Nt(ru[d],s);break;case"image":Nt("error",s),Nt("load",s);break;case"details":Nt("toggle",s);break;case"embed":case"source":case"link":Nt("error",s),Nt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in l)if(l.hasOwnProperty(ie)&&(d=l[ie],d!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:nn(s,a,ie,d,l,null)}return;default:if(sa(a)){for(pe in l)l.hasOwnProperty(pe)&&(d=l[pe],d!==void 0&&qg(s,a,pe,d,l,void 0));return}}for(P in l)l.hasOwnProperty(P)&&(d=l[P],d!=null&&nn(s,a,P,d,l,null))}function m6(s,a,l,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,k=null,P=null,X=null,ie=null,pe=null;for(de in l){var _e=l[de];if(l.hasOwnProperty(de)&&_e!=null)switch(de){case"checked":break;case"value":break;case"defaultValue":X=_e;default:d.hasOwnProperty(de)||nn(s,a,de,null,d,_e)}}for(var oe in d){var de=d[oe];if(_e=l[oe],d.hasOwnProperty(oe)&&(de!=null||_e!=null))switch(oe){case"type":y=de;break;case"name":m=de;break;case"checked":ie=de;break;case"defaultChecked":pe=de;break;case"value":k=de;break;case"defaultValue":P=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,a));break;default:de!==_e&&nn(s,a,oe,de,d,_e)}}Cc(s,k,P,X,ie,pe,y,m);return;case"select":de=k=P=oe=null;for(y in l)if(X=l[y],l.hasOwnProperty(y)&&X!=null)switch(y){case"value":break;case"multiple":de=X;default:d.hasOwnProperty(y)||nn(s,a,y,null,d,X)}for(m in d)if(y=d[m],X=l[m],d.hasOwnProperty(m)&&(y!=null||X!=null))switch(m){case"value":oe=y;break;case"defaultValue":P=y;break;case"multiple":k=y;default:y!==X&&nn(s,a,m,y,d,X)}a=P,l=k,d=de,oe!=null?pi(s,!!l,oe,!1):!!d!=!!l&&(a!=null?pi(s,!!l,a,!0):pi(s,!!l,l?[]:"",!1));return;case"textarea":de=oe=null;for(P in l)if(m=l[P],l.hasOwnProperty(P)&&m!=null&&!d.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:nn(s,a,P,null,d,m)}for(k in d)if(m=d[k],y=l[k],d.hasOwnProperty(k)&&(m!=null||y!=null))switch(k){case"value":oe=m;break;case"defaultValue":de=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==y&&nn(s,a,k,m,d,y)}Od(s,oe,de);return;case"option":for(var Fe in l)oe=l[Fe],l.hasOwnProperty(Fe)&&oe!=null&&!d.hasOwnProperty(Fe)&&(Fe==="selected"?s.selected=!1:nn(s,a,Fe,null,d,oe));for(X in d)oe=d[X],de=l[X],d.hasOwnProperty(X)&&oe!==de&&(oe!=null||de!=null)&&(X==="selected"?s.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":nn(s,a,X,oe,d,de));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var st in l)oe=l[st],l.hasOwnProperty(st)&&oe!=null&&!d.hasOwnProperty(st)&&nn(s,a,st,null,d,oe);for(ie in d)if(oe=d[ie],de=l[ie],d.hasOwnProperty(ie)&&oe!==de&&(oe!=null||de!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,a));break;default:nn(s,a,ie,oe,d,de)}return;default:if(sa(a)){for(var sn in l)oe=l[sn],l.hasOwnProperty(sn)&&oe!==void 0&&!d.hasOwnProperty(sn)&&qg(s,a,sn,void 0,d,oe);for(pe in d)oe=d[pe],de=l[pe],!d.hasOwnProperty(pe)||oe===de||oe===void 0&&de===void 0||qg(s,a,pe,oe,d,de);return}}for(var ee in l)oe=l[ee],l.hasOwnProperty(ee)&&oe!=null&&!d.hasOwnProperty(ee)&&nn(s,a,ee,null,d,oe);for(_e in d)oe=d[_e],de=l[_e],!d.hasOwnProperty(_e)||oe===de||oe==null&&de==null||nn(s,a,_e,oe,d,de)}function Nx(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g6(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var m=l[d],y=m.transferSize,k=m.initiatorType,P=m.duration;if(y&&P&&Nx(k)){for(k=0,P=m.responseEnd,d+=1;d<l.length;d++){var X=l[d],ie=X.startTime;if(ie>P)break;var pe=X.transferSize,_e=X.initiatorType;pe&&Nx(_e)&&(X=X.responseEnd,k+=pe*(X<P?1:(P-ie)/(X-ie)))}if(--d,a+=8*(y+k)/(m.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Gg=null,Kg=null;function Lh(s){return s.nodeType===9?s:s.ownerDocument}function Lx(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mx(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Vg(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Yg=null;function _6(){var s=window.event;return s&&s.type==="popstate"?s===Yg?!1:(Yg=s,!0):(Yg=null,!1)}var jx=typeof setTimeout=="function"?setTimeout:void 0,v6=typeof clearTimeout=="function"?clearTimeout:void 0,Ox=typeof Promise=="function"?Promise:void 0,y6=typeof queueMicrotask=="function"?queueMicrotask:typeof Ox<"u"?function(s){return Ox.resolve(null).then(s).catch(b6)}:jx;function b6(s){setTimeout(function(){throw s})}function xa(s){return s==="head"}function Dx(s,a){var l=a,d=0;do{var m=l.nextSibling;if(s.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(m),Tl(a);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")ou(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,ou(l);for(var y=l.firstChild;y;){var k=y.nextSibling,P=y.nodeName;y[Jt]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=k}}else l==="body"&&ou(s.ownerDocument.body);l=m}while(l);Tl(a)}function Ix(s,a){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function Xg(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Xg(l),Ce(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function S6(s,a,l,d){for(;s.nodeType===1;){var m=l;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[Jt])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(y=s.getAttribute("rel"),y==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(y!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(y=s.getAttribute("src"),(y!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===y)return s}else return s;if(s=ks(s.nextSibling),s===null)break}return null}function w6(s,a,l){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=ks(s.nextSibling),s===null))return null;return s}function Bx(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=ks(s.nextSibling),s===null))return null;return s}function Zg(s){return s.data==="$?"||s.data==="$~"}function Jg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function x6(s,a){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||l.readyState!=="loading")a();else{var d=function(){a(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function ks(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var Qg=null;function Px(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(a===0)return ks(s.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}s=s.nextSibling}return null}function $x(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return s;a--}else l!=="/$"&&l!=="/&"||a++}s=s.previousSibling}return null}function zx(s,a,l){switch(a=Lh(l),s){case"html":if(s=a.documentElement,!s)throw Error(i(452));return s;case"head":if(s=a.head,!s)throw Error(i(453));return s;case"body":if(s=a.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function ou(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);Ce(s)}var Es=new Map,Hx=new Set;function Mh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Pr=B.d;B.d={f:C6,r:k6,D:E6,C:T6,L:A6,m:R6,X:L6,S:N6,M:M6};function C6(){var s=Pr.f(),a=xh();return s||a}function k6(s){var a=fe(s);a!==null&&a.tag===5&&a.type==="form"?sw(a):Pr.r(s)}var Cl=typeof document>"u"?null:document;function Fx(s,a,l){var d=Cl;if(d&&typeof a=="string"&&a){var m=Ui(a);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),Hx.has(m)||(Hx.add(m),s={rel:s,crossOrigin:l,href:a},d.querySelector(m)===null&&(a=d.createElement("link"),vi(a,"link",s),ft(a),d.head.appendChild(a)))}}function E6(s){Pr.D(s),Fx("dns-prefetch",s,null)}function T6(s,a){Pr.C(s,a),Fx("preconnect",s,a)}function A6(s,a,l){Pr.L(s,a,l);var d=Cl;if(d&&s&&a){var m='link[rel="preload"][as="'+Ui(a)+'"]';a==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Ui(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Ui(l.imageSizes)+'"]')):m+='[href="'+Ui(s)+'"]';var y=m;switch(a){case"style":y=kl(s);break;case"script":y=El(s)}Es.has(y)||(s=_({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:s,as:a},l),Es.set(y,s),d.querySelector(m)!==null||a==="style"&&d.querySelector(lu(y))||a==="script"&&d.querySelector(cu(y))||(a=d.createElement("link"),vi(a,"link",s),ft(a),d.head.appendChild(a)))}}function R6(s,a){Pr.m(s,a);var l=Cl;if(l&&s){var d=a&&typeof a.as=="string"?a.as:"script",m='link[rel="modulepreload"][as="'+Ui(d)+'"][href="'+Ui(s)+'"]',y=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=El(s)}if(!Es.has(y)&&(s=_({rel:"modulepreload",href:s},a),Es.set(y,s),l.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(cu(y)))return}d=l.createElement("link"),vi(d,"link",s),ft(d),l.head.appendChild(d)}}}function N6(s,a,l){Pr.S(s,a,l);var d=Cl;if(d&&s){var m=lt(d).hoistableStyles,y=kl(s);a=a||"default";var k=m.get(y);if(!k){var P={loading:0,preload:null};if(k=d.querySelector(lu(y)))P.loading=5;else{s=_({rel:"stylesheet",href:s,"data-precedence":a},l),(l=Es.get(y))&&e_(s,l);var X=k=d.createElement("link");ft(X),vi(X,"link",s),X._p=new Promise(function(ie,pe){X.onload=ie,X.onerror=pe}),X.addEventListener("load",function(){P.loading|=1}),X.addEventListener("error",function(){P.loading|=2}),P.loading|=4,jh(k,a,d)}k={type:"stylesheet",instance:k,count:1,state:P},m.set(y,k)}}}function L6(s,a){Pr.X(s,a);var l=Cl;if(l&&s){var d=lt(l).hoistableScripts,m=El(s),y=d.get(m);y||(y=l.querySelector(cu(m)),y||(s=_({src:s,async:!0},a),(a=Es.get(m))&&t_(s,a),y=l.createElement("script"),ft(y),vi(y,"link",s),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function M6(s,a){Pr.M(s,a);var l=Cl;if(l&&s){var d=lt(l).hoistableScripts,m=El(s),y=d.get(m);y||(y=l.querySelector(cu(m)),y||(s=_({src:s,async:!0,type:"module"},a),(a=Es.get(m))&&t_(s,a),y=l.createElement("script"),ft(y),vi(y,"link",s),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function Ux(s,a,l,d){var m=(m=ae.current)?Mh(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=kl(l.href),l=lt(m).hoistableStyles,d=l.get(a),d||(d={type:"style",instance:null,count:0,state:null},l.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=kl(l.href);var y=lt(m).hoistableStyles,k=y.get(s);if(k||(m=m.ownerDocument||m,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,k),(y=m.querySelector(lu(s)))&&!y._p&&(k.instance=y,k.state.loading=5),Es.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Es.set(s,l),y||j6(m,s,l,k.state))),a&&d===null)throw Error(i(528,""));return k}if(a&&d!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=El(l),l=lt(m).hoistableScripts,d=l.get(a),d||(d={type:"script",instance:null,count:0,state:null},l.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function kl(s){return'href="'+Ui(s)+'"'}function lu(s){return'link[rel="stylesheet"]['+s+"]"}function Wx(s){return _({},s,{"data-precedence":s.precedence,precedence:null})}function j6(s,a,l,d){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=s.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),vi(a,"link",l),ft(a),s.head.appendChild(a))}function El(s){return'[src="'+Ui(s)+'"]'}function cu(s){return"script[async]"+s}function qx(s,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var d=s.querySelector('style[data-href~="'+Ui(l.href)+'"]');if(d)return a.instance=d,ft(d),d;var m=_({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),ft(d),vi(d,"style",m),jh(d,l.precedence,s),a.instance=d;case"stylesheet":m=kl(l.href);var y=s.querySelector(lu(m));if(y)return a.state.loading|=4,a.instance=y,ft(y),y;d=Wx(l),(m=Es.get(m))&&e_(d,m),y=(s.ownerDocument||s).createElement("link"),ft(y);var k=y;return k._p=new Promise(function(P,X){k.onload=P,k.onerror=X}),vi(y,"link",d),a.state.loading|=4,jh(y,l.precedence,s),a.instance=y;case"script":return y=El(l.src),(m=s.querySelector(cu(y)))?(a.instance=m,ft(m),m):(d=l,(m=Es.get(y))&&(d=_({},l),t_(d,m)),s=s.ownerDocument||s,m=s.createElement("script"),ft(m),vi(m,"link",d),s.head.appendChild(m),a.instance=m);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,jh(d,l.precedence,s));return a.instance}function jh(s,a,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,y=m,k=0;k<d.length;k++){var P=d[k];if(P.dataset.precedence===a)y=P;else if(y!==m)break}y?y.parentNode.insertBefore(s,y.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(s,a.firstChild))}function e_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function t_(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Oh=null;function Gx(s,a,l){if(Oh===null){var d=new Map,m=Oh=new Map;m.set(l,d)}else m=Oh,d=m.get(l),d||(d=new Map,m.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),m=0;m<l.length;m++){var y=l[m];if(!(y[Jt]||y[on]||s==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var k=y.getAttribute(a)||"";k=s+k;var P=d.get(k);P?P.push(y):d.set(k,[y])}}return d}function Kx(s,a,l){s=s.ownerDocument||s,s.head.insertBefore(l,a==="title"?s.querySelector("head > title"):null)}function O6(s,a,l){if(l===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Vx(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function D6(s,a,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=kl(d.href),y=a.querySelector(lu(m));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Dh.bind(s),a.then(s,s)),l.state.loading|=4,l.instance=y,ft(y);return}y=a.ownerDocument||a,d=Wx(d),(m=Es.get(m))&&e_(d,m),y=y.createElement("link"),ft(y);var k=y;k._p=new Promise(function(P,X){k.onload=P,k.onerror=X}),vi(y,"link",d),l.instance=y}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Dh.bind(s),a.addEventListener("load",l),a.addEventListener("error",l))}}var n_=0;function I6(s,a){return s.stylesheets&&s.count===0&&Bh(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&Bh(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+a);0<s.imgBytes&&n_===0&&(n_=62500*g6());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Bh(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>n_?50:800)+a);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Dh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Ih=null;function Bh(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Ih=new Map,a.forEach(B6,s),Ih=null,Dh.call(s))}function B6(s,a){if(!(a.state.loading&4)){var l=Ih.get(s);if(l)var d=l.get(null);else{l=new Map,Ih.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var k=m[y];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(l.set(k.dataset.precedence,k),d=k)}d&&l.set(null,d)}m=a.instance,k=m.getAttribute("data-precedence"),y=l.get(k)||d,y===d&&l.set(null,m),l.set(k,m),this.count++,d=Dh.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),y?y.parentNode.insertBefore(m,y.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),a.state.loading|=4}}var uu={$$typeof:U,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function P6(s,a,l,d,m,y,k,P,X){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pt(0),this.hiddenUpdates=Pt(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function Yx(s,a,l,d,m,y,k,P,X,ie,pe,_e){return s=new P6(s,a,l,k,X,ie,pe,_e,P),a=1,y===!0&&(a|=24),y=is(3,null,null,a),s.current=y,y.stateNode=s,a=Dm(),a.refCount++,s.pooledCache=a,a.refCount++,y.memoizedState={element:d,isDehydrated:l,cache:a},$m(y),s}function Xx(s){return s?(s=il,s):il}function Zx(s,a,l,d,m,y){m=Xx(m),d.context===null?d.context=m:d.pendingContext=m,d=ha(a),d.payload={element:l},y=y===void 0?null:y,y!==null&&(d.callback=y),l=fa(s,d,a),l!==null&&(Yi(l,s,a),Fc(l,s,a))}function Jx(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<a?l:a}}function i_(s,a){Jx(s,a),(s=s.alternate)&&Jx(s,a)}function Qx(s){if(s.tag===13||s.tag===31){var a=ao(s,67108864);a!==null&&Yi(a,s,67108864),i_(s,67108864)}}function eC(s){if(s.tag===13||s.tag===31){var a=ls();a=Tt(a);var l=ao(s,a);l!==null&&Yi(l,s,a),i_(s,a)}}var Ph=!0;function $6(s,a,l,d){var m=T.T;T.T=null;var y=B.p;try{B.p=2,s_(s,a,l,d)}finally{B.p=y,T.T=m}}function z6(s,a,l,d){var m=T.T;T.T=null;var y=B.p;try{B.p=8,s_(s,a,l,d)}finally{B.p=y,T.T=m}}function s_(s,a,l,d){if(Ph){var m=r_(d);if(m===null)Wg(s,a,d,$h,l),nC(s,d);else if(F6(m,s,a,l,d))d.stopPropagation();else if(nC(s,d),a&4&&-1<H6.indexOf(s)){for(;m!==null;){var y=fe(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var k=vt(y.pendingLanes);if(k!==0){var P=y;for(P.pendingLanes|=2,P.entangledLanes|=2;k;){var X=1<<31-Bt(k);P.entanglements[1]|=X,k&=~X}ir(y),(qt&6)===0&&(Sh=wt()+500,su(0))}}break;case 31:case 13:P=ao(y,2),P!==null&&Yi(P,y,2),xh(),i_(y,2)}if(y=r_(d),y===null&&Wg(s,a,d,$h,l),y===m)break;m=y}m!==null&&d.stopPropagation()}else Wg(s,a,d,null,l)}}function r_(s){return s=_t(s),a_(s)}var $h=null;function a_(s){if($h=null,s=q(s),s!==null){var a=o(s);if(a===null)s=null;else{var l=a.tag;if(l===13){if(s=u(a),s!==null)return s;s=null}else if(l===31){if(s=h(a),s!==null)return s;s=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return $h=s,null}function tC(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Kt()){case xt:return 2;case Se:return 8;case We:case xn:return 32;case $e:return 268435456;default:return 32}default:return 32}}var o_=!1,Ca=null,ka=null,Ea=null,du=new Map,hu=new Map,Ta=[],H6="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function nC(s,a){switch(s){case"focusin":case"focusout":Ca=null;break;case"dragenter":case"dragleave":ka=null;break;case"mouseover":case"mouseout":Ea=null;break;case"pointerover":case"pointerout":du.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":hu.delete(a.pointerId)}}function fu(s,a,l,d,m,y){return s===null||s.nativeEvent!==y?(s={blockedOn:a,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[m]},a!==null&&(a=fe(a),a!==null&&Qx(a)),s):(s.eventSystemFlags|=d,a=s.targetContainers,m!==null&&a.indexOf(m)===-1&&a.push(m),s)}function F6(s,a,l,d,m){switch(a){case"focusin":return Ca=fu(Ca,s,a,l,d,m),!0;case"dragenter":return ka=fu(ka,s,a,l,d,m),!0;case"mouseover":return Ea=fu(Ea,s,a,l,d,m),!0;case"pointerover":var y=m.pointerId;return du.set(y,fu(du.get(y)||null,s,a,l,d,m)),!0;case"gotpointercapture":return y=m.pointerId,hu.set(y,fu(hu.get(y)||null,s,a,l,d,m)),!0}return!1}function iC(s){var a=q(s.target);if(a!==null){var l=o(a);if(l!==null){if(a=l.tag,a===13){if(a=u(l),a!==null){s.blockedOn=a,$s(s.priority,function(){eC(l)});return}}else if(a===31){if(a=h(l),a!==null){s.blockedOn=a,$s(s.priority,function(){eC(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function zh(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var l=r_(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);Ke=d,l.target.dispatchEvent(d),Ke=null}else return a=fe(l),a!==null&&Qx(a),s.blockedOn=l,!1;a.shift()}return!0}function sC(s,a,l){zh(s)&&l.delete(a)}function U6(){o_=!1,Ca!==null&&zh(Ca)&&(Ca=null),ka!==null&&zh(ka)&&(ka=null),Ea!==null&&zh(Ea)&&(Ea=null),du.forEach(sC),hu.forEach(sC)}function Hh(s,a){s.blockedOn===a&&(s.blockedOn=null,o_||(o_=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,U6)))}var Fh=null;function rC(s){Fh!==s&&(Fh=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Fh===s&&(Fh=null);for(var a=0;a<s.length;a+=3){var l=s[a],d=s[a+1],m=s[a+2];if(typeof d!="function"){if(a_(d||l)===null)continue;break}var y=fe(l);y!==null&&(s.splice(a,3),a-=3,rg(y,{pending:!0,data:m,method:l.method,action:d},d,m))}}))}function Tl(s){function a(X){return Hh(X,s)}Ca!==null&&Hh(Ca,s),ka!==null&&Hh(ka,s),Ea!==null&&Hh(Ea,s),du.forEach(a),hu.forEach(a);for(var l=0;l<Ta.length;l++){var d=Ta[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Ta.length&&(l=Ta[0],l.blockedOn===null);)iC(l),l.blockedOn===null&&Ta.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var m=l[d],y=l[d+1],k=m[Gt]||null;if(typeof y=="function")k||rC(l);else if(k){var P=null;if(y&&y.hasAttribute("formAction")){if(m=y,k=y[Gt]||null)P=k.formAction;else if(a_(m)!==null)continue}else P=k.action;typeof P=="function"?l[d+1]=P:(l.splice(d,3),d-=3),rC(l)}}}function aC(){function s(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(k){return m=k})},focusReset:"manual",scroll:"manual"})}function a(){m!==null&&(m(),m=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),m!==null&&(m(),m=null)}}}function l_(s){this._internalRoot=s}Uh.prototype.render=l_.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,d=ls();Zx(l,d,s,a,null,null)},Uh.prototype.unmount=l_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;Zx(s.current,2,null,s,null,null),xh(),a[Fi]=null}};function Uh(s){this._internalRoot=s}Uh.prototype.unstable_scheduleHydration=function(s){if(s){var a=_s();s={blockedOn:null,target:s,priority:a};for(var l=0;l<Ta.length&&a!==0&&a<Ta[l].priority;l++);Ta.splice(l,0,s),l===0&&iC(s)}};var oC=t.version;if(oC!=="19.2.7")throw Error(i(527,oC,"19.2.7"));B.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=f(a),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var W6={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wh.isDisabled&&Wh.supportsFiber)try{ht=Wh.inject(W6),Dt=Wh}catch{}}return mu.createRoot=function(s,a){if(!r(s))throw Error(i(299));var l=!1,d="",m=pw,y=mw,k=gw;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=Yx(s,1,!1,null,null,l,d,null,m,y,k,aC),s[Fi]=a.current,Ug(s),new l_(a)},mu.hydrateRoot=function(s,a,l){if(!r(s))throw Error(i(299));var d=!1,m="",y=pw,k=mw,P=gw,X=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(k=l.onCaughtError),l.onRecoverableError!==void 0&&(P=l.onRecoverableError),l.formState!==void 0&&(X=l.formState)),a=Yx(s,1,!0,a,l??null,d,m,X,y,k,P,aC),a.context=Xx(null),l=a.current,d=ls(),d=Tt(d),m=ha(d),m.callback=null,fa(l,m,d),l=d,a.current.lanes=l,gt(a,l),ir(a),s[Fi]=a.current,Ug(s),new Uh(a)},mu.version="19.2.7",mu}var vC;function $4(){if(vC)return f_.exports;vC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),f_.exports=P4(),f_.exports}var I5=$4();var yC="popstate";function bC(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function z4(e={}){function t(i,r){let o=r.state?.masked,{pathname:u,search:h,hash:p}=o||i.location;return Uv("",{pathname:u,search:h,hash:p},r.state&&r.state.usr||null,r.state&&r.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,r){return typeof r=="string"?r:ld(r)}return F4(t,n,null,e)}function Sn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function H4(){return Math.random().toString(36).substring(2,10)}function SC(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Uv(e,t,n=null,i,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pc(t):t,state:n,key:t&&t.key||i||H4(),mask:r}}function ld({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function pc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function F4(e,t,n,i={}){let{window:r=document.defaultView,v5Compat:o=!1}=i,u=r.history,h="POP",p=null,f=g();f==null&&(f=0,u.replaceState({...u.state,idx:f},""));function g(){return(u.state||{idx:null}).idx}function _(){h="POP";let x=g(),I=x==null?null:x-f;f=x,p&&p({action:h,location:C.location,delta:I})}function b(x,I){h="PUSH";let z=bC(x)?x:Uv(C.location,x,I);f=g()+1;let U=SC(z,f),A=C.createHref(z.mask||z);try{u.pushState(U,"",A)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;r.location.assign(A)}o&&p&&p({action:h,location:C.location,delta:1})}function S(x,I){h="REPLACE";let z=bC(x)?x:Uv(C.location,x,I);f=g();let U=SC(z,f),A=C.createHref(z.mask||z);u.replaceState(U,"",A),o&&p&&p({action:h,location:C.location,delta:0})}function w(x){return U4(r,x)}let C={get action(){return h},get location(){return e(r,u)},listen(x){if(p)throw new Error("A history only accepts one active listener");return r.addEventListener(yC,_),p=x,()=>{r.removeEventListener(yC,_),p=null}},createHref(x){return t(r,x)},createURL:w,encodeLocation(x){let I=w(x);return{pathname:I.pathname,search:I.search,hash:I.hash}},push:b,replace:S,go(x){return u.go(x)}};return C}function U4(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),Sn(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:ld(t);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function B5(e,t,n="/"){return W4(e,t,n,!1)}function W4(e,t,n,i,r){let o=typeof t=="string"?pc(t):t,u=Jr(o.pathname||"/",n);if(u==null)return null;let h=q4(e),p=null,f=ij(u);for(let g=0;p==null&&g<h.length;++g)p=tj(h[g],f,i);return p}function q4(e){let t=P5(e);return G4(t),t}function P5(e,t=[],n=[],i="",r=!1){let o=(u,h,p=r,f)=>{let g={relativePath:f===void 0?u.path||"":f,caseSensitive:u.caseSensitive===!0,childrenIndex:h,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&p)return;Sn(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let _=Ks([i,g.relativePath]),b=n.concat(g);u.children&&u.children.length>0&&(Sn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),P5(u.children,t,b,_,p)),!(u.path==null&&!u.index)&&t.push({path:_,score:Q4(_,u.index),routesMeta:b})};return e.forEach((u,h)=>{if(u.path===""||!u.path?.includes("?"))o(u,h);else for(let p of $5(u.path))o(u,h,!0,p)}),t}function $5(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,r=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return r?[o,""]:[o];let u=$5(i.join("/")),h=[];return h.push(...u.map(p=>p===""?o:[o,p].join("/"))),r&&h.push(...u),h.map(p=>e.startsWith("/")&&p===""?"/":p)}function G4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ej(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var K4=/^:[\w-]+$/,V4=3,Y4=2,X4=1,Z4=10,J4=-2,wC=e=>e==="*";function Q4(e,t){let n=e.split("/"),i=n.length;return n.some(wC)&&(i+=J4),t&&(i+=Y4),n.filter(r=>!wC(r)).reduce((r,o)=>r+(K4.test(o)?V4:o===""?X4:Z4),i)}function ej(e,t){return e.length===t.length&&e.slice(0,-1).every((i,r)=>i===t[r])?e[e.length-1]-t[t.length-1]:0}function tj(e,t,n=!1){let{routesMeta:i}=e,r={},o="/",u=[];for(let h=0;h<i.length;++h){let p=i[h],f=h===i.length-1,g=o==="/"?t:t.slice(o.length)||"/",_=tp({path:p.relativePath,caseSensitive:p.caseSensitive,end:f},g),b=p.route;if(!_&&f&&n&&!i[i.length-1].route.index&&(_=tp({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!_)return null;Object.assign(r,_.params),u.push({params:r,pathname:Ks([o,_.pathname]),pathnameBase:oj(Ks([o,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(o=Ks([o,_.pathnameBase]))}return u}function tp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=nj(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let o=r[0],u=o.replace(/(.)\/+$/,"$1"),h=r.slice(1);return{params:i.reduce((f,{paramName:g,isOptional:_},b)=>{if(g==="*"){let w=h[b]||"";u=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const S=h[b];return _&&!S?f[g]=void 0:f[g]=(S||"").replace(/%2F/g,"/"),f},{}),pathname:o,pathnameBase:u,pattern:e}}function nj(e,t=!1,n=!0){Vs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,h,p,f,g)=>{if(i.push({paramName:h,isOptional:p!=null}),p){let _=g.charAt(f+u.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),i]}function ij(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Vs(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Jr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}var sj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function rj(e,t="/"){let{pathname:n,search:i="",hash:r=""}=typeof e=="string"?pc(e):e,o;return n?(n=z5(n),n.startsWith("/")?o=xC(n.substring(1),"/"):o=xC(n,t)):o=t,{pathname:o,search:lj(i),hash:cj(r)}}function xC(e,t){let n=np(t).split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function g_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function aj(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Yb(e){let t=aj(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Dp(e,t,n,i=!1){let r;typeof e=="string"?r=pc(e):(r={...e},Sn(!r.pathname||!r.pathname.includes("?"),g_("?","pathname","search",r)),Sn(!r.pathname||!r.pathname.includes("#"),g_("#","pathname","hash",r)),Sn(!r.search||!r.search.includes("#"),g_("#","search","hash",r)));let o=e===""||r.pathname==="",u=o?"/":r.pathname,h;if(u==null)h=n;else{let _=t.length-1;if(!i&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),_-=1;r.pathname=b.join("/")}h=_>=0?t[_]:"/"}let p=rj(r,h),f=u&&u!=="/"&&u.endsWith("/"),g=(o||u===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(f||g)&&(p.pathname+="/"),p}var z5=e=>e.replace(/\/\/+/g,"/"),Ks=e=>z5(e.join("/")),np=e=>e.replace(/\/+$/,""),oj=e=>np(e).replace(/^\/*/,"/"),lj=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,uj=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function dj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function hj(e){let t=e.map(n=>n.route.path).filter(Boolean);return Ks(t)||"/"}var H5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function F5(e,t){let n=e;if(typeof n!="string"||!sj.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,r=!1;if(H5)try{let o=new URL(window.location.href),u=n.startsWith("//")?new URL(o.protocol+n):new URL(n),h=Jr(u.pathname,t);u.origin===o.origin&&h!=null?n=h+u.search+u.hash:r=!0}catch{Vs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var U5=["POST","PUT","PATCH","DELETE"];new Set(U5);var fj=["GET",...U5];new Set(fj);var mc=v.createContext(null);mc.displayName="DataRouter";var Ip=v.createContext(null);Ip.displayName="DataRouterState";var W5=v.createContext(!1);function pj(){return v.useContext(W5)}var q5=v.createContext({isTransitioning:!1});q5.displayName="ViewTransition";var mj=v.createContext(new Map);mj.displayName="Fetchers";var gj=v.createContext(null);gj.displayName="Await";var ms=v.createContext(null);ms.displayName="Navigation";var kd=v.createContext(null);kd.displayName="Location";var yr=v.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Xb=v.createContext(null);Xb.displayName="RouteError";var G5="REACT_ROUTER_ERROR",_j="REDIRECT",vj="ROUTE_ERROR_RESPONSE";function yj(e){if(e.startsWith(`${G5}:${_j}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function bj(e){if(e.startsWith(`${G5}:${vj}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new uj(t.status,t.statusText,t.data)}catch{}}function Sj(e,{relative:t}={}){Sn(gc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=v.useContext(ms),{hash:r,pathname:o,search:u}=Ed(e,{relative:t}),h=o;return n!=="/"&&(h=o==="/"?n:Ks([n,o])),i.createHref({pathname:h,search:u,hash:r})}function gc(){return v.useContext(kd)!=null}function gs(){return Sn(gc(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(kd).location}var K5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function V5(e){v.useContext(ms).static||v.useLayoutEffect(e)}function _c(){let{isDataRoute:e}=v.useContext(yr);return e?Oj():wj()}function wj(){Sn(gc(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(mc),{basename:t,navigator:n}=v.useContext(ms),{matches:i}=v.useContext(yr),{pathname:r}=gs(),o=JSON.stringify(Yb(i)),u=v.useRef(!1);return V5(()=>{u.current=!0}),v.useCallback((p,f={})=>{if(Vs(u.current,K5),!u.current)return;if(typeof p=="number"){n.go(p);return}let g=Dp(p,JSON.parse(o),r,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Ks([t,g.pathname])),(f.replace?n.replace:n.push)(g,f.state,f)},[t,n,o,r,e])}v.createContext(null);function Ed(e,{relative:t}={}){let{matches:n}=v.useContext(yr),{pathname:i}=gs(),r=JSON.stringify(Yb(n));return v.useMemo(()=>Dp(e,JSON.parse(r),i,t==="path"),[e,r,i,t])}function xj(e,t){return Y5(e,t)}function Y5(e,t,n){Sn(gc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(ms),{matches:r}=v.useContext(yr),o=r[r.length-1],u=o?o.params:{},h=o?o.pathname:"/",p=o?o.pathnameBase:"/",f=o&&o.route;{let x=f&&f.path||"";Z5(h,!f||x.endsWith("*")||x.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${x}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}/*`}">.`)}let g=gs(),_;if(t){let x=typeof t=="string"?pc(t):t;Sn(p==="/"||x.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${x.pathname}" was given in the \`location\` prop.`),_=x}else _=g;let b=_.pathname||"/",S=b;if(p!=="/"){let x=p.replace(/^\//,"").split("/");S="/"+b.replace(/^\//,"").split("/").slice(x.length).join("/")}let w=n&&n.state.matches.length?n.state.matches.map(x=>Object.assign(x,{route:n.manifest[x.route.id]||x.route})):B5(e,{pathname:S});Vs(f||w!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Vs(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=Aj(w&&w.map(x=>Object.assign({},x,{params:Object.assign({},u,x.params),pathname:Ks([p,i.encodeLocation?i.encodeLocation(x.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?p:Ks([p,i.encodeLocation?i.encodeLocation(x.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathnameBase])})),r,n);return t&&C?v.createElement(kd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,..._},navigationType:"POP"}},C):C}function Cj(){let e=jj(),t=dj(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:o},"ErrorBoundary")," or"," ",v.createElement("code",{style:o},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:r},n):null,u)}var kj=v.createElement(Cj,null),X5=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=bj(e.digest);n&&(e=n)}let t=e!==void 0?v.createElement(yr.Provider,{value:this.props.routeContext},v.createElement(Xb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(Ej,{error:e},t):t}};X5.contextType=W5;var __=new WeakMap;function Ej({children:e,error:t}){let{basename:n}=v.useContext(ms);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=yj(t.digest);if(i){let r=__.get(t);if(r)throw r;let o=F5(i.location,n);if(H5&&!__.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw __.set(t,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function Tj({routeContext:e,match:t,children:n}){let i=v.useContext(mc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(yr.Provider,{value:e},n)}function Aj(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let r=e,o=i?.errors;if(o!=null){let g=r.findIndex(_=>_.route.id&&o?.[_.route.id]!==void 0);Sn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,g+1))}let u=!1,h=-1;if(n&&i){u=i.renderFallback;for(let g=0;g<r.length;g++){let _=r[g];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(h=g),_.route.id){let{loaderData:b,errors:S}=i,w=_.route.loader&&!b.hasOwnProperty(_.route.id)&&(!S||S[_.route.id]===void 0);if(_.route.lazy||w){n.isStatic&&(u=!0),h>=0?r=r.slice(0,h+1):r=[r[0]];break}}}}let p=n?.onError,f=i&&p?(g,_)=>{p(g,{location:i.location,params:i.matches?.[0]?.params??{},pattern:hj(i.matches),errorInfo:_})}:void 0;return r.reduceRight((g,_,b)=>{let S,w=!1,C=null,x=null;i&&(S=o&&_.route.id?o[_.route.id]:void 0,C=_.route.errorElement||kj,u&&(h<0&&b===0?(Z5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,x=null):h===b&&(w=!0,x=_.route.hydrateFallbackElement||null)));let I=t.concat(r.slice(0,b+1)),z=()=>{let U;return S?U=C:w?U=x:_.route.Component?U=v.createElement(_.route.Component,null):_.route.element?U=_.route.element:U=g,v.createElement(Tj,{match:_,routeContext:{outlet:g,matches:I,isDataRoute:i!=null},children:U})};return i&&(_.route.ErrorBoundary||_.route.errorElement||b===0)?v.createElement(X5,{location:i.location,revalidation:i.revalidation,component:C,error:S,children:z(),routeContext:{outlet:null,matches:I,isDataRoute:!0},onError:f}):z()},null)}function Zb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Rj(e){let t=v.useContext(mc);return Sn(t,Zb(e)),t}function Nj(e){let t=v.useContext(Ip);return Sn(t,Zb(e)),t}function Lj(e){let t=v.useContext(yr);return Sn(t,Zb(e)),t}function Jb(e){let t=Lj(e),n=t.matches[t.matches.length-1];return Sn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Mj(){return Jb("useRouteId")}function jj(){let e=v.useContext(Xb),t=Nj("useRouteError"),n=Jb("useRouteError");return e!==void 0?e:t.errors?.[n]}function Oj(){let{router:e}=Rj("useNavigate"),t=Jb("useNavigate"),n=v.useRef(!1);return V5(()=>{n.current=!0}),v.useCallback(async(r,o={})=>{Vs(n.current,K5),n.current&&(typeof r=="number"?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))},[e,t])}var CC={};function Z5(e,t,n){!t&&!CC[e]&&(CC[e]=!0,Vs(!1,n))}v.memo(Dj);function Dj({routes:e,manifest:t,future:n,state:i,isStatic:r,onError:o}){return Y5(e,void 0,{manifest:t,state:i,isStatic:r,onError:o})}function v_({to:e,replace:t,state:n,relative:i}){Sn(gc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=v.useContext(ms);Vs(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=v.useContext(yr),{pathname:u}=gs(),h=_c(),p=Dp(e,Yb(o),u,i==="path"),f=JSON.stringify(p);return v.useEffect(()=>{h(JSON.parse(f),{replace:t,state:n,relative:i})},[h,f,i,t,n]),null}function Dl(e){Sn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ij({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:r,static:o=!1,useTransitions:u}){Sn(!gc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),p=v.useMemo(()=>({basename:h,navigator:r,static:o,useTransitions:u,future:{}}),[h,r,o,u]);typeof n=="string"&&(n=pc(n));let{pathname:f="/",search:g="",hash:_="",state:b=null,key:S="default",mask:w}=n,C=v.useMemo(()=>{let x=Jr(f,h);return x==null?null:{location:{pathname:x,search:g,hash:_,state:b,key:S,mask:w},navigationType:i}},[h,f,g,_,b,S,i,w]);return Vs(C!=null,`<Router basename="${h}"> is not able to match the URL "${f}${g}${_}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:v.createElement(ms.Provider,{value:p},v.createElement(kd.Provider,{children:t,value:C}))}function Bj({children:e,location:t}){return xj(Wv(e),t)}function Wv(e,t=[]){let n=[];return v.Children.forEach(e,(i,r)=>{if(!v.isValidElement(i))return;let o=[...t,r];if(i.type===v.Fragment){n.push.apply(n,Wv(i.props.children,o));return}Sn(i.type===Dl,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Sn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let u={id:i.props.id||o.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(u.children=Wv(i.props.children,o)),n.push(u)}),n}var Tf="get",Af="application/x-www-form-urlencoded";function Bp(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Pj(e){return Bp(e)&&e.tagName.toLowerCase()==="button"}function $j(e){return Bp(e)&&e.tagName.toLowerCase()==="form"}function zj(e){return Bp(e)&&e.tagName.toLowerCase()==="input"}function Hj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Fj(e,t){return e.button===0&&(!t||t==="_self")&&!Hj(e)}var qh=null;function Uj(){if(qh===null)try{new FormData(document.createElement("form"),0),qh=!1}catch{qh=!0}return qh}var Wj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function y_(e){return e!=null&&!Wj.has(e)?(Vs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Af}"`),null):e}function qj(e,t){let n,i,r,o,u;if($j(e)){let h=e.getAttribute("action");i=h?Jr(h,t):null,n=e.getAttribute("method")||Tf,r=y_(e.getAttribute("enctype"))||Af,o=new FormData(e)}else if(Pj(e)||zj(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||h.getAttribute("action");if(i=p?Jr(p,t):null,n=e.getAttribute("formmethod")||h.getAttribute("method")||Tf,r=y_(e.getAttribute("formenctype"))||y_(h.getAttribute("enctype"))||Af,o=new FormData(h,e),!Uj()){let{name:f,type:g,value:_}=e;if(g==="image"){let b=f?`${f}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else f&&o.append(f,_)}}else{if(Bp(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Tf,i=null,r=Af,u=e}return o&&r==="text/plain"&&(u=o,o=void 0),{action:i,method:n.toLowerCase(),encType:r,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Qb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function J5(e,t,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${i}`:r.pathname=`${r.pathname}.${i}`:r.pathname==="/"?r.pathname=`_root.${i}`:t&&Jr(r.pathname,t)==="/"?r.pathname=`${np(t)}/_root.${i}`:r.pathname=`${np(r.pathname)}.${i}`,r}async function Gj(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Kj(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Vj(e,t,n){let i=await Promise.all(e.map(async r=>{let o=t.routes[r.route.id];if(o){let u=await Gj(o,n);return u.links?u.links():[]}return[]}));return Jj(i.flat(1).filter(Kj).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function kC(e,t,n,i,r,o){let u=(p,f)=>n[f]?p.route.id!==n[f].route.id:!0,h=(p,f)=>n[f].pathname!==p.pathname||n[f].route.path?.endsWith("*")&&n[f].params["*"]!==p.params["*"];return o==="assets"?t.filter((p,f)=>u(p,f)||h(p,f)):o==="data"?t.filter((p,f)=>{let g=i.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(u(p,f)||h(p,f))return!0;if(p.route.shouldRevalidate){let _=p.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function Yj(e,t,{includeHydrateFallback:n}={}){return Xj(e.map(i=>{let r=t.routes[i.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o}).flat(1))}function Xj(e){return[...new Set(e)]}function Zj(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function Jj(e,t){let n=new Set;return new Set(t),e.reduce((i,r)=>{let o=JSON.stringify(Zj(r));return n.has(o)||(n.add(o),i.push({key:o,link:r})),i},[])}function e0(){let e=v.useContext(mc);return Qb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Qj(){let e=v.useContext(Ip);return Qb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var t0=v.createContext(void 0);t0.displayName="FrameworkContext";function n0(){let e=v.useContext(t0);return Qb(e,"You must render this element inside a <HydratedRouter> element"),e}function eO(e,t){let n=v.useContext(t0),[i,r]=v.useState(!1),[o,u]=v.useState(!1),{onFocus:h,onBlur:p,onMouseEnter:f,onMouseLeave:g,onTouchStart:_}=t,b=v.useRef(null);v.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=I=>{I.forEach(z=>{u(z.isIntersecting)})},x=new IntersectionObserver(C,{threshold:.5});return b.current&&x.observe(b.current),()=>{x.disconnect()}}},[e]),v.useEffect(()=>{if(i){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[i]);let S=()=>{r(!0)},w=()=>{r(!1),u(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:gu(h,S),onBlur:gu(p,w),onMouseEnter:gu(f,S),onMouseLeave:gu(g,w),onTouchStart:gu(_,S)}]:[!1,b,{}]}function gu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tO({page:e,...t}){let n=pj(),{router:i}=e0(),r=v.useMemo(()=>B5(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?n?v.createElement(iO,{page:e,matches:r,...t}):v.createElement(sO,{page:e,matches:r,...t}):null}function nO(e){let{manifest:t,routeModules:n}=n0(),[i,r]=v.useState([]);return v.useEffect(()=>{let o=!1;return Vj(e,t,n).then(u=>{o||r(u)}),()=>{o=!0}},[e,t,n]),i}function iO({page:e,matches:t,...n}){let i=gs(),{future:r}=n0(),{basename:o}=e0(),u=v.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let h=J5(e,o,r.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?p=!0:f.push(g.route.id);return p&&f.length>0&&h.searchParams.set("_routes",f.join(",")),[h.pathname+h.search]},[o,r.v8_trailingSlashAwareDataRequests,e,i,t]);return v.createElement(v.Fragment,null,u.map(h=>v.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...n})))}function sO({page:e,matches:t,...n}){let i=gs(),{future:r,manifest:o,routeModules:u}=n0(),{basename:h}=e0(),{loaderData:p,matches:f}=Qj(),g=v.useMemo(()=>kC(e,t,f,o,i,"data"),[e,t,f,o,i]),_=v.useMemo(()=>kC(e,t,f,o,i,"assets"),[e,t,f,o,i]),b=v.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,x=!1;if(t.forEach(z=>{let U=o.routes[z.route.id];!U||!U.hasLoader||(!g.some(A=>A.route.id===z.route.id)&&z.route.id in p&&u[z.route.id]?.shouldRevalidate||U.hasClientLoader?x=!0:C.add(z.route.id))}),C.size===0)return[];let I=J5(e,h,r.v8_trailingSlashAwareDataRequests,"data");return x&&C.size>0&&I.searchParams.set("_routes",t.filter(z=>C.has(z.route.id)).map(z=>z.route.id).join(",")),[I.pathname+I.search]},[h,r.v8_trailingSlashAwareDataRequests,p,i,o,g,t,e,u]),S=v.useMemo(()=>Yj(_,o),[_,o]),w=nO(_);return v.createElement(v.Fragment,null,b.map(C=>v.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...n})),S.map(C=>v.createElement("link",{key:C,rel:"modulepreload",href:C,...n})),w.map(({key:C,link:x})=>v.createElement("link",{key:C,nonce:n.nonce,...x,crossOrigin:x.crossOrigin??n.crossOrigin})))}function rO(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var aO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{aO&&(window.__reactRouterVersion="7.17.0")}catch{}function oO({basename:e,children:t,useTransitions:n,window:i}){let r=v.useRef();r.current==null&&(r.current=z4({window:i,v5Compat:!0}));let o=r.current,[u,h]=v.useState({action:o.action,location:o.location}),p=v.useCallback(f=>{n===!1?h(f):v.startTransition(()=>h(f))},[n]);return v.useLayoutEffect(()=>o.listen(p),[o,p]),v.createElement(Ij,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,useTransitions:n})}var Q5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cd=v.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:r,reloadDocument:o,replace:u,mask:h,state:p,target:f,to:g,preventScrollReset:_,viewTransition:b,defaultShouldRevalidate:S,...w},C){let{basename:x,navigator:I,useTransitions:z}=v.useContext(ms),U=typeof g=="string"&&Q5.test(g),A=F5(g,x);g=A.to;let O=Sj(g,{relative:r}),R=gs(),$=null;if(h){let j=Dp(h,[],R.mask?R.mask.pathname:"/",!0);x!=="/"&&(j.pathname=j.pathname==="/"?x:Ks([x,j.pathname])),$=I.createHref(j)}let[H,J,Z]=eO(i,w),K=dO(g,{replace:u,mask:h,state:p,target:f,preventScrollReset:_,relative:r,viewTransition:b,defaultShouldRevalidate:S,useTransitions:z});function M(j){t&&t(j),j.defaultPrevented||K(j)}let N=!(A.isExternal||o),D=v.createElement("a",{...w,...Z,href:(N?$:void 0)||A.absoluteURL||O,onClick:N?M:t,ref:rO(C,J),target:f,"data-discover":!U&&n==="render"?"true":void 0});return H&&!U?v.createElement(v.Fragment,null,D,v.createElement(tO,{page:O})):D});cd.displayName="Link";var lO=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:r=!1,style:o,to:u,viewTransition:h,children:p,...f},g){let _=Ed(u,{relative:f.relative}),b=gs(),S=v.useContext(Ip),{navigator:w,basename:C}=v.useContext(ms),x=S!=null&&gO(_)&&h===!0,I=w.encodeLocation?w.encodeLocation(_).pathname:_.pathname,z=b.pathname,U=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;n||(z=z.toLowerCase(),U=U?U.toLowerCase():null,I=I.toLowerCase()),U&&C&&(U=Jr(U,C)||U);const A=I!=="/"&&I.endsWith("/")?I.length-1:I.length;let O=z===I||!r&&z.startsWith(I)&&z.charAt(A)==="/",R=U!=null&&(U===I||!r&&U.startsWith(I)&&U.charAt(I.length)==="/"),$={isActive:O,isPending:R,isTransitioning:x},H=O?t:void 0,J;typeof i=="function"?J=i($):J=[i,O?"active":null,R?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let Z=typeof o=="function"?o($):o;return v.createElement(cd,{...f,"aria-current":H,className:J,ref:g,style:Z,to:u,viewTransition:h},typeof p=="function"?p($):p)});lO.displayName="NavLink";var cO=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:r,state:o,method:u=Tf,action:h,onSubmit:p,relative:f,preventScrollReset:g,viewTransition:_,defaultShouldRevalidate:b,...S},w)=>{let{useTransitions:C}=v.useContext(ms),x=pO(),I=mO(h,{relative:f}),z=u.toLowerCase()==="get"?"get":"post",U=typeof h=="string"&&Q5.test(h),A=O=>{if(p&&p(O),O.defaultPrevented)return;O.preventDefault();let R=O.nativeEvent.submitter,$=R?.getAttribute("formmethod")||u,H=()=>x(R||O.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:r,state:o,relative:f,preventScrollReset:g,viewTransition:_,defaultShouldRevalidate:b});C&&n!==!1?v.startTransition(()=>H()):H()};return v.createElement("form",{ref:w,method:z,action:I,onSubmit:i?p:A,...S,"data-discover":!U&&e==="render"?"true":void 0})});cO.displayName="Form";function uO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function eT(e){let t=v.useContext(mc);return Sn(t,uO(e)),t}function dO(e,{target:t,replace:n,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:h,defaultShouldRevalidate:p,useTransitions:f}={}){let g=_c(),_=gs(),b=Ed(e,{relative:u});return v.useCallback(S=>{if(Fj(S,t)){S.preventDefault();let w=n!==void 0?n:ld(_)===ld(b),C=()=>g(e,{replace:w,mask:i,state:r,preventScrollReset:o,relative:u,viewTransition:h,defaultShouldRevalidate:p});f?v.startTransition(()=>C()):C()}},[_,g,b,n,i,r,t,e,o,u,h,p,f])}var hO=0,fO=()=>`__${String(++hO)}__`;function pO(){let{router:e}=eT("useSubmit"),{basename:t}=v.useContext(ms),n=Mj(),i=e.fetch,r=e.navigate;return v.useCallback(async(o,u={})=>{let{action:h,method:p,encType:f,formData:g,body:_}=qj(o,t);if(u.navigate===!1){let b=u.fetcherKey||fO();await i(b,n,u.action||h,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:_,formMethod:u.method||p,formEncType:u.encType||f,flushSync:u.flushSync})}else await r(u.action||h,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:_,formMethod:u.method||p,formEncType:u.encType||f,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[i,r,t,n])}function mO(e,{relative:t}={}){let{basename:n}=v.useContext(ms),i=v.useContext(yr);Sn(i,"useFormAction must be used inside a RouteContext");let[r]=i.matches.slice(-1),o={...Ed(e||".",{relative:t})},u=gs();if(e==null){o.search=u.search;let h=new URLSearchParams(o.search),p=h.getAll("index");if(p.some(g=>g==="")){h.delete("index"),p.filter(_=>_).forEach(_=>h.append("index",_));let g=h.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&r.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Ks([n,o.pathname])),ld(o)}function gO(e,{relative:t}={}){let n=v.useContext(q5);Sn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=eT("useViewTransitionState"),r=Ed(e,{relative:t});if(!n.isTransitioning)return!1;let o=Jr(n.currentLocation.pathname,i)||n.currentLocation.pathname,u=Jr(n.nextLocation.pathname,i)||n.nextLocation.pathname;return tp(r.pathname,u)!=null||tp(r.pathname,o)!=null}const _O=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];let hn=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function EC(e){return(await tT(e)).theaters}async function tT(e){const t=await fetch("/api/v1/theaters",{signal:e});await hi(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new hn(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>s0(i,t.status))}}async function vO(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await hi(i),RO(await i.json(),i.status)}async function yO(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await hi(t),NO(await t.json(),t.status)}async function bO(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const n=t.size>0?`?${t}`:"",i=await fetch(`/api/v1/updates/release-notes${n}`,{signal:e.signal});return await hi(i),MO(await i.json(),i.status)}async function SO(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await hi(t),LO(await t.json(),t.status)}async function nT(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await hi(n);const i=await n.json();return s0(i,n.status)}async function wO(e,t,n){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:t}),signal:n});return await hi(i),s0(await i.json(),i.status)}async function xO(e,t){const n=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await hi(n),BO(await n.json(),n.status)}async function iT(e,t){const n=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await hi(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new hn(n.status,"Invalid folder grant response");return i.folderGrantId}async function CO(e,t){const n=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e}),signal:t});return await hi(n),await n.json()}async function kO(e,t,n){const i=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,name:t}),signal:n});return await hi(i),await i.json()}async function EO(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await hi(n)}async function Qi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await hi(i);const r=await i.json();if(!Array.isArray(r.operations))throw new hn(i.status,"Invalid operations response");return r.operations.map(o=>rT(o,i.status))}async function ko(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await hi(i);const r=await i.json();if(!Array.isArray(r.groups))throw new hn(i.status,"Invalid groups response");return r.groups.map(o=>i0(o,i.status))}async function TO(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await hi(n);const i=await n.json();return i0(i.group,n.status)}async function b_(e,t,n){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await hi(i);const r=await i.json();return i0(r.group,i.status)}async function AO(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await hi(n)}async function sT(e,t,n){return Rf(e,{title:t},n)}async function Rf(e,t,n){const i=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:n});await hi(i);const r=await i.json();return rT(r.operation,i.status)}function rT(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||ud(n)||ud(n.payload))throw new hn(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,accent:typeof n.accent=="string"?n.accent:null,groupId:n.groupId===null?null:typeof n.groupId=="string"?n.groupId:void 0,ts:n.ts}}function i0(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.name!="string"||typeof n.color!="string"||typeof n.order!="number"||typeof n.createdAt!="number")throw new hn(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function s0(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string"||typeof n.createdAt!="string"||typeof n.lastOpenedAt!="string"||typeof n.hasWiki!="boolean"||typeof n.activeAdmiralCount!="number"||ud(n))throw new hn(t,"Invalid Theater response");return{id:n.id,label:n.label,createdAt:n.createdAt,lastOpenedAt:n.lastOpenedAt,...typeof n.order=="number"&&Number.isInteger(n.order)&&n.order>=0?{order:n.order}:{},hasWiki:n.hasWiki,activeAdmiralCount:n.activeAdmiralCount}}function RO(e,t){const n=e;if(!n||typeof n.workspaces!="number"||typeof n.version!="string"||n.channel!=="stable"&&n.channel!=="local"&&n.channel!=="unknown"||typeof n.updateAvailable!="boolean"||typeof n.port!="number"||n.portMode!=="dynamic"&&n.portMode!=="static"||n.requestedPort!==null&&typeof n.requestedPort!="number"||typeof n.effectivePort!="number"||typeof n.portHonored!="boolean"||n.wikiServerStatus!=="available"&&n.wikiServerStatus!=="unavailable"&&n.wikiServerStatus!=="unknown")throw new hn(t,"Invalid status response");return{workspaces:n.workspaces,version:n.version,channel:n.channel,updateAvailable:n.updateAvailable,latestVersion:typeof n.latestVersion=="string"?n.latestVersion:void 0,port:n.port,portMode:n.portMode,requestedPort:n.requestedPort,effectivePort:n.effectivePort,portHonored:n.portHonored,wikiServerStatus:n.wikiServerStatus}}function NO(e,t){const n=e;if(!n||n.channel!=="local"||typeof n.version!="string"||typeof n.effectivePort!="number"||typeof n.dataDir!="string"||typeof n.lockFile!="string"||Object.keys(n).length!==5)throw new hn(t,"Invalid environment response");return n}function LO(e,t){const n=e;if(!n||n.status!=="accepted")throw new hn(t,"Invalid update response");return{status:"accepted"}}function MO(e,t){const n=e;if(!n||!Array.isArray(n.notes)||n.sourceRef!=="main"||typeof n.fetchedAt!="number"||typeof n.stale!="boolean"||"url"in n||"token"in n||"path"in n)throw new hn(t,"Invalid release notes response");return{notes:n.notes.map(i=>jO(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function jO(e,t){const n=e;if(!n||typeof n.version!="string"||n.date!==null&&typeof n.date!="string"||!Array.isArray(n.sections)||typeof n.localizationFallback!="boolean")throw new hn(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>OO(i,t)),localizationFallback:n.localizationFallback}}function OO(e,t){const n=e;if(!n||n.heading!=="Added"&&n.heading!=="Changed"&&n.heading!=="Fixed"&&n.heading!=="Removed"&&n.heading!=="Breaking Changes"||!Array.isArray(n.items))throw new hn(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>DO(i,t))}}function DO(e,t){const n=e;if(!n||!Array.isArray(n.packageTags)||!n.packageTags.every(i=>typeof i=="string")||typeof n.text!="string"||"product"in n&&!IO(n.product))throw new hn(t,"Invalid release notes response");return"product"in n?{packageTags:n.packageTags,text:n.text,product:n.product}:{packageTags:n.packageTags,text:n.text}}function IO(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function BO(e,t){const n=e;if(!n||typeof n.path!="string"||n.parentPath!==null&&typeof n.parentPath!="string"||!Array.isArray(n.roots)||!Array.isArray(n.entries)||ud(n))throw new hn(t,"Invalid folder list response");return{path:n.path,parentPath:n.parentPath??null,roots:n.roots.filter(i=>typeof i=="string"),entries:n.entries.map(i=>PO(i,t)),truncated:n.truncated===!0?!0:void 0}}function PO(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||ud(n))throw new hn(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function ud(e){if(!e||typeof e!="object")return!1;const t=e;return _O.some(n=>n in t)}async function hi(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const n=await e.json();typeof n.error=="string"?t=n.error:typeof n.message=="string"&&(t=n.message)}catch{}throw new hn(e.status,t)}const $O=200,zO=.5,HO="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",FO=["monospace","serif","sans-serif"],Fu=new Map;function UO(e,t={}){const n=Pp(e);if(!n)return!1;const i=n.toLocaleLowerCase(),r=Fu.get(i);if(r!==void 0)return r;const o=t.document??globalThis.document;if(!o)return!1;const u=o.createElement("canvas").getContext("2d");if(!u)return!1;const h=FO.some(p=>{const f=TC(u,`${aT(n)}, ${p}`),g=TC(u,p);return Math.abs(f-g)>zO});return WO(i,h,t.maxEntries??$O),h}function aT(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function ip(e,t){const n=Pp(e);return n?`${aT(n)}, ${t}`:t}function Pp(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function TC(e,t){return e.font=`28px ${t}`,e.measureText(HO).width}function WO(e,t,n){if(Fu.size>=Math.max(1,n)){const i=Fu.keys().next().value;i&&Fu.delete(i)}Fu.set(e,t)}const Vl={min:12,max:18,step:1,defaultValue:14},td={source:"builtin",id:"manrope",size:Vl.defaultValue},sp=[{id:"manrope",label:"Fleet UI",name:"Manrope",description:"Balanced · Fleet default",family:'"Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Manrope","Fleet UI"]},{id:"jetbrains-mono",label:"Instrument Mono",name:"JetBrains Mono",description:"Uniform · technical scan",family:'"JetBrains Mono Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["JetBrains Mono","Instrument Mono"]},{id:"source-code-pro",label:"Source Mono",name:"Source Code Pro",description:"Open forms · compact",family:'"Source Code Pro Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Source Code Pro","Source Mono"]}];function qO(e){if(!e||typeof e!="object")return td;const t=e,n=GO(t.size);if(t.source==="builtin"&&VO(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Pp(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return td}function GO(e){return typeof e!="number"||!Number.isInteger(e)||e<Vl.min||e>Vl.max?Vl.defaultValue:e}function oT(e){return e.source==="system"?ip(e.familyName,sp[0].family):KO(e.id).family}function KO(e){return sp.find(t=>t.id===e)??sp[0]}function VO(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}async function lT(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await cT(t),uT(await t.json(),t.status)}async function YO(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await cT(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new hn(n.status,"Invalid global settings mutation response");return{state:uT(i.state,n.status)}}async function cT(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new hn(e.status,t)}function uT(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!XO(n.consoleStaticPort)||typeof n.reducePanelMotion!="boolean"||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!ZO(n.language))throw new hn(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,reducePanelMotion:n.reducePanelMotion,theme:n.theme,uiFont:qO(n.uiFont),language:n.language}}function XO(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function ZO(e){return e==="auto"||e==="en"||e==="ko"}const qv=new Set;let dd={loading:!1,state:null,savingField:null,error:null};function r0(){return v.useSyncExternalStore(dT,ic,ic)}function ic(){return dd}function JO(e){jo({loading:!1,state:e,error:null})}function dT(e){return qv.add(e),()=>{qv.delete(e)}}async function QO(e){jo({loading:!0,error:null});try{const t=await lT(e);jo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;jo({loading:!1,error:hT(t)})}}async function Va(e,t){if(dd.savingField!==null)return!1;const n=dd.state,i=n?{...n,[e]:t}:null;jo({state:i,savingField:e,error:null});try{const r=await YO({[e]:t});return jo({state:r.state,savingField:null,error:null}),!0}catch(r){return jo({state:n,savingField:null,error:hT(r)}),!1}}function jo(e){dd={...dd,...e};for(const t of qv)t()}function hT(e){return e instanceof Error?e.message:String(e)}const eD="fleet-console.canvas.",fT="fleet-console.formation-layout",tD=400,Gv=640,Kv=400,AC=40,nD=320,iD=200,sD=8,rD=0,RC=96,aD=.25,oD=1,S_=.2,NC=.5,lD=.001,Fl={x:0,y:0,zoom:1},Yl={viewport:Fl,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Vv=new Set,Yv=new Set,Xv=new Set,Zv=new Set,Jv=new Set,Ys=new Map,sc=new Map;let Ut=null,qa=null,rt=Yl,cn=null,pT=0,Oo={},es=!1,a0=LD(),Ha=Fl,Do=null,rp=0;function o0(e){return Vv.add(e),()=>{Vv.delete(e)}}function ur(){return rt}function cD(e){return Ut===e?rt:f0(e)}function fr(){return cn?.mode==="maximized"?cn.operationId:null}function Ds(){return cn?.mode==="companion"?cn.operationId:null}function LC(){return pT}function uD(e){const t=Ut===e?cn:Ys.get(e)??null;return t?.mode==="companion"?t.operationId:null}function ap(){return es}function MC(){return a0}function mT(){return Ut}function l0(){return v.useSyncExternalStore(o0,ur,ur)}function gT(){return v.useSyncExternalStore(ET,fr,fr)}function _T(){return v.useSyncExternalStore(ET,Ds,Ds)}function dD(e){const t=v.useSyncExternalStore(kD,OC,OC);return e===null?{}:t[e]??{}}function hD(e,t,n){const i=Oo[e]??{};i[t]!==n&&(Oo={...Oo,[e]:{...i,[t]:n}},TT())}function $p(){return v.useSyncExternalStore(xD,ap,ap)}function vT(){return v.useSyncExternalStore(CD,MC,MC)}function yT(){return v.useSyncExternalStore(o0,DC,DC)}function ts(e){rt={viewport:e.viewport??rt.viewport,operations:e.operations??rt.operations,operationOrder:e.operationOrder??rt.operationOrder,operationAccent:e.operationAccent??rt.operationAccent,minimized:e.minimized??rt.minimized,collapsedGroups:e.collapsedGroups??rt.collapsedGroups},AD(),u0()}function bT(e){const t=rt.collapsedGroups.includes(e)?rt.collapsedGroups.filter(n=>n!==e):[...rt.collapsedGroups,e];ts({collapsedGroups:t})}function fD(e,t){if(Ut===e){bT(t);return}const n=f0(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(r=>r!==t):[...n.collapsedGroups,t];p0(e,{...n,collapsedGroups:i}),rt={...rt},u0()}function pD(){return v.useSyncExternalStore(o0,IC,IC)}function Qv(e){d0();const t=m0(e);Ha=t,ts({viewport:t})}function ST(e){const t=m0(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||LT()){Qv(t);return}Ha=t,Do===null&&(Do=window.requestAnimationFrame(NT))}function ey(e,t){const n=Ho();ts({operations:{...rt.operations,[e]:{...g0(t,n),zIndex:n}}})}function mD(e,t,n=nD,i=iD,r=sD,o=rD,u="grid"){if(!Number.isFinite(t)||t<=0)return[];const h=Math.max(0,e.width-o*2),p=Math.max(0,e.height-o*2);if(u==="columns"){const C=Math.max(0,h-r*(t-1)),x=C/t,I=Math.min(n,x),z=Math.min(Math.max(I,x),C),U=p,A=Math.min(i,U),O=Math.min(Math.max(A,U),p);return Array.from({length:t},(R,$)=>({x:e.x+o+$*(z+r),y:e.y+o,width:z,height:O}))}if(u==="rows"){const C=h,x=Math.min(n,C),I=Math.min(Math.max(x,C),h),z=Math.max(0,p-r*(t-1)),U=z/t,A=Math.min(i,U),O=Math.min(Math.max(A,U),z);return Array.from({length:t},(R,$)=>({x:e.x+o,y:e.y+o+$*(O+r),width:I,height:O}))}const f=Math.ceil(Math.sqrt(t)),g=Math.ceil(t/f),_=Math.max(0,p-r*(g-1)),b=_/g,S=Math.min(i,b),w=Math.min(Math.max(S,b),_);return Array.from({length:t},(C,x)=>{const I=Math.floor(x/f),z=x%f,U=I===g-1?t-(g-1)*f:f,A=Math.max(0,h-r*(U-1)),O=A/U,R=Math.min(n,O),$=Math.min(Math.max(R,O),A);return{x:e.x+o+z*($+r),y:e.y+o+I*(w+r),width:$,height:w}})}function wT(e){rt.minimized.includes(e)||(fr()===e&&Ya(),Ds()===e&&Xs(),ts({minimized:[...rt.minimized,e]}))}function gD(e){const t=new Set,i=[...rt.minimized.filter(u=>t.has(u)||!(u in rt.operations)?!1:(t.add(u),!0)),...e.filter(u=>t.has(u)||!(u in rt.operations)?!1:(t.add(u),!0))];if(RT(rt.minimized,i))return;const r=fr(),o=Ds();r&&i.includes(r)&&Ya(),o&&i.includes(o)&&Xs(),ts({minimized:i})}function ty(e){if(!rt.minimized.includes(e))return;fr()===e&&Ya();const t=rt.minimized.filter(r=>r!==e),n=rt.operations[e];if(!n){ts({minimized:t});return}const i=Ho();ts({minimized:t,operations:{...rt.operations,[e]:{...n,zIndex:i}}})}function w_(e){ts({operationOrder:jT(e)})}function Ho(){return rp+=1,rp}function _D(e){const t=rt.operations[e];if(t)return t;const n=Object.keys(rt.operations).length,i={x:n*AC,y:n*AC,width:Gv,height:Kv,zIndex:Ho()};return ts({operations:{...rt.operations,[e]:i}}),i}function vD(e){const t=new Set(e),n={};let i=!1;for(const[b,S]of Object.entries(rt.operations))t.has(b)?n[b]=S:i=!0;const r=rt.minimized.filter(b=>t.has(b)),o=r.length!==rt.minimized.length,u=rt.operationOrder.filter(b=>t.has(b)),h=u.length!==rt.operationOrder.length,p=Object.fromEntries(Object.entries(rt.operationAccent).filter(([b])=>t.has(b))),f=Object.keys(p).length!==Object.keys(rt.operationAccent).length,g=fr(),_=Ds();g&&(!t.has(g)||r.includes(g))&&Ya(),_&&r.includes(_)&&Xs(),(i||o||h||f)&&ts({operations:n,minimized:r,operationOrder:u,operationAccent:p})}function yD(e){RD(),d0(),TD(),Ut=e,rt=e?f0(e):Yl;const t=e?Ys.get(e)??null:null,n=!AT(cn,t);cn=t;const i=e?sc.has(e):!1,r=es!==i;es=i,Ha=rt.viewport,rp=Math.max(rp,OT(rt.operations)),u0(),n&&Td(),r&&rc()}function bD(e,t){const n=rt.operations[e];if(!n)return;const i=Math.max(aD,Math.min(oD,Math.min((t.width-RC)/n.width,(t.height-RC)/n.height))),r={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};d0(),Ha=r;const o=Ho(),u=rt.minimized.includes(e);ts({viewport:r,operations:{...rt.operations,[e]:{...g0(n,o),zIndex:o}},...u?{minimized:rt.minimized.filter(h=>h!==e)}:{}})}function c0(e){const t={mode:"maximized",operationId:e};Ut&&Ys.set(Ut,t),CT(t)}function Ya(){Ut&&Ys.get(Ut)?.mode==="maximized"&&Ys.delete(Ut),cn?.mode==="maximized"&&(cn=null,Td())}function xT(e){zp(e);const t=cn?.mode==="companion"?cn.returnTo:cn?.mode==="maximized"?"maximized":"underlay";CT({mode:"companion",operationId:e,returnTo:t})}function CT(e){cn?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===cn.operationId)&&zp(cn.operationId);const t=rt.minimized.filter(r=>r!==e.operationId),n=!RT(rt.minimized,t),i=!AT(cn,e);i&&(cn=e),i&&Ut&&Ys.set(Ut,e),n&&ts({minimized:t}),i&&Td()}function SD(){if(cn?.mode!=="companion")return;const e=cn;cn=e.returnTo==="maximized"&&e.operationId in rt.operations&&!rt.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,Ut&&(cn?Ys.set(Ut,cn):Ys.delete(Ut)),zp(e.operationId),Td()}function Xs(){if(cn?.mode!=="companion")return;const e=cn.operationId;cn=null,Ut&&Ys.delete(Ut),zp(e),Td()}function wD(){if(Ut){if(Ds()!==null){Xs(),es||(sc.set(Ut,!0),es=!0,rc());return}if(es){kT();return}Ya(),Xs(),sc.set(Ut,!0),es=!0,rc()}}function x_(e){if(Ut){if(Ds()!==null){jC(e),Xs(),es||(sc.set(Ut,!0),es=!0,rc());return}if(es&&a0===e){kT();return}jC(e),es||(Ya(),Xs(),sc.set(Ut,!0),es=!0,rc())}}function kT(){Ut&&sc.delete(Ut),es&&(es=!1,rc())}function jC(e){a0=e,MD(e),ED()}function xD(e){return Zv.add(e),()=>{Zv.delete(e)}}function CD(e){return Jv.add(e),()=>{Jv.delete(e)}}function u0(){for(const e of Vv)e()}function ET(e){return Yv.add(e),()=>{Yv.delete(e)}}function kD(e){return Xv.add(e),()=>{Xv.delete(e)}}function OC(){return Oo}function TT(){for(const e of Xv)e()}function zp(e){if(!(e in Oo))return;const t={...Oo};delete t[e],Oo=t,TT()}function rc(){for(const e of Zv)e()}function ED(){for(const e of Jv)e()}function DC(){return rt.minimized}function IC(){return rt.collapsedGroups}function Td(){pT+=1;for(const e of Yv)e()}function TD(){Ut&&(cn?Ys.set(Ut,cn):Ys.delete(Ut))}function AT(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function RT(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function NT(){const e=rt.viewport,t=Ha.x-e.x,n=Ha.y-e.y,i=Ha.zoom-e.zoom;if(Math.abs(t)<NC&&Math.abs(n)<NC&&Math.abs(i)<lD){Do=null,ts({viewport:Ha});return}ts({viewport:{x:e.x+t*S_,y:e.y+n*S_,zoom:e.zoom+i*S_}}),Do=typeof window<"u"?window.requestAnimationFrame(NT):null}function d0(){Do===null||typeof window>"u"||(window.cancelAnimationFrame(Do),Do=null)}function LT(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function h0(){return ic().state?.reducePanelMotion===!0||LT()}function AD(){!Ut||typeof window>"u"||(ND(),qa=window.setTimeout(()=>{qa=null,p0(Ut,rt)},tD))}function RD(){!qa||!Ut||typeof window>"u"||(window.clearTimeout(qa),qa=null,p0(Ut,rt))}function ND(){!qa||typeof window>"u"||(window.clearTimeout(qa),qa=null)}function f0(e){if(typeof window>"u")return Yl;try{const t=window.localStorage.getItem(MT(e));if(!t)return Yl;const n=JSON.parse(t);return jD(n)}catch{return Yl}}function p0(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(MT(e),JSON.stringify(t))}catch{}}function LD(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(fT);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function MD(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fT,e)}catch{}}function MT(e){return`${eD}${e}`}function jD(e){if(!ac(e))return Yl;const t=ID(e.operations);return{viewport:m0(e.viewport),operations:t,operationOrder:jT(e.operationOrder),operationAccent:OD(e.operationAccent),minimized:DD(e.minimized,t),collapsedGroups:PD(e.collapsedGroups)}}function jT(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}function OD(e){if(!ac(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function DD(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const r of e)typeof r!="string"||n.has(r)||!(r in t)||(n.add(r),i.push(r));return i}function m0(e){if(!ac(e))return Fl;const t=nd(e.x,Fl.x),n=nd(e.y,Fl.y),i=ny(e.zoom,Fl.zoom);return{x:t,y:n,zoom:i}}function ID(e){if(!ac(e))return{};const t={};for(const[n,i]of Object.entries(e))ac(i)&&(t[n]=g0(i,BD(t)));return t}function g0(e,t){return ac(e)?{x:nd(e.x,0),y:nd(e.y,0),width:ny(e.width,Gv),height:ny(e.height,Kv),zIndex:nd(e.zIndex,t)}:{x:0,y:0,width:Gv,height:Kv,zIndex:t}}function BD(e){return OT(e)+1}function OT(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function nd(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function ny(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function ac(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function PD(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}const $D="__unassigned__";function zD(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(UD(i,t.get(i.theaterId)));return n}function HD(e,t){const n=_0(t);return n.length===0?e:e.filter(i=>{const r=WD(i);return n.every(o=>r.includes(o))})}function FD(e){const t=[],n=new Map;for(const i of e){const r=i.theaterId??$D,o=n.get(r);if(o!==void 0){const u=t[o];u&&(t[o]={...u,entries:[...u.entries,i]});continue}n.set(r,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function _0(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function UD(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function WD(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const iy="fleet-console.activeTheaterId",DT="fleet-console.commissioningSeen",IT="fleet-console.whatsNewSeenVersion",BT="fleet-console.notificationPreferences",PT=1,qD="instrument",Gh={globalMute:!1,dnd:!1,mutedTheaterIds:{}},sy=new Set;let BC=0,ry=null,Xe={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:qD,version:"",updateAvailable:!1,latestVersion:null,portMode:"dynamic",requestedPort:null,effectivePort:0,portHonored:!0,theaters:[],operations:[],operationsHydrated:!1,groups:[],activeTheaterId:null,activeOperationId:null,operationStatus:{},addingTheater:!1,theaterError:null,operationsViewActive:!1,operationSearchOpen:!1,whatsNewOpen:!1,releaseNotes:[],releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:null,releaseNotesFetchedAt:null,releaseNotesStale:!1,automaticWhatsNewVersion:null,selectedReleaseNoteKey:null,onboardingOpen:!1,bootstrapped:!1,pendingOperationFocus:null,keyboardFocusRequest:null,pendingSideBarAddTheater:!1,pendingSideBarTheaterLaunch:null,launchMenuRequest:null,keyboardShortcutsOpen:!1,operationNotifications:{},notificationPreferences:EI(),codexReader:null,codexReaderExpanded:!1};function Fo(){return Xe}function $T(e){return sy.add(e),()=>{sy.delete(e)}}function ct(e){Xe={...Xe,...e},wI()}function GD(e){Xe.operationsViewActive!==e&&ct({operationsViewActive:e})}function oc(e){ZD(e),ct({activeTheme:e})}function ay(e){QD(e)}function KD(e){ct({channel:e.channel,version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...KT({...Xe,version:e.version})})}function VD(){ct({releaseNotesLoading:!0,releaseNotesError:null})}function YD(e){const t={...Xe,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Xe.selectedReleaseNoteKey&&YT(e.notes,Xe.selectedReleaseNoteKey)?Xe.selectedReleaseNoteKey:VT(e.notes)};ct({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...KT(t)})}function XD(e){ct({releaseNotesLoading:!1,releaseNotesError:e})}function ZD(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function JD(){if(!(typeof document>"u"||typeof navigator>"u")&&navigator.userAgent.includes("Electron")){document.documentElement.setAttribute("data-desktop-shell","true");const e=navigator.userAgent.includes("Windows")?"win32":navigator.userAgent.includes("Mac OS X")?"darwin":"linux";document.documentElement.setAttribute("data-desktop-platform",e)}}function QD(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",oT(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function oy(e){const t=GT(e,Xe.activeTheaterId);ct({theaters:e,activeTheaterId:t})}function eI(e){oy(e.theaters)}function fs(e){ct({operations:e,operationsHydrated:!0})}function tI(e){const t=new Set(e.map(i=>i.id)),n=Xe.operations.filter(i=>!t.has(i.id));ct({operations:[...e,...n],operationsHydrated:!0})}function nI(e){const t=Xe.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Xe.operations];n[t]=e,ct({operations:n})}function Eo(e){ct({groups:e})}function v0(e){Hp(e),ct({activeTheaterId:e})}function Ii(e){Xe.activeOperationId!==e&&ct({activeOperationId:e})}function iI(e,t){if(t==="idle"){zT(e);return}Xe.operationStatus[e]!==t&&ct({operationStatus:{...Xe.operationStatus,[e]:t}})}function zT(e){if(!(e in Xe.operationStatus))return;const t={...Xe.operationStatus};delete t[e],ct({operationStatus:t})}function sI(e){if(!e.operationId)return;const t=Xe.operations.find(u=>u.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Xe.theaters.find(u=>u.id===n)?.label??n??"Unknown",r=t.title,o=CI(e.kind);BC+=1,ct({operationNotifications:{...Xe.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:r,lastRaisedSeq:BC}}})}function HT(){ct({addingTheater:!0,theaterError:null})}function FT(e){const t=[e,...Xe.theaters.filter(n=>n.id!==e.id)];Hp(e.id),ct({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function rI(){ct({addingTheater:!1,theaterError:null})}function ly(e){ct({addingTheater:!1,theaterError:e})}function lc(e){const t=Xe.operations.find(n=>n.id===e);t&&(Hp(t.theaterId),ct({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:qT(Xe.operationNotifications,e)}))}function aI(){Xe.pendingOperationFocus!==null&&ct({pendingOperationFocus:null})}function oI(){ct({pendingSideBarAddTheater:!0})}function lI(){Xe.pendingSideBarAddTheater&&ct({pendingSideBarAddTheater:!1})}function cI(e){ct({pendingSideBarTheaterLaunch:e})}function PC(){Xe.pendingSideBarTheaterLaunch!==null&&ct({pendingSideBarTheaterLaunch:null})}function bo(e){ct({keyboardFocusRequest:{operationId:e,requestId:(Xe.keyboardFocusRequest?.requestId??0)+1}})}function uI(){ct({launchMenuRequest:{requestId:(Xe.launchMenuRequest?.requestId??0)+1}})}function dI(){Xe.launchMenuRequest!==null&&ct({launchMenuRequest:null})}function hI(){Xe.keyboardShortcutsOpen||ct({keyboardShortcutsOpen:!0})}function fI(){Xe.keyboardShortcutsOpen&&ct({keyboardShortcutsOpen:!1})}function pI(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,r=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[r]??null}function y0(e,t){if(t.length===0)return[...e].sort(cy);const n=new Map(t.map((i,r)=>[i,r]));return[...e].sort((i,r)=>{const o=n.get(i.id),u=n.get(r.id);return o!==void 0&&u!==void 0?o-u:o!==void 0?-1:u!==void 0?1:cy(i,r)})}function b0(e,t,n,i=[]){const r=y0(e,n),o=new Set(i),u=[...t].sort((p,f)=>p.order-f.order||p.createdAt-f.createdAt),h=new Map;for(const p of u)h.set(p.id,[]);h.set(null,[]);for(const p of r){const f=p.groupId??null;f!==null&&h.has(f)?h.get(f).push(p):h.get(null).push(p)}return[...u.filter(p=>!o.has(p.id)).flatMap(p=>h.get(p.id)??[]),...h.get(null)??[]]}function mI(e,t,n,i,r){const o=new Set(r);return b0(e,t,n,i).filter(u=>!o.has(u.id)).map(u=>u.id)}function cy(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Kh(){ct({operationSearchOpen:!1})}function UT(){ct({operationSearchOpen:!Xe.operationSearchOpen})}function WT(){Xe.releaseNotes.length===0||Xe.whatsNewOpen||ct({whatsNewOpen:!0,selectedReleaseNoteKey:Xe.selectedReleaseNoteKey??VT(Xe.releaseNotes)})}function Vh(){Xe.whatsNewOpen&&(Xe.automaticWhatsNewVersion&&NI(Xe.automaticWhatsNewVersion),ct({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function $C(e){YT(Xe.releaseNotes,e)&&ct({selectedReleaseNoteKey:e})}function _u(){AI(!0),Xe.onboardingOpen&&ct({onboardingOpen:!1})}function cr(e){ct({codexReader:e,codexReaderExpanded:!1})}function Nf(){Xe.codexReader!==null&&ct({codexReaderExpanded:!0})}function gI(){ct({codexReaderExpanded:!1})}function C_(){ct({codexReader:null,codexReaderExpanded:!1})}function zC(){if(Xe.bootstrapped)return;const e=Xe.theaters.length===0&&!TI();ct({bootstrapped:!0,onboardingOpen:e?!0:Xe.onboardingOpen})}function HC(e){const t=Xe.theaters.filter(u=>u.id!==e),n=GT(t,Xe.activeTheaterId===e?null:Xe.activeTheaterId),i=xI(Xe.operationNotifications,e),r=new Set(Xe.operations.filter(u=>u.theaterId===e).map(u=>u.id)),o=Xe.activeOperationId&&r.has(Xe.activeOperationId)?null:Xe.activeOperationId;Hp(n),ct({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function _I(e){const t=qT(Xe.operationNotifications,e);t!==Xe.operationNotifications&&ct({operationNotifications:t})}function vI(e){const t={...Xe.notificationPreferences,globalMute:e};w0(t),ct({notificationPreferences:t})}function yI(e){const t={...Xe.notificationPreferences,dnd:e};w0(t),ct({notificationPreferences:t})}function bI(e){const t={...Xe.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Xe.notificationPreferences,mutedTheaterIds:t};w0(n),ct({notificationPreferences:n})}function SI(e){return zD(e)}function wI(){for(const e of sy)e()}function qT(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function xI(e,t){let n=!1;const i={};for(const[r,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[r]=o}return n?i:e}function GT(e,t){const n=new Set(e.map(r=>r.id)),i=kI();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function CI(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function KT(e){const t=e.releaseNotes.findIndex(i=>i.version!=="Unreleased"),n=t>=0?e.releaseNotes[t]:void 0;return!n||!e.version||n.version!==e.version||RI()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:S0(n.version,t)}}function VT(e){return e[0]?S0(e[0].version,0):null}function YT(e,t){return e.some((n,i)=>S0(n.version,i)===t)}function S0(e,t){return`${e}:${t}`}function kI(){if(typeof window>"u")return null;try{return window.localStorage.getItem(iy)}catch{return null}}function Hp(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(iy,e):window.localStorage.removeItem(iy)}catch{}}function EI(){if(typeof window>"u")return Gh;try{const e=window.localStorage.getItem(BT);if(!e)return Gh;const t=JSON.parse(e);return LI(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Gh}catch{return Gh}}function TI(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(DT)==="1"}catch{return!1}}function AI(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(DT,"1")}catch{}}function RI(){if(ry!==null)return ry;if(typeof window>"u")return null;try{return window.localStorage.getItem(IT)}catch{return null}}function NI(e){if(ry=e,!(typeof window>"u"))try{window.localStorage.setItem(IT,e)}catch{}}function w0(e){if(!(typeof window>"u"))try{window.localStorage.setItem(BT,JSON.stringify({version:PT,preferences:e}))}catch{}}function LI(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==PT||!t.preferences||typeof t.preferences!="object")return!1;const n=t.preferences;return typeof n.globalMute=="boolean"&&typeof n.dnd=="boolean"&&!!n.mutedTheaterIds&&typeof n.mutedTheaterIds=="object"}function FC(e,t){return e!==null&&e===t?e:null}function MI(e,t,n,i){return b0(e.filter(r=>r.theaterId===n),t.filter(r=>r.theaterId===n),i)}function jI(e,t,n){if(t===null||n===null)return null;const i=e.find(r=>r.id===t)??null;return i!==null&&i.theaterId===n?i:null}function OI(e,t){return!(t instanceof Node&&e.contains(t))}function DI(e,t,n,i,r=12){const o=i-r-n-t,u=r-t;return Math.max(u,Math.min(e,o))}const II=288,BI=520,vu=12;function XT({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:r,renderKindIcon:o,onLaunchKind:u,onClose:h}){const p=v.useRef(null),f=v.useRef(null);return v.useEffect(()=>{const g=b=>{p.current?.contains(b.target)||h()},_=b=>{b.key==="Escape"&&h()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",_)}},[h]),v.useEffect(()=>{f.current?.focus()},[]),c.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:$I(e,t,n),"data-canvas-blocker":!0,children:c.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:f,children:[c.jsxs("div",{className:"canvas-context-menu-head",children:[c.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:c.jsx(PI,{})}),c.jsx("span",{className:"canvas-context-menu-head-text",children:c.jsx("strong",{children:"Canvas controls"})})]}),c.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),i.length>0?i.map((g,_)=>c.jsxs("div",{children:[_>0?c.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,c.jsx("p",{className:"canvas-context-menu-plugin",children:g.title}),g.kinds.map(b=>{const S=b.disabled===!0||!r;return c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:S,title:b.disabledReason,onClick:()=>u(g.id,b),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(g.id,b)??c.jsx(zI,{})}),c.jsx("span",{className:"theater-menu-label",children:b.title}),b.disabledReason?c.jsx("span",{className:"operation-launch-menu-reason",children:b.disabledReason}):null]},`${g.id}:${b.id}`)})]},g.id)):c.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function PI(){return c.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function $I(e,t,n){const i=t?Math.max(vu,Math.min(e.x,t.width-II-vu)):e.x;if(n==="above")return{left:i,bottom:Math.max(vu,e.y)};const r=t?Math.max(vu,Math.min(e.y,t.height-BI-vu)):e.y;return{left:i,top:r}}function zI(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function ZT(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const Yh="directory-browser-sectors";function JT({open:e,onCancel:t,onConfirm:n}){const[i,r]=v.useState(null),[o,u]=v.useState(null),[h,p]=v.useState(null),[f,g]=v.useState(""),[_,b]=v.useState(""),[S,w]=v.useState(0),C=v.useRef(null),x=v.useRef(null),I=async(j,T)=>{u(j),p(null),g(""),w(0);try{const B=await xO(j,T);r(B)}catch(B){if(B instanceof DOMException&&B.name==="AbortError")return;p(B instanceof hn?B.message:String(B))}finally{u(null)}};v.useEffect(()=>{if(!e)return;const j=new AbortController;return I(null,j.signal),()=>j.abort()},[e]),v.useEffect(()=>{e&&C.current?.focus()},[e,i?.path]);const z=i?.entries??[],U=v.useMemo(()=>{const j=f.trim().toLowerCase();return j===""?z:z.filter(T=>T.name.toLowerCase().includes(j))},[z,f]),A=v.useMemo(()=>i?HI(i):[],[i]),O=i?UC(i.path):null,R=i?.roots??[],$=R.length>1,H=U.length===0?-1:Math.min(S,U.length-1);if(v.useEffect(()=>{if(H<0)return;x.current?.querySelector(`[data-index="${H}"]`)?.scrollIntoView({block:"nearest"})},[H,i?.path]),!e)return null;const J=j=>{j.accessible&&o===null&&I(j.path)},Z=()=>{i?.parentPath!=null&&o===null&&I(i.parentPath)},K=()=>{const j=_.trim();j!==""&&o===null&&I(j)},M=i?.path??null,N=H>=0?`${Yh}-${H}`:void 0,D=j=>{switch(j.key){case"Escape":f!==""?g(""):t();return;case"ArrowDown":j.preventDefault(),w(T=>Math.min(T+1,Math.max(U.length-1,0)));return;case"ArrowUp":j.preventDefault(),w(T=>Math.max(T-1,0));return;case"Enter":{j.preventDefault();const T=U[H];T&&J(T);return}case"Backspace":f===""&&(j.preventDefault(),Z());return;default:return}};return Qr.createPortal(c.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[c.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),c.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:D,children:[c.jsxs("header",{className:"directory-browser-header",children:[c.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:c.jsx(WI,{})}),c.jsxs("div",{className:"directory-browser-heading",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),c.jsx("h2",{children:"Add Theater"})]}),c.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),$?c.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[c.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),c.jsx("div",{className:"directory-browser-root-chips",children:R.map(j=>{const T=O!=null&&UC(j)===O;return c.jsx("button",{type:"button",className:`directory-browser-root-chip ${T?"is-active":""}`,"aria-current":T?"location":void 0,disabled:o!==null,title:j,onClick:()=>{o===null&&I(j)},onKeyDown:B=>B.stopPropagation(),children:UI(j)},j)})})]}):null,c.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:A.map((j,T)=>{const B=T===A.length-1;return c.jsxs("span",{className:"directory-browser-course-seg",children:[T>0?c.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,c.jsx("button",{type:"button",className:`directory-browser-crumb ${B?"is-current":""}`,"aria-current":B?"location":void 0,disabled:B||o!==null,title:j.path,onClick:()=>{I(j.path)},children:j.label})]},j.path)})}),c.jsxs("div",{className:"directory-browser-toolbar",children:[c.jsxs("div",{className:"directory-browser-filter",children:[c.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:c.jsx(GI,{})}),c.jsx("input",{ref:C,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":Yh,value:f,spellCheck:!1,autoComplete:"off",onChange:j=>{g(j.target.value),w(0)}})]}),c.jsxs("button",{type:"button",className:"directory-browser-up",disabled:i?.parentPath==null||o!==null,title:"Up one folder (Backspace)",onClick:Z,children:[c.jsx(KI,{}),c.jsx("span",{children:"Up"})]})]}),c.jsxs("div",{className:"directory-browser-jump",children:[c.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:_,spellCheck:!1,autoComplete:"off",onChange:j=>b(j.target.value),onKeyDown:j=>{j.stopPropagation(),j.key==="Enter"&&(j.preventDefault(),K())}}),c.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:_.trim()===""||o!==null,onClick:K,onKeyDown:j=>j.stopPropagation(),children:"Go"})]}),h?c.jsx("p",{className:"directory-browser-error",role:"alert",children:h}):null,c.jsx("div",{className:"directory-browser-list",id:Yh,role:"listbox","aria-label":"Folders","aria-busy":o!==null,"aria-activedescendant":N,ref:x,children:o!==null?c.jsxs("p",{className:"directory-browser-state is-live",children:[c.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):U.length===0?c.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):U.map((j,T)=>c.jsxs("div",{id:`${Yh}-${T}`,"data-index":T,role:"option","aria-selected":T===H,"aria-disabled":!j.accessible,className:`directory-browser-sector ${T===H?"is-active":""} ${j.accessible?"":"is-locked"}`,title:j.path,onClick:()=>{w(T),J(j)},children:[c.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:c.jsx(qI,{})}),c.jsx("span",{className:"directory-browser-sector-name",children:j.name}),j.accessible?c.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):c.jsxs("span",{className:"directory-browser-sector-lock",children:[c.jsx(VI,{})," Locked"]})]},j.path))}),i?.truncated?c.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,c.jsxs("footer",{className:"directory-browser-actions",children:[c.jsxs("div",{className:"directory-browser-target",children:[c.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),c.jsx("span",{className:"directory-browser-target-path",title:M??"",children:M??"Loading…"})]}),c.jsxs("div",{className:"directory-browser-buttons",children:[c.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),c.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:M===null||o!==null,onClick:()=>M&&n(M),children:"Add Theater"})]})]})]})]}),document.body)}function HI(e){if(FI(e)==="/"){const u=[{label:"/",path:"/"}];let h="";for(const p of e.path.split("/").filter(Boolean))h+=`/${p}`,u.push({label:p,path:h});return u}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",r=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const u of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${u}`,r.push({label:u,path:o});return r}function FI(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function UC(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function UI(e){return e.replace(/[\\/]+$/,"")||e}function WI(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),c.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function qI(){return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function GI(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function KI(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function VI(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function Js(){return v.useSyncExternalStore($T,Fo,Fo)}const x0=[{key:"crimson",label:"Crimson",color:"var(--id-crimson)"},{key:"amber",label:"Amber",color:"var(--id-amber)"},{key:"moss",label:"Moss",color:"var(--id-moss)"},{key:"teal",label:"Teal",color:"var(--id-teal)"},{key:"cerulean",label:"Cerulean",color:"var(--id-cerulean)"},{key:"indigo",label:"Indigo",color:"var(--id-indigo)"},{key:"plum",label:"Plum",color:"var(--id-plum)"},{key:"rose",label:"Rose",color:"var(--id-rose)"}],YI={red:"crimson",orange:"amber",yellow:"amber",lime:"moss",green:"moss",emerald:"teal",cyan:"teal",sky:"cerulean",blue:"cerulean",violet:"plum",purple:"plum",magenta:"rose"};function QT(e){return typeof e!="string"||e.length===0?null:x0.some(t=>t.key===e)?e:YI[e]??null}function Xa(e){const t=QT(e);return t?x0.find(n=>n.key===t)?.color??null:null}function uy(e){return typeof e.accent=="string"?e.accent:null}const WC=8,XI=268;function C0({accentKey:e,includeNone:t,onSelect:n}){const i=QT(e);return c.jsxs(c.Fragment,{children:[t?c.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>n(null),children:[c.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:"None"})]}):null,x0.map(r=>c.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","aria-label":r.label,"aria-pressed":i===r.key,onClick:()=>n(r.key),children:[c.jsx("span",{className:"accent-tone-flag",style:{background:r.color},"aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:r.label})]},r.key))]})}function ZI({anchor:e,accentKey:t,onSelect:n,onClose:i}){const[r,o]=v.useState(void 0);v.useLayoutEffect(()=>{const h=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+WC,f=p+XI>window.innerHeight;o(f?{position:"fixed",left:h,top:"auto",bottom:Math.round(window.innerHeight-e.top+WC)}:{position:"fixed",left:h,top:Math.round(p)})},[e]),v.useEffect(()=>{const h=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",h),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",h),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const u=h=>{n(h),i()};return Qr.createPortal(c.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:r?c.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:r,onPointerDown:h=>h.stopPropagation(),children:c.jsx(C0,{accentKey:t,includeNone:!0,onSelect:u})}):null}),document.body)}const qC=8,JI=320;function GC(e){const{anchor:t,onClose:n}=e,[i,r]=v.useState(void 0);return v.useLayoutEffect(()=>{const o=Math.max(8,Math.min(t.left,window.innerWidth-208)),u=t.bottom+qC,h=u+JI>window.innerHeight;r(h?{position:"fixed",left:o,top:"auto",bottom:Math.round(window.innerHeight-t.top+qC)}:{position:"fixed",left:o,top:Math.round(u)})},[t]),v.useEffect(()=>{const o=u=>{u.key==="Escape"&&(u.preventDefault(),n())};return window.addEventListener("keydown",o),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("keydown",o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[n]),Qr.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:n,children:i?c.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:i,onPointerDown:o=>o.stopPropagation(),children:e.kind==="chip"?c.jsx(QI,{...e}):c.jsx(e8,{...e})}):null}),document.body)}function QI({operation:e,groups:t,accentKey:n,actions:i,onClose:r}){const[o,u]=v.useState(!1),[h,p]=v.useState(`Group ${t.length+1}`),f=v.useRef(!1),g=v.useRef(null);v.useEffect(()=>{o&&g.current?.select()},[o]);const _=()=>{const b=h.trim();b&&(i.onCreateGroup(b),r())};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(b=>{const S=Xa(b.color),w=e.groupId===b.id;return c.jsxs("button",{type:"button",className:`group-context-menu-item${w?" is-selected":""}`,role:"menuitemradio","aria-checked":w,onClick:()=>{i.onSetGroupId(w?null:b.id),r()},children:[c.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),c.jsx("span",{className:"group-context-menu-item__name",children:b.name}),w?c.jsx(t8,{}):null]},b.id)}),o?c.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:h,onChange:b=>p(b.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:b=>{b.key==="Enter"&&!f.current&&(b.preventDefault(),_()),b.key==="Escape"&&(b.preventDefault(),u(!1))},onBlur:()=>u(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>u(!0),children:c.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),c.jsx(C0,{accentKey:n,includeNone:!0,onSelect:b=>{i.onSetAccent(b),r()}})]})}function e8({group:e,actions:t,onClose:n}){const[i,r]=v.useState(e.name),[o,u]=v.useState(!1),h=v.useRef(!1),p=()=>{const f=i.trim();if(!f||f===e.name){n();return}t.onRename(f),n()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),c.jsx(C0,{accentKey:e.color,includeNone:!1,onSelect:f=>{f&&t.onSetColor(f),n()}}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),c.jsx("input",{className:"group-context-menu-new-input",type:"text",value:i,onChange:f=>r(f.target.value),onCompositionStart:()=>{h.current=!0},onCompositionEnd:()=>{h.current=!1},onKeyDown:f=>{f.key==="Enter"&&!h.current&&(f.preventDefault(),p()),f.key==="Escape"&&(f.preventDefault(),n())},onBlur:p,"aria-label":"Group name"}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${o?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!o){u(!0);return}t.onUngroupAll(),n()},"aria-label":o?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:o?"Confirm ungroup all?":"Ungroup all"})]})}function t8(){return c.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:c.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const n8=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{combos:[["Mod","B"]],description:"Toggle the left sidebar"},{combos:[["Mod","Alt","B"]],description:"Toggle the right activity rail"},{combos:[["Esc"]],description:"Close the open overlay or menu"}]},{title:"Operations",entries:[{combos:[["Esc"]],description:"Close the carrier job stream"},{combos:[["Shift","Enter"]],description:"Insert a newline in the terminal instead of submitting"},{combos:[["Enter"],["Esc"]],description:"Confirm or cancel a session rename"},{combos:[["↑"],["↓"]],description:"Move between Theater, Theme, and launch menu items"}]},{title:"Map",entries:[{combos:[["Alt","←"],["Alt","→"]],description:"Focus the previous / next Operation"},{combos:[["Alt","F"]],description:"Toggle Formation view"},{combos:[["Drag"]],description:"Pan the operations map"},{combos:[["Shift","Drag"]],description:"Draw a new Operation terminal"},{combos:[["Space","Drag"]],description:"Pan even while a terminal has focus"},{combos:[["Scroll"]],description:"Zoom the map in or out"},{combos:[["Right-click"]],description:"Open the canvas actions menu"},{combos:[["Double-click"]],description:"Focus an Operation from its title bar; rename from its name"},{combos:[["Click"]],description:"Clear terminal focus on the empty canvas"}]},{title:"Codex",entries:[{combos:[["Mod","K"]],description:"Toggle the command palette"},{combos:[["↑"],["↓"]],description:"Move through command palette results"},{combos:[["Enter"]],description:"Open the selected result"},{combos:[["Tab"]],description:"Move focus within the command palette"},{combos:[["Esc"]],description:"Close the command palette or diagram lightbox"},{combos:[["+"],["−"],["0"]],description:"Zoom the diagram lightbox in / out / reset"},{combos:[["F"]],description:"Fit the diagram lightbox to the viewport"}]}],Uu="data-keyboard-shortcuts-open",i8='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function eA(){return document.body.getAttribute(Uu)==="true"}function s8(){return!eA()}function tA({onClose:e}){const t=v.useRef(null);v.useEffect(()=>{const i=t.current,r=document.querySelector(".console-shell"),o=document.body.getAttribute(Uu);return document.body.setAttribute(Uu,"true"),r&&(r.inert=!0),i?.focus(),()=>{o===null?document.body.removeAttribute(Uu):document.body.setAttribute(Uu,o),r&&(r.inert=!1)}},[e]);const n=i=>{if(i.key==="Escape"){i.preventDefault(),e();return}if(i.key!=="Tab")return;const r=[...t.current?.querySelectorAll(i8)??[]];if(r.length===0){i.preventDefault(),t.current?.focus();return}const o=r[0],u=r[r.length-1],h=document.activeElement;(h===t.current||!t.current?.contains(h)||(i.shiftKey?h===o:h===u))&&(i.preventDefault(),(i.shiftKey?u:o)?.focus())};return Qr.createPortal(c.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:c.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:n,onMouseDown:i=>i.stopPropagation(),children:[c.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[c.jsx("strong",{children:"Keyboard Shortcuts"}),c.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),n8.map(i=>c.jsxs("section",{className:"keyboard-shortcuts-group",children:[c.jsx("h3",{children:i.title}),c.jsx("dl",{children:i.entries.map(r=>c.jsxs("div",{children:[c.jsx("dt",{children:r.combos.map((o,u)=>c.jsxs("span",{children:[u>0?" or ":null,o.map(h=>c.jsx("kbd",{children:h==="Mod"?"⌘/Ctrl":h},h))]},o.join("+")))}),c.jsx("dd",{children:r.description})]},`${i.title}:${r.description}`))})]},i.title))]})}),document.body)}const r8=1400,a8="https://github.com/sbluemin/fleet-harness",o8="https://github.com/sbluemin/fleet-harness/stargazers",l8="https://api.github.com/repos/sbluemin/fleet-harness",k0="fleet-console.github-stars",c8=360*60*1e3,KC='[role="menuitem"]:not([disabled])';function u8(){const e=Js();return c.jsxs("div",{className:"side-bar-brand-foot",children:[c.jsx(h8,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),c.jsx(f8,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function d8({className:e="brand-foot-home"}){return c.jsxs(cd,{className:e,to:"/operations","aria-label":"Operations",children:[c.jsx(C8,{}),c.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function h8({latestVersion:e,updateAvailable:t}){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),[o,u]=v.useState(!1),h=_c();nA(n,i,r,o,u);const p=f=>{u(!1),h(f),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-system-menu",children:[c.jsxs("button",{ref:i,type:"button",className:"brand-foot-system-trigger",onClick:()=>u(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"System Menu",title:"System Menu",children:[c.jsx(VC,{}),c.jsx("span",{children:"System Menu"})]}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/settings"),children:[c.jsx(VC,{}),c.jsx("span",{children:"Settings"})]}),t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(p8,{latestVersion:e})]}):null]}):null]})}function f8({releaseDisabled:e,version:t}){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),[o,u]=v.useState(!1),[h,p]=v.useState(!1);return nA(n,i,r,o,u),c.jsxs("div",{ref:n,className:"brand-foot-dropup brand-foot-help-menu",children:[c.jsx("button",{ref:i,type:"button",className:"brand-foot-help-trigger",onClick:()=>u(f=>!f),"aria-haspopup":"menu","aria-expanded":o,"aria-label":"Help",title:"Help",children:c.jsx(k8,{})}),o?c.jsxs("div",{ref:r,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[c.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{u(!1),WT()},children:[c.jsx(E8,{}),c.jsx("span",{children:"What's New"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{u(!1),p(!0)},children:[c.jsx(T8,{}),c.jsx("span",{children:"Keyboard Shortcuts"})]}),c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(m8,{menuItem:!0,version:t})]}):null,h?c.jsx(tA,{onClose:()=>{p(!1),i.current?.focus()}}):null]})}function nA(e,t,n,i,r){v.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(KC)?.focus()}),u=p=>{p.target instanceof Node&&e.current?.contains(p.target)||r(!1)},h=p=>{if(p.key==="Escape"){r(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(p.key))return;const f=[...n.current?.querySelectorAll(KC)??[]];if(f.length===0)return;p.preventDefault();const g=f.findIndex(b=>b===document.activeElement),_=p.key==="Home"||p.key==="ArrowDown"&&g===f.length-1?0:p.key==="End"||p.key==="ArrowUp"&&g<=0?f.length-1:p.key==="ArrowDown"?g+1:g-1;f[_]?.focus()};return window.addEventListener("pointerdown",u,!0),window.addEventListener("keydown",h,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",u,!0),window.removeEventListener("keydown",h,!0)}},[n,i,e,r,t])}function p8({latestVersion:e}){const[t,n]=v.useState("idle"),[i,r]=v.useState(null),o=v.useRef(null),u=g8(t,i,e);v.useEffect(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);const h=async()=>{if(!u.disabled){o.current!==null&&(window.clearTimeout(o.current),o.current=null),n("applying"),r(null);try{if((await SO()).status!=="accepted"){n("error"),r("invalid_response");return}n("accepted"),o.current=window.setTimeout(()=>{o.current=null,n("completed")},r8)}catch(p){const f=p instanceof hn?p.message:"network_error";r(f),n(v8(f)?"blocked":"error")}}};return c.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${u.tone}`,onClick:h,disabled:u.disabled,title:u.title,"aria-live":"polite",children:u.label})}function m8({menuItem:e=!1,version:t}){const n=y8(),i=n.count!==null;return c.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[c.jsx("a",{className:"brand-foot-github-link",href:a8,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:c.jsx(A8,{})}),c.jsxs("a",{className:"brand-foot-github-stars",href:o8,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":i?`GitHub stars ${n.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[c.jsx(R8,{}),i?c.jsx("span",{className:"brand-foot-github-stars-count",children:x8(n.count)}):null]}),c.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function g8(e,t,n){const i=n?`Latest version ${n}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?_8(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:i,tone:"warn",disabled:!1}}function _8(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",tone:"blocked",disabled:!0}:e==="managed_runtime_update_requires_relaunch"?{label:"Update and Restart",title:"This managed Console installation updates through Fleet Console Desktop. Use Desktop Update and Restart.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"Busy",title:"Another update is already in progress.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"Current",title:"The server re-check found no update to apply.",tone:"blocked",disabled:!0}:{label:"Blocked",title:"The console is not ready to start an update. Try again shortly.",tone:"error",disabled:!1}}function v8(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function y8(){const[e,t]=v.useState(()=>{const n=b8();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return v.useEffect(()=>{if(S8())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(l8,{headers:{Accept:"application/vnd.github+json"}}).then(i=>i.ok?i.json():Promise.reject(new Error(`status ${i.status}`))).then(i=>{if(n)return;const r=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(r===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}w8(r),t({count:r,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function b8(){try{const e=window.localStorage.getItem(k0);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function S8(){try{const e=window.localStorage.getItem(k0);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<c8}catch{return!1}}function w8(e){try{window.localStorage.setItem(k0,JSON.stringify({count:e,at:Date.now()}))}catch{}}function x8(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function C8(){return c.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),c.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),c.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),c.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),c.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),c.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function VC(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function k8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function E8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function T8(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function A8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function R8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function N8(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const u=o.groupId??"__ungrouped__",h=n.querySelector(`[data-drop-zone-group-id="${u}"]`);if(!h)continue;const p=h.getBoundingClientRect();if(e<p.top||e>p.bottom)continue;const f=h.querySelector(`[data-group-section-id="${u}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:o.groupId,index:0};const g=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const _ of g){const b=_.dataset.sideBarChipId;if(!b||b===i)continue;const S=_.getBoundingClientRect();if(e<=S.top+S.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const r=t[t.length-1];return{groupId:r?.groupId??null,index:r?.entryIds.length??0}}function L8(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of r){const u=o.dataset.dropZoneGroupId;if(!u||u==="__ungrouped__"||u===i)continue;const h=t.indexOf(u);if(h===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return h}return t.length}function M8(e,t,n,i){if(!n)return 0;const r=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of r){const u=o.dataset.theaterId;if(!u||u===i)continue;const h=t.indexOf(u);if(h===-1)continue;const p=o.getBoundingClientRect();if(e<=p.top+p.height/2)return h}return t.length}function j8(e,t,n,i){const r=e.filter(g=>g!==t),o=new Set(i),u=r.filter(g=>o.has(g)),h=Math.max(0,Math.min(n,u.length));if(u.length===0)return[...r,t];if(h<u.length){const g=r.indexOf(u[h]),_=[...r];return _.splice(g,0,t),_}const p=r.indexOf(u[u.length-1]),f=[...r];return f.splice(p+1,0,t),f}function O8(e,t,n,i){const r=new Set(i),o=e.filter(_=>r.has(_)),u=o.indexOf(t),h=o.filter(_=>_!==t),p=n>u?n-1:n,f=Math.max(0,Math.min(p,h.length));h.splice(f,0,t);let g=0;return e.map(_=>r.has(_)?h[g++]??_:_)}function D8(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let r=0;return e.map(o=>i.has(o)?n[r++]??o:o)}function I8(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(h=>h!==t),o=n>i?n-1:n,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function B8(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const r=e.filter(h=>h!==t),o=n>i?n-1:n,u=Math.max(0,Math.min(o,r.length));return r.splice(u,0,t),r}function P8(e,t,n){if(e.indexOf(t)===-1)return[...e];const r=e.filter(u=>u!==t),o=Math.max(0,Math.min(n,r.length));return r.splice(o,0,t),r}function Fp(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function $8(e){const t=Fp(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function E0(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,r=v.useRef(null),o=v.useRef(!1),u=v.useRef(!1),[h,p]=v.useState(!1),[f,g]=v.useState("");v.useEffect(()=>{h&&(r.current?.focus(),r.current?.select())},[h]);const _=()=>{i?.(),u.current=!1,g(t),p(!0)},b=()=>{u.current=!0,p(!1),g("")},S=()=>{if(!o.current){o.current=!0;try{n(f)}finally{o.current=!1,u.current=!0,p(!1)}}};return{renaming:h,draftTitle:f,inputRef:r,begin:_,cancel:b,commit:S,setDraftTitle:g,handleKeyDown:x=>{if(x.key==="Enter"){x.preventDefault(),S();return}x.key==="Escape"&&(x.preventDefault(),b())},handleBlur:()=>{if(u.current){u.current=!1;return}S()}}}function iA({entry:e,index:t,isCloseArmed:n,accentValue:i,dragging:r,dragOffsetY:o,dropTarget:u,preview:h=!1,onArmClose:p,onDisarmClose:f,onClose:g,onMinimize:_,onFocus:b,onKeyboardMove:S,onPointerDragStart:w,onOpenAccent:C,onRename:x}){const I=v.useRef(!1),{operation:z,active:U,minimized:A,notificationCount:O,status:R}=e,$=z8(z),H=E0({currentTitle:$,onCommit:T=>x(z.id,T),onBegin:f}),J=["side-bar-chip",U?"side-bar-chip--active":"",A?"side-bar-chip--minimized":"",r?"side-bar-chip--dragging":"",u?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),Z=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),K={"--i":t,...i?{"--user-accent":i}:{},...r?{"--drag-dy":`${Math.round(o)}px`}:{}},M=()=>{if(f(),I.current){I.current=!1;return}b(z.id)},N=T=>{T.stopPropagation()},D=T=>{if(T.stopPropagation(),!n){p(z.id);return}f(),g(z.id)},j=T=>{T.preventDefault(),f(),C(z.id,T.currentTarget.getBoundingClientRect())};return c.jsxs("li",{"data-side-bar-chip-id":z.id,className:J,role:"button",tabIndex:0,"aria-label":U?`${$} (focused)`:`Focus operation ${$}`,"aria-current":U?"true":void 0,title:h?"Click to open in its Theater":U?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:K,onClick:M,onContextMenu:h?void 0:j,onFocus:()=>{n||f()},onPointerDown:T=>w(T,z.id),onPointerUp:()=>{r&&(I.current=!0)},onKeyDown:T=>{if(T.target===T.currentTarget){if(!h&&T.altKey&&T.shiftKey&&(T.key==="ArrowUp"||T.key==="ArrowDown")){T.preventDefault(),S(z.id,T.key==="ArrowUp"?-1:1);return}(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),M())}},children:[c.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:c.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??c.jsx(W8,{})})}),H.renaming?c.jsx("input",{className:"side-bar-chip-rename-input",ref:H.inputRef,value:H.draftTitle,"aria-label":`Rename operation ${$}`,onChange:T=>H.setDraftTitle(T.target.value),onKeyDown:H.handleKeyDown,onBlur:H.handleBlur,onPointerDown:T=>T.stopPropagation(),onClick:T=>T.stopPropagation()}):c.jsx("span",{className:"side-bar-chip-name",onDoubleClick:h?void 0:H.begin,children:$}),O>0?c.jsx("span",{className:"side-bar-chip-count",children:O}):null,c.jsx("span",{className:`side-bar-chip-status ${H8(R)}`,role:"img","aria-label":YC(R),title:YC(R)}),!h&&!A?c.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:N,onClick:T=>{T.stopPropagation(),f(),_(z.id)},"aria-label":`Minimize operation ${$}`,title:"Minimize operation",children:c.jsx(U8,{})}):null,h?null:c.jsx("button",{type:"button",className:Z,onPointerDown:N,onClick:D,"aria-label":n?`Confirm close operation ${$}`:`Close operation ${$}`,title:n?"Confirm close":"Close operation",children:n?"Close?":c.jsx(F8,{})})]})}function z8(e){return e.title}function H8(e){const t=Fp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function YC(e){return $8(e)}function F8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function U8(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function W8(){return c.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function sA({group:e,count:t,collapsed:n,dragging:i,dropTarget:r,dragOffsetY:o,onToggle:u,onContextMenu:h,onPointerDragStart:p}){const f=v.useRef(!1),g=Xa(e.color),_=["side-bar-group-header",n?"side-bar-group-header--collapsed":"",i?"side-bar-group-header--dragging":"",r?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),b={...g?{"--grp-color":g}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=x=>{x.preventDefault(),h(e.id,x.currentTarget.getBoundingClientRect())},w=x=>{x.target instanceof Element&&x.target.closest("button")||p(x,e.id)},C=()=>{i&&(f.current=!0)};return c.jsxs("div",{className:_,style:b,onContextMenu:S,onPointerDown:w,onPointerUp:C,role:"group","aria-label":e.name,children:[c.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>u(e.id),"aria-expanded":!n,"aria-label":n?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:n?"Expand":"Collapse",children:c.jsx(q8,{collapsed:n})}),c.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-group-header__name",children:e.name}),c.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function q8({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:c.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const rA="fleet-console.operations.side-width",aA="fleet-console.operations.side-collapsed",oA="fleet-console.operations.theater-collapsed",Up=280,XC=Up,dy=new Set,hy=new Set;let Io={width:Y8(),collapsed:X8()},Lf=Z8();function lA(){return v.useSyncExternalStore(J8,op,op)}function G8(){return v.useSyncExternalStore(e7,ZC,ZC)}function K8(e){const t=Math.max(Up,Math.min(cA(),e));if(Io.width!==t){Io={...Io,width:t};try{typeof window<"u"&&localStorage.setItem(rA,String(t))}catch{}uA()}}function Xl(e){if(Io.collapsed!==e){Io={...Io,collapsed:e};try{typeof window<"u"&&localStorage.setItem(aA,e?"1":"0")}catch{}uA()}}function V8(e,t){const n=new Set(Lf);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Lf.join("\0")){Lf=i;try{typeof window<"u"&&localStorage.setItem(oA,JSON.stringify(i))}catch{}Q8()}}function cA(){return typeof window<"u"?Math.max(Up,window.innerWidth-480):800}function Y8(){try{if(typeof window>"u")return XC;const e=localStorage.getItem(rA);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Up,Math.min(cA(),t))}}catch{}return XC}function X8(){try{return typeof window<"u"&&localStorage.getItem(aA)==="1"}catch{return!1}}function Z8(){try{if(typeof window>"u")return[];const e=localStorage.getItem(oA),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function uA(){for(const e of dy)e()}function op(){return Io}function J8(e){return dy.add(e),()=>dy.delete(e)}function Q8(){for(const e of hy)e()}function ZC(){return Lf}function e7(e){return hy.add(e),()=>hy.delete(e)}function dA(e,t){const n=e.find(r=>r.id===t.pluginId)?.kinds.filter(r=>r.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const r=n.find(o=>o.id===i);if(r)return r}return n.length===1?n[0]:null}const t7=1500,n7=6,JC=34,QC=18;function i7({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:r,activeOperationId:o,operationNotifications:u,catalog:h,canLaunch:p,addingTheater:f,theaterError:g,renderKindIcon:_,onLaunchKind:b,onResetView:S,onClose:w,onMinimize:C,onFocus:x,onSetAccent:I,onRename:z,onSetGroupId:U,onCreateGroup:A,onSetGroupColor:O,onRenameGroup:R,onReorderGroups:$,onReorderTheaters:H,onUngroupAll:J,onSelectTheater:Z,onAddTheater:K,onCancelAddTheater:M,onForgetTheater:N}){const D=v.useRef(null),j=v.useRef(null),T=lA(),{width:B,collapsed:L}=T,F=v.useRef(L),W=l0(),E=vT(),G=$p(),Y=v.useRef(null),[re,he]=v.useState(null),[ae,ke]=v.useState(null),Re=v.useRef(null),De=v.useRef([]),Ue=v.useRef([]),Oe=v.useRef([]),Le=v.useRef([]),we=v.useRef([]),Ie=v.useRef(U),Qe=v.useRef($),dt=v.useRef(H),[Je,le]=v.useState(null),[Ye,Pe]=v.useState(null),[At,Zt]=v.useState(!1),[fn,wt]=v.useState(!1),Kt=pD(),xt=G8(),{operationStatus:Se,pendingSideBarAddTheater:We,pendingSideBarTheaterLaunch:xn,launchMenuRequest:$e}=Js();v.useLayoutEffect(()=>{!F.current&&L&&ZT(D.current,".command-band-sidebar-toggle"),F.current=L},[L]);const xe=n.filter(ce=>ce.theaterId===t),it=i.filter(ce=>ce.theaterId===t),ht=new Set(r),Dt=new Set(Kt),Ct=y0(xe,W.operationOrder).map(ce=>{const ot=dA(h,ce),Jt=ot?_(ce.pluginId,ot):null;return{operation:ce,active:o===ce.id,minimized:ht.has(ce.id),notificationCount:u[ce.id]?1:0,status:Se[ce.id],icon:Jt}}),Bt=hA(Ct,it,W.operationOrder),Ni=Bt.some(ce=>ce.group!==null),se=Bt.flatMap(ce=>ce.groupId?[ce.groupId]:[]),me=Bt.flatMap(ce=>Dt.has(ce.groupId??"")?[]:ce.entries),et=Ct.map(ce=>ce.operation.id),Ne=v.useCallback(()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},[]),Ge=v.useCallback(()=>{Ne(),he(null)},[Ne]),vt=v.useCallback(ce=>{Ne(),he(ce),Y.current=window.setTimeout(()=>{Y.current=null,he(null)},t7)},[Ne]);v.useEffect(()=>Ne,[Ne]),v.useEffect(()=>{re!==null&&(Ct.some(ce=>ce.operation.id===re)||Ge())},[re,Ct,Ge]),v.useEffect(()=>{if(!$e)return;dI();const ot=D.current?.querySelector('.side-bar-theater-section--active .side-bar-theater-row-btn[aria-label^="New Operation in"]')?.getBoundingClientRect();le(null),Pe({anchor:ot?{x:ot.right+8,y:ot.top}:{x:16,y:64},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},[$e]);const V=Je?.kind==="chip"?Ct.find(ce=>ce.operation.id===Je.operationId)?.operation??null:null,ue=Je?.kind==="group"?i.find(ce=>ce.id===Je.groupId)??null:null,be=Je?.kind==="theater"?e.find(ce=>ce.id===Je.theaterId)??null:null,Ze=(ce,ot)=>{const Jt=me.findIndex(Ee=>Ee.operation.id===ce);if(Jt===-1)return;const Ce=Math.max(0,Math.min(me.length-1,Jt+ot));if(Ce===Jt)return;const q=me.map(Ee=>Ee.operation.id),fe=P8(q,ce,Ce);w_(D8(et,q,fe))},Pt=Bt.map(ce=>({groupId:ce.groupId,entryIds:ce.entries.map(ot=>ot.operation.id)}));v.useEffect(()=>{De.current=Ct,Ue.current=et,Oe.current=Pt,Le.current=se,we.current=e.map(ce=>ce.id),Ie.current=U,Qe.current=$,dt.current=H});const gt=ce=>{Re.current=ce,ke(ce)},je=ae?.pointerId??null;v.useEffect(()=>{if(je===null)return;const ce=Ce=>{if(Ce.pointerId!==je)return;const q=Re.current;if(!q)return;if(Ce.buttons===0){gt(null);return}const fe=Math.hypot(Ce.clientX-q.startX,Ce.clientY-q.startY);if(!q.dragging&&fe<n7)return;if(q.dragging&&Ce.preventDefault(),d7(Ce.clientY,j.current),q.kind==="chip"){const lt=N8(Ce.clientY,Oe.current,j.current,q.sourceId);gt({...q,currentY:Ce.clientY,dragging:!0,dropIndex:lt.index,dropGroupId:lt.groupId});return}if(q.kind==="theater"){const lt=M8(Ce.clientY,we.current,j.current,q.sourceTheaterId);gt({...q,currentY:Ce.clientY,dragging:!0,dropIndex:lt});return}const Ee=L8(Ce.clientY,Le.current,j.current,q.sourceGroupId);gt({...q,currentY:Ce.clientY,dragging:!0,dropIndex:Ee})},ot=Ce=>{if(Ce.pointerId!==je)return;const q=Re.current;if(gt(null),!q?.dragging)return;if(q.kind==="theater"){const pt=B8(we.current,q.sourceTheaterId,q.dropIndex);if(pt.join("\0")===we.current.join("\0"))return;dt.current(pt);return}if(q.kind==="group"){const pt=I8(Le.current,q.sourceGroupId,q.dropIndex);if(pt.join("\0")===Le.current.join("\0"))return;Qe.current(pt);return}const{sourceId:fe,sourceGroupId:Ee,dropIndex:lt,dropGroupId:ft}=q,He=Oe.current,$t=Ue.current;if(ft!==Ee){const Qt=He.find(Pn=>Pn.groupId===ft)?.entryIds??[];w_(j8($t,fe,lt,Qt)),Ie.current(fe,ft);return}const ye=He.find(pt=>pt.groupId===Ee)?.entryIds??[],ze=ye.indexOf(fe);if(ze===-1||lt===ze)return;const qe=O8($t,fe,lt,ye);w_(qe)},Jt=Ce=>{Ce.pointerId===je&&gt(null)};return window.addEventListener("pointermove",ce),window.addEventListener("pointerup",ot),window.addEventListener("pointercancel",Jt),()=>{window.removeEventListener("pointermove",ce),window.removeEventListener("pointerup",ot),window.removeEventListener("pointercancel",Jt)}},[je]);const Me=(ce,ot)=>{if(ce.button!==0||ce.target instanceof Element&&ce.target.closest("button"))return;le(null),Ge();const Ce=Ct.find(q=>q.operation.id===ot)?.operation.groupId??null;gt({kind:"chip",sourceId:ot,sourceGroupId:Ce,pointerId:ce.pointerId,startX:ce.clientX,startY:ce.clientY,currentY:ce.clientY,dragging:!1,dropIndex:et.indexOf(ot),dropGroupId:Ce})},nt=(ce,ot)=>{ce.button===0&&(ce.target instanceof Element&&ce.target.closest("button")||se.includes(ot)&&(le(null),Ge(),gt({kind:"group",sourceGroupId:ot,pointerId:ce.pointerId,startX:ce.clientX,startY:ce.clientY,currentY:ce.clientY,dragging:!1,dropIndex:se.indexOf(ot)})))},un=(ce,ot)=>{if(ce.button!==0||ce.target instanceof Element&&ce.target.closest("button"))return;const Jt=e.map(Ce=>Ce.id);Jt.includes(ot)&&(le(null),Ge(),gt({kind:"theater",sourceTheaterId:ot,pointerId:ce.pointerId,startX:ce.clientX,startY:ce.clientY,currentY:ce.clientY,dragging:!1,dropIndex:Jt.indexOf(ot)}))},Tt=v.useCallback(ce=>{ce.preventDefault();const ot=ce.clientX,Jt=T.width;wt(!0);const Ce=fe=>{const Ee=fe.clientX-ot;K8(Jt+Ee)},q=()=>{wt(!1),document.removeEventListener("pointermove",Ce),document.removeEventListener("pointerup",q),document.removeEventListener("pointercancel",q)};document.addEventListener("pointermove",Ce),document.addEventListener("pointerup",q),document.addEventListener("pointercancel",q)},[T.width]),Yn=()=>{Xl(!L)},_s=()=>{Pe(null),le(null),Zt(!0)},$s=()=>{Zt(!1),M()},xi=ce=>{Zt(!1),K(ce)},on=ce=>{ce.defaultPrevented||(ce.preventDefault(),le(null),Pe({anchor:{x:ce.clientX,y:ce.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Gt=v.useCallback(()=>{const ce=Je?.kind==="theater"?Je.returnFocus:null;le(null),ce?.focus()},[Je]),Fi=(ce,ot)=>{ot!==t&&Z(ot),le(null),Pe({anchor:{x:ce.right+8,y:ce.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},zs=(ce,ot)=>{ce.stopPropagation(),Fi(ce.currentTarget.getBoundingClientRect(),ot)};v.useEffect(()=>{We&&(lI(),L&&Xl(!1),_s())},[We]),v.useEffect(()=>{const ce=xn;if(ce===null)return;if(L){Xl(!1);return}if(!e.some(q=>q.id===ce)){PC();return}const ot=()=>{PC();const fe=Array.from(D.current?.querySelectorAll("[data-theater-id]")??[]).find(Ee=>Ee.dataset.theaterId===ce)?.querySelector(".side-bar-theater-launch-btn");fe&&Fi(fe.getBoundingClientRect(),ce)};if(D.current!==null&&Math.abs(D.current.getBoundingClientRect().width-B)<=1){ot();return}const Ce=window.setTimeout(ot,220);return()=>window.clearTimeout(Ce)},[xn,L]);const Sr=ce=>{V8(ce,!xt.includes(ce))};return c.jsxs("aside",{className:`operations-side-bar ${L?"is-closed":"is-expanded"}`,ref:D,"data-sidebar-state":L?"closed":"expanded","data-resizing":fn?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${B}px`},inert:L,onContextMenu:on,children:[c.jsxs("div",{className:"side-bar-theater-add-row",children:[c.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:_s,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[c.jsx(T0,{}),c.jsx("span",{children:"Add Theater"})]}),c.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>S(),disabled:t===null,"aria-label":"Reset canvas view",title:"Reset canvas view",children:c.jsx(r7,{})}),c.jsx("span",{className:"side-bar-formation-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>x_("grid"),disabled:t===null,"aria-pressed":G&&E==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:c.jsx(s7,{})}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>x_("columns"),disabled:t===null,"aria-pressed":G&&E==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:c.jsx(a7,{})}),c.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>x_("rows"),disabled:t===null,"aria-pressed":G&&E==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:c.jsx(o7,{})})]})]}),!L&&g?c.jsx("p",{className:"side-bar-theater-error",children:g}):null,c.jsx("ol",{className:"operations-side-bar-chips",ref:j,"aria-label":"Operations",children:e.map((ce,ot)=>{const Jt=ce.id===t,Ce=n.filter(He=>He.theaterId===ce.id).length,q=xt.includes(ce.id),fe=ae?.kind==="theater"&&ae.sourceTheaterId===ce.id&&ae.dragging,Ee=fe&&ae?.kind==="theater"?ae.currentY-ae.startY:0,lt=ae?.kind==="theater"&&ae.dragging&&ae.sourceTheaterId!==ce.id&&ae.dropIndex===ot,ft=ae?.kind==="theater"&&ae.dragging&&ae.sourceTheaterId!==ce.id&&ot===e.length-1&&ae.dropIndex===e.length;if(!Jt){const He=cD(ce.id),$t=l7({theaterId:ce.id,operations:n,operationOrder:He.operationOrder,minimizedSet:new Set(He.minimized),activeOperationId:null,operationNotifications:u,operationStatus:Se,catalog:h,renderKindIcon:_});return c.jsx(c7,{theater:ce,entries:q?[]:$t,groups:i.filter(zt=>zt.theaterId===ce.id),collapsedGroups:new Set(He.collapsedGroups),operationAccent:He.operationAccent,operationCount:Ce,collapsed:q,dragging:fe,dropBefore:lt,dropAfter:ft,dragOffsetY:Ee,onSelectTheater:Z,onFocus:x,onToggleCollapsed:Sr,onOpenActions:(zt,ye)=>{Pe(null),le({kind:"theater",theaterId:ce.id,anchor:zt,returnFocus:ye})},onOpenLaunch:zs,onContextMenu:zt=>{Pe(null),le({kind:"theater",theaterId:ce.id,anchor:zt})},onPointerDragStart:un},ce.id)}return c.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",lt?"side-bar-theater-section--drop-before":"",ft?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":ce.id,children:[c.jsx(fA,{theater:ce,operationCount:Ce,active:!0,collapsed:q,dragging:fe,dropTarget:lt,dragOffsetY:Ee,onSelectTheater:Z,onToggleCollapsed:Sr,onOpenActions:(He,$t)=>{Pe(null),le({kind:"theater",theaterId:ce.id,anchor:He,returnFocus:$t})},onOpenLaunch:zs,onContextMenu:He=>{Pe(null),le({kind:"theater",theaterId:ce.id,anchor:He})},onPointerDragStart:un}),q?null:c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${ce.label} operations`,children:Bt.map(He=>{const $t=He.groupId!==null&&Dt.has(He.groupId),zt=He.group?Xa(He.group.color):null,ye=zt?{"--grp-color":zt}:void 0,ze=He.groupId?se.indexOf(He.groupId):-1,qe=ae?.kind==="group"&&ae.sourceGroupId===He.groupId&&ae.dragging,pt=ae?.kind==="group"&&ae.dragging&&He.groupId!==null&&ae.sourceGroupId!==He.groupId&&ae.dropIndex===ze,Qt=ae?.kind==="group"&&ae.dragging&&He.groupId!==null&&ae.sourceGroupId!==He.groupId&&ze===se.length-1&&ae.dropIndex===se.length,Pn=[He.groupId?"side-bar-group-section":"side-bar-ungrouped-section",pt?"side-bar-group-section--drop-before":"",Qt?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return c.jsxs("li",{"data-drop-zone-group-id":He.groupId??"__ungrouped__",className:Pn,style:ye,children:[He.group?c.jsx(sA,{group:He.group,count:He.entries.length,collapsed:$t,dragging:qe,dragOffsetY:qe?ae.currentY-ae.startY:0,dropTarget:pt,onToggle:bT,onContextMenu:(dn,ti)=>le({kind:"group",groupId:dn,anchor:ti}),onPointerDragStart:nt}):Ni&&He.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,$t?null:c.jsx("ol",{className:["side-bar-group-chips",ae?.kind==="chip"&&ae.dragging&&ae.dropGroupId===He.groupId&&ae.dropGroupId!==ae.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":He.groupId??"__ungrouped__","aria-label":He.group?He.group.name:"Ungrouped",children:He.entries.map(dn=>{const ti=Ct.indexOf(dn),en=He.entries.indexOf(dn),Ci=W.operationAccent[dn.operation.id]??uy(dn.operation),Yo=Ci?Xa(Ci):null;return c.jsx(iA,{entry:dn,index:ti,isCloseArmed:re===dn.operation.id,accentValue:Yo,dragging:ae?.kind==="chip"&&ae.sourceId===dn.operation.id&&ae.dragging,dragOffsetY:ae?.kind==="chip"&&ae.sourceId===dn.operation.id&&ae.dragging?ae.currentY-ae.startY:0,dropTarget:ae?.kind==="chip"&&ae.dragging===!0&&ae.dropGroupId===He.groupId&&ae.dropGroupId===ae.sourceGroupId&&ae.dropIndex===en&&ae.sourceId!==dn.operation.id,onArmClose:vt,onDisarmClose:Ge,onClose:w,onMinimize:C,onFocus:x,onKeyboardMove:Ze,onPointerDragStart:Me,onOpenAccent:(ia,to)=>le({kind:"chip",operationId:ia,anchor:to}),onRename:z},dn.operation.id)})})]},He.groupId??"__ungrouped__")})})]},ce.id)})}),c.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Tt,onDoubleClick:Yn,"aria-hidden":"true"}),Ye?Qr.createPortal(c.jsx(XT,{anchor:Ye.anchor,viewportBounds:Ye.viewportBounds,placement:"cursor",catalog:h,canLaunch:p,renderKindIcon:_,onLaunchKind:(ce,ot)=>{Pe(null),b(ce,ot)},onClose:()=>Pe(null)},`${Ye.anchor.x}:${Ye.anchor.y}`),document.body):null,Je?.kind==="chip"&&V?c.jsx(GC,{kind:"chip",operation:V,groups:i.filter(ce=>ce.theaterId===V.theaterId),accentKey:W.operationAccent[V.id]??uy(V),anchor:Je.anchor,actions:{onSetAccent:ce=>I(V.id,ce),onSetGroupId:ce=>U(V.id,ce),onCreateGroup:ce=>A(V.theaterId,ce,V.id)},onClose:()=>le(null)}):Je?.kind==="group"&&ue?c.jsx(GC,{kind:"group-header",group:ue,anchor:Je.anchor,actions:{onSetColor:ce=>O(ue.id,ce),onRename:ce=>R(ue.id,ce),onUngroupAll:()=>J(ue.id)},onClose:()=>le(null)}):Je?.kind==="theater"&&be?c.jsx(u7,{theater:be,groupCount:i.filter(ce=>ce.theaterId===be.id).length,anchor:Je.anchor,onCreateGroup:ce=>{A(be.id,ce),Gt()},onForgetTheater:()=>{N(be.id),Gt()},onClose:Gt}):null,c.jsx(JT,{open:At,onCancel:$s,onConfirm:xi}),L?null:c.jsx(u8,{})]})}function s7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function r7(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function a7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function o7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function hA(e,t,n){const i=[...t].sort((h,p)=>h.order-p.order||h.createdAt-p.createdAt),r=i.map(h=>({groupId:h.id,group:h,entries:[]})),o={groupId:null,group:null,entries:[]},u=new Map(i.map(h=>[h.id,h]));for(const h of e){const p=h.operation.groupId??null;p!==null&&u.has(p)?r.find(g=>g.groupId===p)?.entries.push(h):o.entries.push(h)}return[...r,o]}function l7({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:r,operationNotifications:o,operationStatus:u,catalog:h,renderKindIcon:p}){return y0(t.filter(f=>f.theaterId===e),n).map(f=>{const g=dA(h,f),_=g?p(f.pluginId,g):null;return{operation:f,active:r===f.id,minimized:i.has(f.id),notificationCount:o[f.id]?1:0,status:u[f.id],icon:_}})}function fA({theater:e,operationCount:t,active:n,collapsed:i,dragging:r,dropTarget:o,dragOffsetY:u,onSelectTheater:h,onToggleCollapsed:p,onOpenActions:f,onOpenLaunch:g,onContextMenu:_,onPointerDragStart:b}){const S=v.useRef(!1),w=["side-bar-theater-header",n?"is-active":"",r?"side-bar-theater-header--dragging":"",o?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),C=r?{"--drag-dy":`${Math.round(u)}px`}:void 0,x=O=>{O.preventDefault(),_(O.currentTarget.getBoundingClientRect())},I=O=>{O.target===O.currentTarget&&(O.key!=="Enter"&&O.key!==" "||(O.preventDefault(),h(e.id)))},z=O=>{O.target instanceof Element&&O.target.closest("button")||b(O,e.id)},U=()=>{r&&(S.current=!0)},A=()=>{if(S.current){S.current=!1;return}h(e.id)};return c.jsxs("div",{role:"button",tabIndex:0,className:w,style:C,onClick:A,onKeyDown:I,onContextMenu:x,onPointerDown:z,onPointerUp:U,"aria-current":n?"true":void 0,"aria-expanded":!i,title:e.label,children:[c.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:A0(e.label)}),c.jsx("span",{className:"side-bar-theater-name",children:e.label}),c.jsx("span",{className:"side-bar-theater-count",children:t}),c.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[c.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":i?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!i,title:i?"Expand":"Collapse",onClick:O=>{O.stopPropagation(),p(e.id)},children:c.jsx(h7,{collapsed:i})}),c.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:O=>{O.stopPropagation(),f(O.currentTarget.getBoundingClientRect(),O.currentTarget)},children:c.jsx(f7,{})}),c.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-launch-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:O=>g(O,e.id),children:c.jsx(T0,{})})]})]})}function c7({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:r,operationCount:o,collapsed:u,dragging:h,dropBefore:p,dropAfter:f,dragOffsetY:g,onSelectTheater:_,onFocus:b,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:C,onContextMenu:x,onPointerDragStart:I}){const z=hA(t,n),U=z.some(A=>A.group!==null);return c.jsxs("li",{className:["side-bar-theater-section",p?"side-bar-theater-section--drop-before":"",f?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[c.jsx(fA,{theater:e,operationCount:o,active:!1,collapsed:u,dragging:h,dropTarget:p,dragOffsetY:g,onSelectTheater:_,onToggleCollapsed:S,onOpenActions:w,onOpenLaunch:C,onContextMenu:x,onPointerDragStart:I}),!u&&z.length>0?c.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${e.label} operations`,children:z.map(A=>{const O=A.groupId!==null&&i.has(A.groupId),R=A.group?Xa(A.group.color):null;return c.jsxs("li",{className:A.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:R?{"--grp-color":R}:void 0,children:[A.group?c.jsx(sA,{group:A.group,count:A.entries.length,collapsed:O,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:$=>fD(e.id,$),onContextMenu:()=>{},onPointerDragStart:()=>{}}):U&&A.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:c.jsx("span",{children:"Ungrouped"})}):null,O?null:c.jsx("ol",{className:"side-bar-group-chips","aria-label":A.group?A.group.name:"Ungrouped",children:A.entries.map(($,H)=>{const J=r[$.operation.id]??uy($.operation),Z=J?Xa(J):null;return c.jsx(iA,{entry:$,index:H,isCloseArmed:!1,accentValue:Z,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:b,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},$.operation.id)})})]},A.groupId??"__ungrouped__")})}):null]})}function u7({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:r,onClose:o}){const[u,h]=v.useState(!1),[p,f]=v.useState(`Group ${t+1}`),g=v.useRef(!1),_=v.useRef(null),b=v.useRef(null),[S,w]=v.useState(n.bottom+6);v.useLayoutEffect(()=>{const x=b.current?.getBoundingClientRect().height??0,I=window.innerHeight-x-8;w(Math.max(8,Math.min(n.bottom+6,I)))},[n,u]),v.useEffect(()=>{u&&_.current?.select()},[u]),v.useEffect(()=>{const x=I=>{I.key==="Escape"&&(I.preventDefault(),o())};return window.addEventListener("keydown",x),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",x),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const C=()=>{const x=p.trim();x&&i(x)};return Qr.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:c.jsxs("div",{ref:b,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:n.left,top:S},onPointerDown:x=>x.stopPropagation(),children:[u?c.jsx("input",{ref:_,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:x=>f(x.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:x=>{x.key==="Enter"&&!g.current&&(x.preventDefault(),C()),x.key==="Escape"&&(x.preventDefault(),h(!1))},onBlur:()=>h(!1),"aria-label":"New group name",placeholder:"Group name"}):c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>h(!0),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(T0,{})}),c.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),c.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:r,children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(m7,{})}),c.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function d7(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+JC?t.scrollTop-=QC:e>n.bottom-JC&&(t.scrollTop+=QC)}function h7({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?c.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):c.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function f7(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),c.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function T0(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function A0(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>p7(i)):pA(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function p7(e){return pA(e).slice(0,1)}function pA(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function m7(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function g7({theaters:e,operations:t,activeTheaterId:n,addingTheater:i,onSelectTheater:r,onAddTheater:o,style:u,containerRef:h}){const p=[e.map(f=>{const g=t.filter(_=>_.theaterId===f.id).length;return{key:f.id,role:"menuitemradio",label:f.label,checked:f.id===n,mark:A0(f.label),meta:`${g} ${g===1?"op":"ops"}`,onSelect:()=>r(f.id)}}),[{key:"__add-theater__",role:"menuitem",label:"Add Theater…",action:!0,disabled:i,onSelect:o}]];return c.jsx(mA,{menuLabel:"Switch Theater",sections:p,style:u,containerRef:h})}function _7({operations:e,activeOperationId:t,theaterLabel:n,onSelectOperation:i,onRenameOperation:r,onNewOperation:o,style:u,containerRef:h}){const p=[e.map(f=>({key:f.id,role:"menuitemradio",label:f.title,checked:f.id===t,meta:y7(f),onSelect:()=>i(f.id)})),[...r!==null?[{key:"__rename-operation__",role:"menuitem",label:"Rename current operation…",onSelect:r}]:[],{key:"__new-operation__",role:"menuitem",label:`New Operation in ${n}…`,action:!0,onSelect:o}]];return c.jsx(mA,{menuLabel:"Switch operation",sections:p,emptyNote:e.length===0?"No operations in this Theater":null,style:u,containerRef:h})}function mA({menuLabel:e,sections:t,emptyNote:n,style:i,containerRef:r}){const o=()=>Array.from(r.current?.querySelectorAll(".command-band-menu-item:not(:disabled)")??[]);v.useEffect(()=>{const p=o();(p.find(f=>f.getAttribute("aria-checked")==="true")??p[0])?.focus()},[]);const u=p=>{if(p.key!=="ArrowDown"&&p.key!=="ArrowUp"&&p.key!=="Home"&&p.key!=="End")return;const f=o();if(f.length===0)return;p.preventDefault();const g=f.findIndex(b=>b===document.activeElement),_=p.key==="Home"?0:p.key==="End"?f.length-1:p.key==="ArrowDown"?(g+1)%f.length:g<=0?f.length-1:g-1;f[_]?.focus()},h=t.filter(p=>p.length>0);return c.jsxs("div",{ref:r,className:"command-band-menu",role:"menu","aria-label":e,style:i,onKeyDown:u,children:[n?c.jsx("p",{className:"command-band-menu-empty",children:n}):null,h.map((p,f)=>c.jsxs(v.Fragment,{children:[f>0||n?c.jsx("div",{className:"command-band-menu-divider","aria-hidden":"true"}):null,p.map(g=>c.jsxs("button",{type:"button",role:g.role,"aria-checked":g.role==="menuitemradio"?g.checked===!0:void 0,className:`command-band-menu-item${g.checked?" is-active":""}${g.action?" command-band-menu-action":""}`,disabled:g.disabled,onClick:g.onSelect,children:[c.jsx("span",{className:"command-band-menu-check","aria-hidden":"true",children:g.checked?c.jsx(v7,{}):null}),g.mark!==void 0?c.jsx("span",{className:"command-band-theater-mark","aria-hidden":"true",children:g.mark}):null,c.jsx("span",{className:"command-band-menu-label",children:g.label}),g.meta?c.jsx("span",{className:"command-band-menu-meta",children:g.meta}):null]},g.key))]},p[0]?.key??f))]})}function k_(){return c.jsx("span",{className:"command-band-trigger-caret","aria-hidden":"true",children:c.jsx("svg",{viewBox:"0 0 10 10",children:c.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})}function v7(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function y7(e){const t=e.payload.cliLabel;if(typeof t=="string")return t;const n=e.payload.cliId;return typeof n=="string"?n:null}const lp="fleet-console.rail.activePanelId",gA="fleet-console.rail.chromeExpanded",_A="fleet-console.rail.panelBehavior",b7="fleet-console.repository.source",fy=new Set;let wi={activeRailPanelId:N7(),railChromeExpanded:L7(),panelExtraWidth:0,panelBehavior:M7()};function Wp(e){return fy.add(e),()=>{fy.delete(e)}}function qp(){return wi}function S7(e){wi.activeRailPanelId!==e&&(vc({...wi,activeRailPanelId:e,panelExtraWidth:0}),N0(e))}function w7(e){const t=wi.activeRailPanelId===e?null:e;vc({...wi,activeRailPanelId:t,panelExtraWidth:0}),N0(t)}function x7(e){S7(e)}function C7(){wi.activeRailPanelId!==null&&(vc({...wi,activeRailPanelId:null,panelExtraWidth:0}),N0(null))}function vA(e){wi.railChromeExpanded!==e&&(vc({...wi,railChromeExpanded:e}),j7(e))}function R0(){vA(!wi.railChromeExpanded)}function k7(e){wi.panelBehavior!==e&&(vc({...wi,panelBehavior:e}),O7(e))}function E7(){k7(wi.panelBehavior==="push"?"overlay":"push")}function T7(e,t){if(e!==wi.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),r=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;r!==wi.panelExtraWidth&&vc({...wi,panelExtraWidth:r})}function yA(){return v.useSyncExternalStore(Wp,qp).activeRailPanelId}function bA(){return v.useSyncExternalStore(Wp,qp).railChromeExpanded}function A7(){return v.useSyncExternalStore(Wp,qp).panelExtraWidth}function R7(){return v.useSyncExternalStore(Wp,qp).panelBehavior}function N7(){try{const e=localStorage.getItem(lp);if(e==="diff"||e==="history"){try{localStorage.setItem(lp,"repository"),e==="history"&&localStorage.setItem(b7,"history")}catch{}return"repository"}return e}catch{return null}}function L7(){try{return localStorage.getItem(gA)!=="0"}catch{return!0}}function M7(){try{const e=localStorage.getItem(_A);return e==="overlay"||e==="push"?e:"push"}catch{return"push"}}function N0(e){try{e===null?localStorage.removeItem(lp):localStorage.setItem(lp,e)}catch{}}function j7(e){try{localStorage.setItem(gA,e?"1":"0")}catch{}}function O7(e){try{localStorage.setItem(_A,e)}catch{}}function vc(e){wi=e;for(const t of fy)t()}function SA(e){const{sizeRange:t}=e,[n,i]=v.useState(""),[r,o]=v.useState(e.size),u=v.useRef(Promise.resolve()),h=v.useId(),p=v.useMemo(()=>D7(e),[e]),f=v.useMemo(()=>I7(p,n),[p,n]),g=v.useMemo(()=>f.map((R,$)=>({row:R,index:$})),[f]),[_,b]=v.useState(()=>B7(p,e.selected)),S=p.find(R=>cp(R.selection,e.selected))??null,w=g[Math.min(_,Math.max(0,g.length-1))]?.row??null,C=`${h}-built-ins`,x=`${h}-installed`;v.useEffect(()=>{o(e.size)},[e.size]),v.useEffect(()=>{_>=g.length&&b(Math.max(0,g.length-1))},[_,g.length]);const I=v.useCallback(R=>{const $=tk(R,t);o($),u.current=u.current.catch(()=>{}).then(()=>e.onSizeCommit($))},[e.onSizeCommit,t]),z=v.useCallback(R=>{f.length&&b($=>($+R+f.length)%f.length)},[f.length]),U=v.useCallback(()=>{w&&!w.unavailable&&e.onSelectionChange(w.selection)},[w,e]),A=v.useCallback((R,$)=>{b(R),e.onSelectionChange($)},[e]),O=R=>{R.key==="ArrowDown"?(R.preventDefault(),z(1)):R.key==="ArrowUp"?(R.preventDefault(),z(-1)):R.key==="Home"?(R.preventDefault(),b(0)):R.key==="End"?(R.preventDefault(),b(Math.max(0,f.length-1))):(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),U())};return c.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:c.jsxs("div",{className:"fc-font-browser__panes",children:[c.jsxs("div",{className:"fc-font-browser__chooser",children:[c.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${h}-search`,children:"Search fonts"}),c.jsx("input",{id:`${h}-search`,className:"fc-font-browser__search",type:"search",value:n,disabled:e.disabled,placeholder:"Search installed fonts",onChange:R=>{i(R.currentTarget.value),b(0)}}),e.loading?c.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?c.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,c.jsxs("div",{id:h,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":w?wA(h,_):void 0,"aria-busy":e.loading||void 0,onKeyDown:O,children:[c.jsx(ek,{groupId:C,label:"Built-in",rows:g.filter(({row:R})=>R.source==="builtin"),activeRow:w,selected:e.selected,listboxId:h,disabled:e.disabled,onSelect:A}),c.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),c.jsx(ek,{groupId:x,label:"Installed on this machine",rows:g.filter(({row:R})=>R.source==="system"),activeRow:w,selected:e.selected,listboxId:h,disabled:e.disabled,onSelect:A}),!e.loading&&!g.length?c.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),c.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[c.jsxs("div",{className:"fc-font-browser__preview-head",children:[c.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),c.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?"Unavailable":"Available"})]}),c.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${r}px`},children:e.previewText}),c.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r<=t.min,onClick:()=>I(r-t.step),"aria-label":"Decrease font size",children:"−"}),c.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[r,"px"]}),c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||r>=t.max,onClick:()=>I(r+t.step),"aria-label":"Increase font size",children:"+"})]}),c.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:r,disabled:e.disabled,"aria-label":"Font size slider",onChange:R=>o(tk(Number(R.currentTarget.value),t)),onPointerUp:R=>I(Number(R.currentTarget.value)),onKeyUp:R=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(R.key)&&I(Number(R.currentTarget.value))}})]})]})})}function ek({groupId:e,label:t,rows:n,activeRow:i,selected:r,listboxId:o,disabled:u,onSelect:h}){return c.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[c.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),n.map(({row:p,index:f})=>c.jsxs("button",{id:wA(o,f),type:"button",className:`fc-font-browser__row${cp(p.selection,i?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":cp(p.selection,r),disabled:u||p.unavailable,onClick:()=>h(f,p.selection),children:[c.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:p.previewFamily},children:p.label}),p.description?c.jsx("span",{className:"fc-font-browser__row-meta",children:p.description}):null,p.unavailable?c.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},p.id))]})}function D7(e){const t=new Set,n=e.builtIns.flatMap(o=>{const u=[o.id,o.label,...o.aliases??[]].map(id);return u.some(h=>t.has(h))?[]:(u.forEach(h=>t.add(h)),[{id:`builtin-${o.id}`,label:o.label,family:o.family,previewFamily:o.family,source:"builtin",selection:{source:"builtin",id:o.id},description:o.description,unavailable:!1}])}),i=e.installedFonts.map(o=>({id:`system-${id(o.family)}`,label:o.family,family:o.family,previewFamily:ip(o.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:o.family},description:o.monospace?"Monospace":"System font",unavailable:!UO(o.family)})),r=e.selected.source==="system"?e.selected.familyName:null;return r!==null&&!i.some(o=>o.family===r)&&i.unshift({id:`system-${id(r)}`,label:e.selectedSystemFont??r,family:r,previewFamily:ip(r,e.fallbackStack),source:"system",selection:{source:"system",familyName:r},description:"Saved system font",unavailable:!0}),[...n,...i]}function I7(e,t){const n=id(t);return n?e.filter(i=>id(`${i.label} ${i.description??""}`).includes(n)):e}function id(e){return e.trim().toLocaleLowerCase()}function wA(e,t){return`${e}-option-${t}`}function B7(e,t){const n=e.findIndex(i=>cp(i.selection,t));return n>=0?n:0}function cp(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function tk(e,t){if(!Number.isFinite(e))return t.defaultValue;const n=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,n))}const P7="/api/v1/settings/fonts/system";class Ul extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function $7(e){if(!CA(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new Ul("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(z7)}}async function xA(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new Ul("System font fetching is unavailable in this environment.");let n;try{n=await t(P7,{method:"GET",signal:e.signal})}catch(r){throw r instanceof DOMException&&r.name==="AbortError"?r:new Ul("System fonts could not be loaded.")}if(!n.ok)throw new Ul("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new Ul("System font response is not valid JSON.",n.status)}return $7(i)}function z7(e){if(!CA(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new Ul("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function H7(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function CA(e,t){return H7(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const nk=250,F7=5e3,ik=1,U7=1013,W7=4e3,q7=4001;function G7(e){const t=new AbortController,n=new TextEncoder;let i=nk,r=null,o=null,u=null,h=!1;const p=()=>{o?.dispose(),o=null},f=(b,S)=>{u={cols:b,rows:S},r?.readyState===ik&&r.send(JSON.stringify({type:"resize",cols:b,rows:S}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await V7(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await _(K7(b,e.location,e.wsPath),e),i=nk}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await X7(i,t.signal),i=Math.min(i*2,F7)}},_=async(b,S)=>{await new Promise((w,C)=>{const x=(S.webSocketFactory??Y7)(b);r=x,x.binaryType="arraybuffer",x.onopen=()=>{S.onStatus?.("live"),p(),o=S.terminal.onData(I=>{x.readyState===ik&&x.send(n.encode(I))}),u&&f(u.cols,u.rows)},x.onmessage=I=>{I.data instanceof ArrayBuffer&&S.terminal.write(new Uint8Array(I.data))},x.onerror=()=>{C(new Error("Terminal WebSocket error"))},x.onclose=I=>{p(),r===x&&(r=null);const z=I?.code;z===W7?(t.abort(),S.onStatus?.("closed","terminal_replaced")):z===q7?(t.abort(),S.onStatus?.("closed","terminal_closed"),S.onExit?.()):z===U7&&(t.abort(),S.onStatus?.("closed","terminal_unavailable")),w()}})};return{start:()=>{h||(h=!0,g())},resize:f,dispose:()=>{t.abort(),p(),e.onStatus?.("closed"),r?.close(),r=null}}}function K7(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function V7(e,t,n){const i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:n});if(!i.ok)throw new Error(`Terminal ticket request failed: ${i.status}`);const r=await i.json();if(typeof r.ticket!="string"||typeof r.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:r.ticket,ttlMs:r.ttlMs}}function Y7(e){return new WebSocket(e)}async function X7(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}var Z7=2,J7=1,Q7=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(){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:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),r=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),u={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},h=u.top+u.bottom,p=u.right+u.left,f=i-h,g=r-p-t;return{cols:Math.max(Z7,Math.floor(g/e.css.cell.width)),rows:Math.max(J7,Math.floor(f/e.css.cell.height))}}};var E_=[[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]],eB=[[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]],Zn;function tB(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var nB=class{constructor(){if(this.version="6",!Zn){Zn=new Uint8Array(65536),Zn.fill(1),Zn[0]=0,Zn.fill(0,1,32),Zn.fill(0,127,160),Zn.fill(2,4352,4448),Zn[9001]=2,Zn[9002]=2,Zn.fill(2,11904,42192),Zn[12351]=1,Zn.fill(2,44032,55204),Zn.fill(2,63744,64256),Zn.fill(2,65040,65050),Zn.fill(2,65072,65136),Zn.fill(2,65280,65377),Zn.fill(2,65504,65511);for(let t=0;t<E_.length;++t)Zn.fill(0,E_[t][0],E_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?Zn[t]:tB(t,eB)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=dp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return dp.createPropertyValue(0,i,r)}},iB=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?sk.isErrorNoTelemetry(t)?new sk(t.message+`
12
+
13
+ `+t.stack):new Error(t.message+`
14
+
15
+ `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(n=>{n(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},sB=new iB;function T_(e){rB(e)||sB.onUnexpectedError(e)}var py="Canceled";function rB(e){return e instanceof aB?!0:e instanceof Error&&e.name===py&&e.message===py}var aB=class extends Error{constructor(){super(py),this.name=this.message}},sk=class my extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof my)return t;let n=new my;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function oB(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var lB;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(lB||={});var kA;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function u(A){return A||n}e.from=u;function*h(A){for(let O=A.length-1;O>=0;O--)yield A[O]}e.reverse=h;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,O){let R=0;for(let $ of A)if(O($,R++))return!0;return!1}e.some=g;function _(A,O){for(let R of A)if(O(R))return R}e.find=_;function*b(A,O){for(let R of A)O(R)&&(yield R)}e.filter=b;function*S(A,O){let R=0;for(let $ of A)yield O($,R++)}e.map=S;function*w(A,O){let R=0;for(let $ of A)yield*O($,R++)}e.flatMap=w;function*C(...A){for(let O of A)yield*O}e.concat=C;function x(A,O,R){let $=R;for(let H of A)$=O($,H);return $}e.reduce=x;function*I(A,O,R=A.length){for(O<0&&(O+=A.length),R<0?R+=A.length:R>A.length&&(R=A.length);O<R;O++)yield A[O]}e.slice=I;function z(A,O=Number.POSITIVE_INFINITY){let R=[];if(O===0)return[R,A];let $=A[Symbol.iterator]();for(let H=0;H<O;H++){let J=$.next();if(J.done)return[R,e.empty()];R.push(J.value)}return[R,{[Symbol.iterator](){return $}}]}e.consume=z;async function U(A){let O=[];for await(let R of A)O.push(R);return Promise.resolve(O)}e.asyncToArray=U})(kA||={});function EA(e){if(kA.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}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 cB(...e){return TA(()=>EA(e))}function TA(e){return{dispose:oB(()=>{e()})}}var AA=class RA{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{EA(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?RA.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)}};AA.DISABLE_DISPOSED_WARNING=!1;var L0=AA,up=class{constructor(){this._store=new L0,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)}};up.None=Object.freeze({dispose(){}});var uB=globalThis.performance&&typeof globalThis.performance.now=="function",dB=class NA{static create(t){return new NA(t)}constructor(t){this._now=uB&&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}},hB;(e=>{e.None=()=>up.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,D=null,j)=>{let T=!1,B;return B=M(L=>{if(!T)return B?B.dispose():T=!0,N.call(D,L)},null,j),T&&B.dispose(),B}}e.once=n;function i(M,N,D){return f((j,T=null,B)=>M(L=>j.call(T,N(L)),null,B),D)}e.map=i;function r(M,N,D){return f((j,T=null,B)=>M(L=>{N(L),j.call(T,L)},null,B),D)}e.forEach=r;function o(M,N,D){return f((j,T=null,B)=>M(L=>N(L)&&j.call(T,L),null,B),D)}e.filter=o;function u(M){return M}e.signal=u;function h(...M){return(N,D=null,j)=>{let T=cB(...M.map(B=>B(L=>N.call(D,L))));return g(T,j)}}e.any=h;function p(M,N,D,j){let T=D;return i(M,B=>(T=N(T,B),T),j)}e.reduce=p;function f(M,N){let D,j={onWillAddFirstListener(){D=M(T.fire,T)},onDidRemoveLastListener(){D?.dispose()}},T=new Oa(j);return N?.add(T),T.event}function g(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,D=100,j=!1,T=!1,B,L){let F,W,E,G=0,Y,re={leakWarningThreshold:B,onWillAddFirstListener(){F=M(ae=>{G++,W=N(W,ae),j&&!E&&(he.fire(W),W=void 0),Y=()=>{let ke=W;W=void 0,E=void 0,(!j||G>1)&&he.fire(ke),G=0},typeof D=="number"?(clearTimeout(E),E=setTimeout(Y,D)):E===void 0&&(E=0,queueMicrotask(Y))})},onWillRemoveListener(){T&&G>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,F.dispose()}},he=new Oa(re);return L?.add(he),he.event}e.debounce=_;function b(M,N=0,D){return e.debounce(M,(j,T)=>j?(j.push(T),j):[T],N,void 0,!0,void 0,D)}e.accumulate=b;function S(M,N=(j,T)=>j===T,D){let j=!0,T;return o(M,B=>{let L=j||!N(B,T);return j=!1,T=B,L},D)}e.latch=S;function w(M,N,D){return[e.filter(M,N,D),e.filter(M,j=>!N(j),D)]}e.split=w;function C(M,N=!1,D=[],j){let T=D.slice(),B=M(W=>{T?T.push(W):F.fire(W)});j&&j.add(B);let L=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new Oa({onWillAddFirstListener(){B||(B=M(W=>F.fire(W)),j&&j.add(B))},onDidAddFirstListener(){T&&(N?setTimeout(L):L())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return j&&j.add(F),F.event}e.buffer=C;function x(M,N){return(D,j,T)=>{let B=N(new z);return M(function(L){let F=B.evaluate(L);F!==I&&D.call(j,F)},void 0,T)}}e.chain=x;let I=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:I),this}reduce(N,D){let j=D;return this.steps.push(T=>(j=N(j,T),j)),this}latch(N=(D,j)=>D===j){let D=!0,j;return this.steps.push(T=>{let B=D||!N(T,j);return D=!1,j=T,B?T:I}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===I)break;return N}}function U(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.on(N,j),B=()=>M.removeListener(N,j),L=new Oa({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromNodeEventEmitter=U;function A(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.addEventListener(N,j),B=()=>M.removeEventListener(N,j),L=new Oa({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromDOMEventEmitter=A;function O(M){return new Promise(N=>n(M)(N))}e.toPromise=O;function R(M){let N=new Oa;return M.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function $(M,N){return M(D=>N.fire(D))}e.forward=$;function H(M,N,D){return N(D),M(j=>N(j))}e.runAndSubscribe=H;class J{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Oa(j),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(M,N){return new J(M,N).emitter.event}e.fromObservable=Z;function K(M){return(N,D,j)=>{let T=0,B=!1,L={beginUpdate(){T++},endUpdate(){T--,T===0&&(M.reportChanges(),B&&(B=!1,N.call(D)))},handlePossibleChange(){},handleChange(){B=!0}};M.addObserver(L),M.reportChanges();let F={dispose(){M.removeObserver(L)}};return j instanceof L0?j.add(F):Array.isArray(j)&&j.push(F),F}}e.fromObservableLight=K})(hB||={});var gy=class _y{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${_y._idPool++}`,_y.all.add(this)}start(t){this._stopWatch=new dB,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}}};gy.all=new Set,gy._idPool=0;var fB=gy,pB=-1,LA=class MA{constructor(t,n,i=(MA._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new _B(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};LA._idPool=1;var mB=LA,gB=class jA{constructor(t){this.value=t}static create(){let t=new Error;return new jA(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},_B=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},vB=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},yB=0,A_=class{constructor(t){this.value=t,this.id=yB++}},bB=2,SB,Oa=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new mB(t?.onListenerError??T_,this._options?.leakWarningThreshold??pB):void 0,this._perfMon=this._options?._profName?new fB(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new vB(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||T_)(f),up.None}if(this._disposed)return up.None;n&&(t=t.bind(n));let r=new A_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gB.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof A_?(this._deliveryQueue??=new wB,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=TA(()=>{o?.(),this._removeListener(r)});return i instanceof L0?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-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--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*bB<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||T_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof A_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},wB=class{constructor(){this.i=-1,this.end=0}enqueue(t,n,i){this.i=0,this.end=i,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},dp=class Mf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Oa,this.onChange=this._onChange.event;let t=new nB;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,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?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,i=0,r=t.length;for(let o=0;o<r;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let f=t.charCodeAt(o);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let h=this.charProperties(u,i),p=Mf.extractWidth(h);Mf.extractShouldJoin(h)&&(p-=Mf.extractWidth(i)),n+=p,i=h}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},R_=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],xB=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],N_=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],CB=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],$r;function rk(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var kB=class{constructor(){if(this.version="11",!$r){$r=new Uint8Array(65536),$r.fill(1),$r[0]=0,$r.fill(0,1,32),$r.fill(0,127,160);for(let t=0;t<R_.length;++t)$r.fill(0,R_[t][0],R_[t][1]+1);for(let t=0;t<N_.length;++t)$r.fill(2,N_[t][0],N_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?$r[t]:rk(t,xB)?0:rk(t,CB)?2:1}charProperties(t,n){let i=this.wcwidth(t),r=i===0&&n!==0;if(r){let o=dp.extractWidth(n);o===0?r=!1:o>i&&(i=o)}return dp.createPropertyValue(0,i,r)}},EB=class{activate(t){t.unicode.register(new kB)}dispose(){}};var TB=(e,t,n,i)=>{for(var r=t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=u(r)||r);return r},AB=(e,t)=>(n,i)=>t(n,i,e),RB=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ak.isErrorNoTelemetry(e)?new ak(e.message+`
18
+
19
+ `+e.stack):new Error(e.message+`
20
+
21
+ `+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)}},NB=new RB;function L_(e){LB(e)||NB.onUnexpectedError(e)}var vy="Canceled";function LB(e){return e instanceof MB?!0:e instanceof Error&&e.name===vy&&e.message===vy}var MB=class extends Error{constructor(){super(vy),this.name=this.message}},ak=class yy extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof yy)return t;let n=new yy;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},jB;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(jB||={});function OB(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var OA;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function u(A){return A||n}e.from=u;function*h(A){for(let O=A.length-1;O>=0;O--)yield A[O]}e.reverse=h;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,O){let R=0;for(let $ of A)if(O($,R++))return!0;return!1}e.some=g;function _(A,O){for(let R of A)if(O(R))return R}e.find=_;function*b(A,O){for(let R of A)O(R)&&(yield R)}e.filter=b;function*S(A,O){let R=0;for(let $ of A)yield O($,R++)}e.map=S;function*w(A,O){let R=0;for(let $ of A)yield*O($,R++)}e.flatMap=w;function*C(...A){for(let O of A)yield*O}e.concat=C;function x(A,O,R){let $=R;for(let H of A)$=O($,H);return $}e.reduce=x;function*I(A,O,R=A.length){for(O<0&&(O+=A.length),R<0?R+=A.length:R>A.length&&(R=A.length);O<R;O++)yield A[O]}e.slice=I;function z(A,O=Number.POSITIVE_INFINITY){let R=[];if(O===0)return[R,A];let $=A[Symbol.iterator]();for(let H=0;H<O;H++){let J=$.next();if(J.done)return[R,e.empty()];R.push(J.value)}return[R,{[Symbol.iterator](){return $}}]}e.consume=z;async function U(A){let O=[];for await(let R of A)O.push(R);return Promise.resolve(O)}e.asyncToArray=U})(OA||={});function DA(e){if(OA.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}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 IA(...e){return Ai(()=>DA(e))}function Ai(e){return{dispose:OB(()=>{e()})}}var BA=class PA{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{DA(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?PA.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)}};BA.DISABLE_DISPOSED_WARNING=!1;var Zl=BA,Zs=class{constructor(){this._store=new Zl,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)}};Zs.None=Object.freeze({dispose(){}});var yu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},M0=typeof process<"u"&&"title"in process,Gp=M0?"node":navigator.userAgent,DB=M0?"node":navigator.platform,IB=Gp.includes("Firefox"),BB=Gp.includes("Edge"),$A=/^((?!chrome|android).)*safari/i.test(Gp);function PB(){if(!$A)return 0;let e=Gp.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}DB.indexOf("Linux")>=0;var $B="",ri=0,ai=0,oi=0,Mn=0,Rs={css:"#00000000",rgba:0},Di;(e=>{function t(r,o,u,h){return h!==void 0?`#${So(r)}${So(o)}${So(u)}${So(h)}`:`#${So(r)}${So(o)}${So(u)}`}e.toCss=t;function n(r,o,u,h=255){return(r<<24|o<<16|u<<8|h)>>>0}e.toRgba=n;function i(r,o,u,h){return{css:e.toCss(r,o,u,h),rgba:e.toRgba(r,o,u,h)}}e.toColor=i})(Di||={});var Wu;(e=>{function t(p,f){if(Mn=(f.rgba&255)/255,Mn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,C=p.rgba>>8&255;ri=S+Math.round((g-S)*Mn),ai=w+Math.round((_-w)*Mn),oi=C+Math.round((b-C)*Mn);let x=Di.toCss(ri,ai,oi),I=Di.toRgba(ri,ai,oi);return{css:x,rgba:I}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let _=Bo.ensureContrastRatio(p.rgba,f.rgba,g);if(_)return Di.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[ri,ai,oi]=Bo.toChannels(f),{css:Di.toCss(ri,ai,oi),rgba:f}}e.opaque=r;function o(p,f){return Mn=Math.round(f*255),[ri,ai,oi]=Bo.toChannels(p.rgba),{css:Di.toCss(ri,ai,oi,Mn),rgba:Di.toRgba(ri,ai,oi,Mn)}}e.opacity=o;function u(p,f){return Mn=p.rgba&255,o(p,Mn*f/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(Wu||={});var zB;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Di.toColor(ri,ai,oi);case 5:return ri=parseInt(r.slice(1,2).repeat(2),16),ai=parseInt(r.slice(2,3).repeat(2),16),oi=parseInt(r.slice(3,4).repeat(2),16),Mn=parseInt(r.slice(4,5).repeat(2),16),Di.toColor(ri,ai,oi,Mn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return ri=parseInt(o[1]),ai=parseInt(o[2]),oi=parseInt(o[3]),Mn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Di.toColor(ri,ai,oi,Mn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[ri,ai,oi,Mn]=t.getImageData(0,0,1,1).data,Mn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Di.toRgba(ri,ai,oi,Mn),css:r}}e.toColor=i})(zB||={});var Mi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,h=r/255,p=o/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(Mi||={});var Bo;(e=>{function t(u,h){if(Mn=(h&255)/255,Mn===1)return h;let p=h>>24&255,f=h>>16&255,g=h>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return ri=_+Math.round((p-_)*Mn),ai=b+Math.round((f-b)*Mn),oi=S+Math.round((g-S)*Mn),Di.toRgba(ri,ai,oi)}e.blend=t;function n(u,h,p){let f=Mi.relativeLuminance(u>>8),g=Mi.relativeLuminance(h>>8);if(zr(f,g)<p){if(g<f){let S=i(u,h,p),w=zr(f,Mi.relativeLuminance(S>>8));if(w<p){let C=r(u,h,p),x=zr(f,Mi.relativeLuminance(C>>8));return w>x?S:C}return S}let _=r(u,h,p),b=zr(f,Mi.relativeLuminance(_>>8));if(b<p){let S=i(u,h,p),w=zr(f,Mi.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,h,p){let f=u>>24&255,g=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,C=zr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(f,g,_));for(;C<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=zr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,h,p){let f=u>>24&255,g=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,C=zr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(f,g,_));for(;C<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=zr(Mi.relativeLuminance2(b,S,w),Mi.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(Bo||={});function So(e){let t=e.toString(16);return t.length<2?"0"+t:t}function zr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function qn(e){if(!e)throw new Error("value must not be falsy");return e}function j0(e){return 57508<=e&&e<=57558}function HB(e){return 57520<=e&&e<=57527}function FB(e){return 57344<=e&&e<=63743}function UB(e){return 9472<=e&&e<=9631}function WB(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function qB(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!WB(e)&&!j0(e)&&!FB(e)}function zA(e){return j0(e)||UB(e)}function GB(){return{css:{canvas:Xh(),cell:Xh()},device:{canvas:Xh(),cell:Xh(),char:{width:0,height:0,left:0,top:0}}}}function Xh(){return{width:0,height:0}}function KB(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var yi=0,ii=0,sr=!1,Hr=!1,Zh=!1,Xi,M_=0,VB=class{constructor(e,t,n,i,r,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=r,this._themeService=o,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,i){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,ii=0,yi=0,Hr=!1,sr=!1,Zh=!1,Xi=this._themeService.colors,M_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));M_=t*i%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",r=>{r.backgroundColorRGB&&(ii=r.backgroundColorRGB.rgba>>8&16777215,Hr=!0),r.foregroundColorRGB&&(yi=r.foregroundColorRGB.rgba>>8&16777215,sr=!0)}),Zh=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Zh){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ii=(this.result.fg&16777215)<<8|255;break;default:ii=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ii=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ii=(this.result.bg&16777215)<<8|255;break}ii=Bo.blend(ii,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ii=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Hr=!0,Xi.selectionForeground&&(yi=Xi.selectionForeground.rgba>>8&16777215,sr=!0),zA(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)yi=(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:yi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:yi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:yi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:yi=(this.result.fg&16777215)<<8|255;break;default:yi=this._themeService.colors.foreground.rgba}yi=Bo.blend(yi,(this._coreBrowserService.isFocused?Xi.selectionBackgroundOpaque:Xi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}sr=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",r=>{r.backgroundColorRGB&&(ii=r.backgroundColorRGB.rgba>>8&16777215,Hr=!0),r.foregroundColorRGB&&(yi=r.foregroundColorRGB.rgba>>8&16777215,sr=!0)}),Hr&&(Zh?ii=e.bg&-16777216&-134217729|ii|50331648:ii=e.bg&-16777216|ii|50331648),sr&&(yi=e.fg&-16777216&-67108865|yi|50331648),this.result.fg&67108864&&(Hr&&!sr&&((this.result.bg&50331648)===0?yi=this.result.fg&-134217728|Xi.background.rgba>>8&16777215&16777215|50331648:yi=this.result.fg&-134217728|this.result.bg&67108863,sr=!0),!Hr&&sr&&((this.result.fg&50331648)===0?ii=this.result.bg&-67108864|Xi.foreground.rgba>>8&16777215&16777215|50331648:ii=this.result.bg&-67108864|this.result.fg&67108863,Hr=!0)),Xi=void 0,this.result.bg=Hr?ii:this.result.bg,this.result.fg=sr?yi:this.result.fg,this.result.ext&=536870911,this.result.ext|=M_<<29&3758096384}},YB=.5,HA=IB||BB?"bottom":"ideographic",XB={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},ZB={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},JB={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},hd={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};hd[""]=hd[""];hd[""]=hd[""];function QB(e,t,n,i,r,o,u,h){let p=XB[t];if(p)return eP(e,p,n,i,r,o),!0;let f=ZB[t];if(f)return tP(e,f,n,i,r,o),!0;let g=JB[t];if(g)return nP(e,g,n,i,r,o,h),!0;let _=hd[t];return _?(iP(e,_,n,i,r,o,u,h),!0):!1}function eP(e,t,n,i,r,o){for(let u=0;u<t.length;u++){let h=t[u],p=r/8,f=o/8;e.fillRect(n+h.x*p,i+h.y*f,h.w*p,h.h*f)}}var ok=new Map;function tP(e,t,n,i,r,o){let u=ok.get(t);u||(u=new Map,ok.set(t,u));let h=e.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let p=u.get(h);if(!p){let f=t[0].length,g=t.length,_=e.canvas.ownerDocument.createElement("canvas");_.width=f,_.height=g;let b=qn(_.getContext("2d")),S=new ImageData(f,g),w,C,x,I;if(h.startsWith("#"))w=parseInt(h.slice(1,3),16),C=parseInt(h.slice(3,5),16),x=parseInt(h.slice(5,7),16),I=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[w,C,x,I]=h.substring(5,h.length-1).split(",").map(z=>parseFloat(z));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let z=0;z<g;z++)for(let U=0;U<f;U++)S.data[(z*f+U)*4]=w,S.data[(z*f+U)*4+1]=C,S.data[(z*f+U)*4+2]=x,S.data[(z*f+U)*4+3]=t[z][U]*(I*255);b.putImageData(S,0,0),p=qn(e.createPattern(_,null)),u.set(h,p)}e.fillStyle=p,e.fillRect(n,i,r,o)}function nP(e,t,n,i,r,o,u){e.strokeStyle=e.fillStyle;for(let[h,p]of Object.entries(t)){e.beginPath(),e.lineWidth=u*Number.parseInt(h);let f;if(typeof p=="function"){let g=.15/o*r;f=p(.15,g)}else f=p;for(let g of f.split(" ")){let _=g[0],b=FA[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,UA(S,r,o,n,i,!0,u))}e.stroke(),e.closePath()}}function iP(e,t,n,i,r,o,u,h){let p=new Path2D;p.rect(n,i,r,o),e.clip(p),e.beginPath();let f=u/12;e.lineWidth=h*f;for(let g of t.d.split(" ")){let _=g[0],b=FA[_];if(!b){console.error(`Could not find drawing instructions for "${_}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||b(e,UA(S,r,o,n,i,!1,h,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function lk(e,t,n=0){return Math.max(Math.min(e,t),n)}var FA={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function UA(e,t,n,i,r,o,u,h=0,p=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-h*u-p*u,o&&f[g]!==0&&(f[g]=lk(Math.round(f[g]+.5)-.5,t,0)),f[g]+=i+h*u;for(let g=1;g<f.length;g+=2)f[g]*=n,o&&f[g]!==0&&(f[g]=lk(Math.round(f[g]+.5)-.5,n,0)),f[g]+=r;return f}var ck=class{constructor(){this._data={}}set(t,n,i){this._data[t]||(this._data[t]={}),this._data[t][n]=i}get(t,n){return this._data[t]?this._data[t][n]:void 0}clear(){this._data={}}},uk=class{constructor(){this._data=new ck}set(e,t,n,i,r){this._data.get(e,t)||this._data.set(e,t,new ck),this._data.get(e,t).set(n,i,r)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},WA=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,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},sP=class extends WA{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let n=performance.now()+t;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},rP=class extends WA{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},aP=!M0&&"requestIdleCallback"in window?rP:sP,Wl=class qA{constructor(){this.fg=0,this.bg=0,this.extended=new GA}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 qA;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}},GA=class KA{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 KA(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oP=globalThis.performance&&typeof globalThis.performance.now=="function",lP=class VA{static create(t){return new VA(t)}constructor(t){this._now=oP&&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}},Kr;(e=>{e.None=()=>Zs.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,D=null,j)=>{let T=!1,B;return B=M(L=>{if(!T)return B?B.dispose():T=!0,N.call(D,L)},null,j),T&&B.dispose(),B}}e.once=n;function i(M,N,D){return f((j,T=null,B)=>M(L=>j.call(T,N(L)),null,B),D)}e.map=i;function r(M,N,D){return f((j,T=null,B)=>M(L=>{N(L),j.call(T,L)},null,B),D)}e.forEach=r;function o(M,N,D){return f((j,T=null,B)=>M(L=>N(L)&&j.call(T,L),null,B),D)}e.filter=o;function u(M){return M}e.signal=u;function h(...M){return(N,D=null,j)=>{let T=IA(...M.map(B=>B(L=>N.call(D,L))));return g(T,j)}}e.any=h;function p(M,N,D,j){let T=D;return i(M,B=>(T=N(T,B),T),j)}e.reduce=p;function f(M,N){let D,j={onWillAddFirstListener(){D=M(T.fire,T)},onDidRemoveLastListener(){D?.dispose()}},T=new vn(j);return N?.add(T),T.event}function g(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,D=100,j=!1,T=!1,B,L){let F,W,E,G=0,Y,re={leakWarningThreshold:B,onWillAddFirstListener(){F=M(ae=>{G++,W=N(W,ae),j&&!E&&(he.fire(W),W=void 0),Y=()=>{let ke=W;W=void 0,E=void 0,(!j||G>1)&&he.fire(ke),G=0},typeof D=="number"?(clearTimeout(E),E=setTimeout(Y,D)):E===void 0&&(E=0,queueMicrotask(Y))})},onWillRemoveListener(){T&&G>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,F.dispose()}},he=new vn(re);return L?.add(he),he.event}e.debounce=_;function b(M,N=0,D){return e.debounce(M,(j,T)=>j?(j.push(T),j):[T],N,void 0,!0,void 0,D)}e.accumulate=b;function S(M,N=(j,T)=>j===T,D){let j=!0,T;return o(M,B=>{let L=j||!N(B,T);return j=!1,T=B,L},D)}e.latch=S;function w(M,N,D){return[e.filter(M,N,D),e.filter(M,j=>!N(j),D)]}e.split=w;function C(M,N=!1,D=[],j){let T=D.slice(),B=M(W=>{T?T.push(W):F.fire(W)});j&&j.add(B);let L=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new vn({onWillAddFirstListener(){B||(B=M(W=>F.fire(W)),j&&j.add(B))},onDidAddFirstListener(){T&&(N?setTimeout(L):L())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return j&&j.add(F),F.event}e.buffer=C;function x(M,N){return(D,j,T)=>{let B=N(new z);return M(function(L){let F=B.evaluate(L);F!==I&&D.call(j,F)},void 0,T)}}e.chain=x;let I=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:I),this}reduce(N,D){let j=D;return this.steps.push(T=>(j=N(j,T),j)),this}latch(N=(D,j)=>D===j){let D=!0,j;return this.steps.push(T=>{let B=D||!N(T,j);return D=!1,j=T,B?T:I}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===I)break;return N}}function U(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.on(N,j),B=()=>M.removeListener(N,j),L=new vn({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromNodeEventEmitter=U;function A(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.addEventListener(N,j),B=()=>M.removeEventListener(N,j),L=new vn({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromDOMEventEmitter=A;function O(M){return new Promise(N=>n(M)(N))}e.toPromise=O;function R(M){let N=new vn;return M.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function $(M,N){return M(D=>N.fire(D))}e.forward=$;function H(M,N,D){return N(D),M(j=>N(j))}e.runAndSubscribe=H;class J{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new vn(j),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(M,N){return new J(M,N).emitter.event}e.fromObservable=Z;function K(M){return(N,D,j)=>{let T=0,B=!1,L={beginUpdate(){T++},endUpdate(){T--,T===0&&(M.reportChanges(),B&&(B=!1,N.call(D)))},handlePossibleChange(){},handleChange(){B=!0}};M.addObserver(L),M.reportChanges();let F={dispose(){M.removeObserver(L)}};return j instanceof Zl?j.add(F):Array.isArray(j)&&j.push(F),F}}e.fromObservableLight=K})(Kr||={});var by=class Sy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Sy._idPool++}`,Sy.all.add(this)}start(t){this._stopWatch=new lP,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}}};by.all=new Set,by._idPool=0;var cP=by,uP=-1,YA=class XA{constructor(t,n,i=(XA._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new fP(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};YA._idPool=1;var dP=YA,hP=class ZA{constructor(t){this.value=t}static create(){let t=new Error;return new ZA(t.stack??"")}print(){console.warn(this.value.split(`
22
+ `).slice(2).join(`
23
+ `))}},fP=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},pP=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},mP=0,j_=class{constructor(t){this.value=t,this.id=mP++}},gP=2,_P,vn=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new dP(t?.onListenerError??L_,this._options?.leakWarningThreshold??uP):void 0,this._perfMon=this._options?._profName?new cP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new pP(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||L_)(f),Zs.None}if(this._disposed)return Zs.None;n&&(t=t.bind(n));let r=new j_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=hP.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof j_?(this._deliveryQueue??=new vP,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=Ai(()=>{o?.(),this._removeListener(r)});return i instanceof Zl?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-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--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*gP<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||L_;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof j_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},vP=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}},dk={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},bu=2,Su,Da=class Il{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new uk,this._cacheMapCombined=new uk,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Wl,this._textureSize=512,this._onAddTextureAtlasCanvas=new vn,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new vn,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=JA(t,this._config.deviceCellWidth*4+bu*2,this._config.deviceCellHeight+bu*2),this._tmpCtx=qn(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new aP;for(let n=33;n<126;n++)t.enqueue(()=>{if(!this._cacheMap.get(n,0,0,0)){let i=this._drawToCache(n,0,0,0,!1,void 0);this._cacheMap.set(n,0,0,0,i)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Il.maxAtlasPages&&this._pages.length>=Math.max(4,Il.maxAtlasPages)){let n=this._pages.filter(f=>f.canvas.width*2<=(Il.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),i=-1,r=0;for(let f=0;f<n.length;f++)if(n[f].canvas.width!==r)i=f,r=n[f].canvas.width;else if(f-i===3)break;let o=n.slice(i,i+4),u=o.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),h=this.pages.length-o.length,p=this._mergePages(o,h);p.version++;for(let f=u.length-1;f>=0;f--)this._deletePage(u[f]);this.pages.push(p),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(p.canvas)}let t=new O_(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,n){let i=t[0].canvas.width*2,r=new O_(this._document,i,t);for(let[o,u]of t.entries()){let h=o*u.canvas.width%i,p=Math.floor(o/2)*u.canvas.height;r.ctx.drawImage(u.canvas,h,p);for(let g of u.glyphs)g.texturePage=n,g.sizeClipSpace.x=g.size.x/i,g.sizeClipSpace.y=g.size.y/i,g.texturePosition.x+=h,g.texturePosition.y+=p,g.texturePositionClipSpace.x=g.texturePosition.x/i,g.texturePositionClipSpace.y=g.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let f=this._activePages.indexOf(u);f!==-1&&this._activePages.splice(f,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let r of i.glyphs)r.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,r,o,u){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,r,o,u)}getRasterizedGlyph(t,n,i,r,o,u){return this._getFromCacheMap(this._cacheMap,t,n,i,r,o,u)}_getFromCacheMap(t,n,i,r,o,u,h){return Su=t.get(n,i,r,o),Su||(Su=this._drawToCache(n,i,r,o,u,h),t.set(n,i,r,o,Su)),Su}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,n,i,r){if(this._config.allowTransparency)return Rs;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let u=Wl.toColorRGB(n);o=Di.toColor(u[0],u[1],u[2]);break;default:i?o=Wu.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Wu.opaque(o)),o}_getForegroundColor(t,n,i,r,o,u,h,p,f,g){let _=this._getMinimumContrastColor(t,n,i,r,o,u,h,f,p,g);if(_)return _;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&u<8&&(u+=8),b=this._getColorFromAnsiIndex(u);break;case 50331648:let S=Wl.toColorRGB(u);b=Di.toColor(S[0],S[1],S[2]);break;default:h?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=Wu.opaque(b)),p&&(b=Wu.multiplyOpacity(b,YB)),b}_resolveBackgroundRgba(t,n,i){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,n,i,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&n<8&&(n+=8),this._getColorFromAnsiIndex(n).rgba;case 50331648:return n<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,n,i,r,o,u,h,p,f,g){if(this._config.minimumContrastRatio===1||g)return;let _=this._getContrastCache(f),b=_.getColor(t,r);if(b!==void 0)return b||void 0;let S=this._resolveBackgroundRgba(n,i,h),w=this._resolveForegroundRgba(o,u,h,p),C=Bo.ensureContrastRatio(S,w,this._config.minimumContrastRatio/(f?2:1));if(!C){_.setColor(t,r,null);return}let x=Di.toColor(C>>24&255,C>>16&255,C>>8&255);return _.setColor(t,r,x),x}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,r,o,u){let h=typeof t=="number"?String.fromCharCode(t):t;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let p=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+bu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<p&&(this._tmpCanvas.width=p);let f=Math.min(this._config.deviceCellHeight+bu*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=i,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return dk;let g=!!this._workAttributeData.isBold(),_=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),I=this._workAttributeData.getFgColor(),z=this._workAttributeData.getFgColorMode(),U=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(_){let W=I;I=U,U=W;let E=z;z=A,A=E}let O=this._getBackgroundColor(A,U,_,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let R=g?this._config.fontWeightBold:this._config.fontWeight,$=S?"italic":"";this._tmpCtx.font=`${$} ${R} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=HA;let H=h.length===1&&j0(h.charCodeAt(0)),J=h.length===1&&HB(h.charCodeAt(0)),Z=this._getForegroundColor(n,A,U,i,z,I,_,b,g,zA(h.charCodeAt(0)));this._tmpCtx.fillStyle=Z.css;let K=J?0:bu*2,M=!1;this._config.customGlyphs!==!1&&(M=QB(this._tmpCtx,h,K,K,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N=!H,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=W%2===1?.5:0;if(this._tmpCtx.lineWidth=W,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())N=!1,this._tmpCtx.strokeStyle=`rgb(${Wl.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{N=!1;let ke=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ke<8&&(ke+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ke).css}this._tmpCtx.beginPath();let G=K,Y=Math.ceil(K+this._config.deviceCharHeight)-E-(o?W*2:0),re=Y+W,he=Y+W*2,ae=this._workAttributeData.getUnderlineVariantOffset();for(let ke=0;ke<D;ke++){this._tmpCtx.save();let Re=G+ke*this._config.deviceCellWidth,De=G+(ke+1)*this._config.deviceCellWidth,Ue=Re+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Re,Y),this._tmpCtx.lineTo(De,Y),this._tmpCtx.moveTo(Re,he),this._tmpCtx.lineTo(De,he);break;case 3:let Oe=W<=1?he:Math.ceil(K+this._config.deviceCharHeight-W/2)-E,Le=W<=1?Y:Math.ceil(K+this._config.deviceCharHeight+W/2)-E,we=new Path2D;we.rect(Re,Y,this._config.deviceCellWidth,he-Y),this._tmpCtx.clip(we),this._tmpCtx.moveTo(Re-this._config.deviceCellWidth/2,re),this._tmpCtx.bezierCurveTo(Re-this._config.deviceCellWidth/2,Le,Re,Le,Re,re),this._tmpCtx.bezierCurveTo(Re,Oe,Ue,Oe,Ue,re),this._tmpCtx.bezierCurveTo(Ue,Le,De,Le,De,re),this._tmpCtx.bezierCurveTo(De,Oe,De+this._config.deviceCellWidth/2,Oe,De+this._config.deviceCellWidth/2,re);break;case 4:let Ie=ae===0?0:ae>=W?W*2-ae:W-ae;ae>=W||Ie===0?(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(Re+Ie,Y),this._tmpCtx.lineTo(De,Y)):(this._tmpCtx.setLineDash([Math.round(W),Math.round(W)]),this._tmpCtx.moveTo(Re,Y),this._tmpCtx.lineTo(Re+Ie,Y),this._tmpCtx.moveTo(Re+Ie+W,Y),this._tmpCtx.lineTo(De,Y)),ae=KB(De-Re,W,ae);break;case 5:let Qe=.6,dt=.3,Je=De-Re,le=Math.floor(Qe*Je),Ye=Math.floor(dt*Je),Pe=Je-le-Ye;this._tmpCtx.setLineDash([le,Ye,Pe]),this._tmpCtx.moveTo(Re,Y),this._tmpCtx.lineTo(De,Y);break;default:this._tmpCtx.moveTo(Re,Y),this._tmpCtx.lineTo(De,Y);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!M&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ke=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ke&&ke.actualBoundingBoxDescent>0){this._tmpCtx.save();let Re=new Path2D;Re.rect(G,Y-Math.ceil(W/2),this._config.deviceCellWidth*D,he-Y+Math.ceil(W/2)),this._tmpCtx.clip(Re),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=O.css,this._tmpCtx.strokeText(h,K,K+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),E=W%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+E),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*D,K+E),this._tmpCtx.stroke()}if(M||this._tmpCtx.fillText(h,K,K+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let W=D_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),O,Z,N);if(W)for(let E=1;E<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=O.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,K,K+this._config.deviceCharHeight-E),W=D_(this._tmpCtx.getImageData(K,K,this._config.deviceCellWidth,this._config.deviceCellHeight),O,Z,N),!!W);E++);}if(C){let W=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),E=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=W,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(K,K+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.lineTo(K+this._config.deviceCharWidth*D,K+Math.floor(this._config.deviceCharHeight/2)-E),this._tmpCtx.stroke()}this._tmpCtx.restore();let j=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),T;if(this._config.allowTransparency?T=yP(j):T=D_(j,O,Z,N),T)return dk;let B=this._findGlyphBoundingBox(j,this._workBoundingBox,p,J,M,K),L,F;for(;;){if(this._activePages.length===0){let W=this._createNewPage();L=W,F=W.currentRow,F.height=B.size.y;break}L=this._activePages[this._activePages.length-1],F=L.currentRow;for(let W of this._activePages)B.size.y<=W.currentRow.height&&(L=W,F=W.currentRow);for(let W=this._activePages.length-1;W>=0;W--)for(let E of this._activePages[W].fixedRows)E.height<=F.height&&B.size.y<=E.height&&(L=this._activePages[W],F=E);if(B.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new O_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),L=this._overflowSizePage,F=this._overflowSizePage.currentRow,F.x+B.size.x>=L.canvas.width&&(F.x=0,F.y+=F.height,F.height=0);break}if(F.y+B.size.y>=L.canvas.height||F.height>B.size.y+2){let W=!1;if(L.currentRow.y+L.currentRow.height+B.size.y>=L.canvas.height){let E;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+B.size.y<G.canvas.height){E=G;break}if(E)L=E;else if(Il.maxAtlasPages&&this._pages.length>=Il.maxAtlasPages&&F.y+B.size.y<=L.canvas.height&&F.height>=B.size.y&&F.x+B.size.x<=L.canvas.width)W=!0;else{let G=this._createNewPage();L=G,F=G.currentRow,F.height=B.size.y,W=!0}}W||(L.currentRow.height>0&&L.fixedRows.push(L.currentRow),F={x:0,y:L.currentRow.y+L.currentRow.height,height:B.size.y},L.fixedRows.push(F),L.currentRow={x:0,y:F.y+F.height,height:0})}if(F.x+B.size.x<=L.canvas.width)break;F===L.currentRow?(F.x=0,F.y+=F.height,F.height=0):L.fixedRows.splice(L.fixedRows.indexOf(F),1)}return B.texturePage=this._pages.indexOf(L),B.texturePosition.x=F.x,B.texturePosition.y=F.y,B.texturePositionClipSpace.x=F.x/L.canvas.width,B.texturePositionClipSpace.y=F.y/L.canvas.height,B.sizeClipSpace.x/=L.canvas.width,B.sizeClipSpace.y/=L.canvas.height,F.height=Math.max(F.height,B.size.y),F.x+=B.size.x,L.ctx.putImageData(j,B.texturePosition.x-this._workBoundingBox.left,B.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,B.size.x,B.size.y),L.addGlyph(B),L.version++,B}_findGlyphBoundingBox(t,n,i,r,o,u){n.top=0;let h=r?this._config.deviceCellHeight:this._tmpCanvas.height,p=r?this._config.deviceCellWidth:i,f=!1;for(let g=0;g<h;g++){for(let _=0;_<p;_++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.top=g,f=!0;break}}if(f)break}n.left=0,f=!1;for(let g=0;g<u+p;g++){for(let _=0;_<h;_++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.left=g,f=!0;break}}if(f)break}n.right=p,f=!1;for(let g=u+p-1;g>=u;g--){for(let _=0;_<h;_++){let b=_*this._tmpCanvas.width*4+g*4+3;if(t.data[b]!==0){n.right=g,f=!0;break}}if(f)break}n.bottom=h,f=!1;for(let g=h-1;g>=0;g--){for(let _=0;_<p;_++){let b=g*this._tmpCanvas.width*4+_*4+3;if(t.data[b]!==0){n.bottom=g,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:n.right-n.left+1,y:n.bottom-n.top+1},sizeClipSpace:{x:n.right-n.left+1,y:n.bottom-n.top+1},offset:{x:-n.left+u+(r||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+u+(r||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},O_=class{constructor(t,n,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let r of i)this._glyphs.push(...r.glyphs),this._usedPixels+=r._usedPixels;this.canvas=JA(t,n,n),this.ctx=qn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function D_(e,t,n,i){let r=t.rgba>>>24,o=t.rgba>>>16&255,u=t.rgba>>>8&255,h=n.rgba>>>24,p=n.rgba>>>16&255,f=n.rgba>>>8&255,g=Math.floor((Math.abs(r-h)+Math.abs(o-p)+Math.abs(u-f))/12),_=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===r&&e.data[b+1]===o&&e.data[b+2]===u||i&&Math.abs(e.data[b]-r)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-u)<g?e.data[b+3]=0:_=!1;return _}function yP(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function JA(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function bP(e,t,n,i,r,o,u,h){let p={foreground:o.foreground,background:o.background,cursor:Rs,cursorAccent:Rs,selectionForeground:Rs,selectionBackgroundTransparent:Rs,selectionBackgroundOpaque:Rs,selectionInactiveBackgroundTransparent:Rs,selectionInactiveBackgroundOpaque:Rs,overviewRulerBorder:Rs,scrollbarSliderBackground:Rs,scrollbarSliderHoverBackground:Rs,scrollbarSliderActiveBackground:Rs,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:h,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:p}}function hk(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function SP(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Os=[];function QA(e,t,n,i,r,o,u,h,p){let f=bP(i,r,o,u,t,n,h,p);for(let b=0;b<Os.length;b++){let S=Os[b],w=S.ownedBy.indexOf(e);if(w>=0){if(hk(S.config,f))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Os.splice(b,1)):S.ownedBy.splice(w,1);break}}for(let b=0;b<Os.length;b++){let S=Os[b];if(hk(S.config,f))return S.ownedBy.push(e),S.atlas}let g=e._core,_={atlas:new Da(document,f,g.unicodeService),config:f,ownedBy:[e]};return Os.push(_),_.atlas}function fk(e){for(let t=0;t<Os.length;t++){let n=Os[t].ownedBy.indexOf(e);if(n!==-1){Os[t].ownedBy.length===1?(Os[t].atlas.dispose(),Os.splice(t,1)):Os[t].ownedBy.splice(n,1);break}}}var Jh=600,wP=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Jh){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Jh-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Jh-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Jh)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function pk(e,t,n){let i=new t.ResizeObserver(r=>{let o=r.find(p=>p.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let u=o.devicePixelContentBoxSize[0].inlineSize,h=o.devicePixelContentBoxSize[0].blockSize;u>0&&h>0&&n(u,h)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return Ai(()=>i?.disconnect())}function xP(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var mk=class eR extends Wl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new GA,this.combinedData=""}static fromCharData(t){let n=new eR;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?xP(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 i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},tR=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function nR(e,t,n){let i=qn(e.createProgram());if(e.attachShader(i,qn(gk(e,e.VERTEX_SHADER,t))),e.attachShader(i,qn(gk(e,e.FRAGMENT_SHADER,n))),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS))return i;console.error(e.getProgramInfoLog(i)),e.deleteProgram(i)}function gk(e,t,n){let i=qn(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}function CP(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let r=0;r<e.length;r++)i[r]=e[r];return i}var kP=class{constructor(t){this.texture=t,this.version=-1}},EP=`#version 300 es
24
+ layout (location = 0) in vec2 a_unitquad;
25
+ layout (location = 1) in vec2 a_cellpos;
26
+ layout (location = 2) in vec2 a_offset;
27
+ layout (location = 3) in vec2 a_size;
28
+ layout (location = 4) in float a_texpage;
29
+ layout (location = 5) in vec2 a_texcoord;
30
+ layout (location = 6) in vec2 a_texsize;
31
+
32
+ uniform mat4 u_projection;
33
+ uniform vec2 u_resolution;
34
+
35
+ out vec2 v_texcoord;
36
+ flat out int v_texpage;
37
+
38
+ void main() {
39
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
40
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
41
+ v_texpage = int(a_texpage);
42
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
43
+ }`;function TP(e){let t="";for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
44
+ precision lowp float;
45
+
46
+ in vec2 v_texcoord;
47
+ flat in int v_texpage;
48
+
49
+ uniform sampler2D u_texture[${e}];
50
+
51
+ out vec4 outColor;
52
+
53
+ void main() {
54
+ if (v_texpage == 0) {
55
+ outColor = texture(u_texture[0], v_texcoord);
56
+ } ${t}
57
+ }`}var Ia=11,Al=Ia*Float32Array.BYTES_PER_ELEMENT,AP=2,Rn=0,gn,I_=0,wu=0,RP=class extends Zs{constructor(t,n,i,r){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Da.maxAtlasPages===void 0&&(Da.maxAtlasPages=Math.min(32,qn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Da.maxTextureSize=qn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=qn(nR(o,EP,TP(Da.maxAtlasPages))),this._register(Ai(()=>o.deleteProgram(this._program))),this._projectionLocation=qn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=qn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=qn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),h=o.createBuffer();this._register(Ai(()=>o.deleteBuffer(h))),o.bindBuffer(o.ARRAY_BUFFER,h),o.bufferData(o.ARRAY_BUFFER,u,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let p=new Uint8Array([0,1,2,3]),f=o.createBuffer();this._register(Ai(()=>o.deleteBuffer(f))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f),o.bufferData(o.ELEMENT_ARRAY_BUFFER,p,o.STATIC_DRAW),this._attributesBuffer=qn(o.createBuffer()),this._register(Ai(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Al,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Al,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Al,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Al,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Al,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Al,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let g=new Int32Array(Da.maxAtlasPages);for(let _=0;_<Da.maxAtlasPages;_++)g[_]=_;o.uniform1iv(this._textureLocation,g),o.uniformMatrix4fv(this._projectionLocation,!1,tR),this._atlasTextures=[];for(let _=0;_<Da.maxAtlasPages;_++){let b=new kP(qn(o.createTexture()));this._register(Ai(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+_),o.bindTexture(o.TEXTURE_2D,b.texture),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,1,1,0,o.RGBA,o.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[_]=b}o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,n,i,r,o,u,h,p,f){this._updateCell(this._vertices.attributes,t,n,i,r,o,u,h,p,f)}_updateCell(t,n,i,r,o,u,h,p,f,g){if(Rn=(i*this._terminal.cols+n)*Ia,r===0||r===void 0){t.fill(0,Rn,Rn+Ia-1-AP);return}this._atlas&&(p&&p.length>1?gn=this._atlas.getRasterizedGlyphCombinedChar(p,o,u,h,!1,this._terminal.element):gn=this._atlas.getRasterizedGlyph(r,o,u,h,!1,this._terminal.element),I_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==g&&gn.offset.x>I_?(wu=gn.offset.x-I_,t[Rn]=-(gn.offset.x-wu)+this._dimensions.device.char.left,t[Rn+1]=-gn.offset.y+this._dimensions.device.char.top,t[Rn+2]=(gn.size.x-wu)/this._dimensions.device.canvas.width,t[Rn+3]=gn.size.y/this._dimensions.device.canvas.height,t[Rn+4]=gn.texturePage,t[Rn+5]=gn.texturePositionClipSpace.x+wu/this._atlas.pages[gn.texturePage].canvas.width,t[Rn+6]=gn.texturePositionClipSpace.y,t[Rn+7]=gn.sizeClipSpace.x-wu/this._atlas.pages[gn.texturePage].canvas.width,t[Rn+8]=gn.sizeClipSpace.y):(t[Rn]=-gn.offset.x+this._dimensions.device.char.left,t[Rn+1]=-gn.offset.y+this._dimensions.device.char.top,t[Rn+2]=gn.size.x/this._dimensions.device.canvas.width,t[Rn+3]=gn.size.y/this._dimensions.device.canvas.height,t[Rn+4]=gn.texturePage,t[Rn+5]=gn.texturePositionClipSpace.x,t[Rn+6]=gn.texturePositionClipSpace.y,t[Rn+7]=gn.sizeClipSpace.x,t[Rn+8]=gn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&qB(r,f,gn.size.x,this._dimensions.device.cell.width)&&(t[Rn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*Ia;this._vertices.count!==n?this._vertices.attributes=new Float32Array(n):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==n?this._vertices.attributesBuffers[i]=new Float32Array(n):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=n,i=0;for(let r=0;r<t.rows;r++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=r/t.rows,i+=Ia}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let o=0;o<t.lineLengths.length;o++){let u=o*this._terminal.cols*Ia,h=this._vertices.attributes.subarray(u,u+t.lineLengths[o]*Ia);i.set(h,r),r+=h.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,r),n.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(n,this._atlas,o);n.drawElementsInstanced(n.TRIANGLE_STRIP,4,n.UNSIGNED_BYTE,0,r/Ia)}setAtlas(t){this._atlas=t;for(let n of this._atlasTextures)n.version=-1}_bindAtlasPageTexture(t,n,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=n.pages[i].version}setDimensions(t){this._dimensions=t}},NP=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(t,n,i,r=!1){if(this.selectionStart=n,this.selectionEnd=i,!n||!i||n[0]===i[0]&&n[1]===i[1]){this.clear();return}let o=t.buffers.active.ydisp,u=n[1]-o,h=i[1]-o,p=Math.max(u,0),f=Math.min(h,t.rows-1);if(p>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=u,this.viewportEndRow=h,this.viewportCappedStartRow=p,this.viewportCappedEndRow=f,this.startCol=n[0],this.endCol=i[0]}isCellSelected(t,n,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&i>=this.viewportCappedStartRow&&n<this.endCol&&i<=this.viewportCappedEndRow:n<this.startCol&&i>=this.viewportCappedStartRow&&n>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&n>=this.startCol):!1}};function LP(){return new NP}var hp=4,jf=1,Of=2,B_=3,MP=2147483648,jP=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=LP()}resize(t,n){let i=t*n*hp;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},OP=`#version 300 es
58
+ layout (location = 0) in vec2 a_position;
59
+ layout (location = 1) in vec2 a_size;
60
+ layout (location = 2) in vec4 a_color;
61
+ layout (location = 3) in vec2 a_unitquad;
62
+
63
+ uniform mat4 u_projection;
64
+
65
+ out vec4 v_color;
66
+
67
+ void main() {
68
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
69
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
70
+ v_color = a_color;
71
+ }`,DP=`#version 300 es
72
+ precision lowp float;
73
+
74
+ in vec4 v_color;
75
+
76
+ out vec4 outColor;
77
+
78
+ void main() {
79
+ outColor = v_color;
80
+ }`,Gr=8,P_=Gr*Float32Array.BYTES_PER_ELEMENT,IP=20*Gr,_k=class{constructor(){this.attributes=new Float32Array(IP),this.count=0}},Fr=0,vk=0,yk=0,bk=0,Sk=0,wk=0,xk=0,BP=class extends Zs{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new _k,this._verticesCursor=new _k;let r=this._gl;this._program=qn(nR(r,OP,DP)),this._register(Ai(()=>r.deleteProgram(this._program))),this._projectionLocation=qn(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),u=r.createBuffer();this._register(Ai(()=>r.deleteBuffer(u))),r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,o,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),p=r.createBuffer();this._register(Ai(()=>r.deleteBuffer(p))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,p),r.bufferData(r.ELEMENT_ARRAY_BUFFER,h,r.STATIC_DRAW),this._attributesBuffer=qn(r.createBuffer()),this._register(Ai(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,P_,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,P_,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,P_,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(i.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,tR),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,i=1,r,o,u,h,p,f,g,_,b,S,w;for(r=0;r<t.rows;r++){for(u=-1,h=0,p=0,f=!1,o=0;o<t.cols;o++)g=(r*t.cols+o)*hp,_=e.cells[g+jf],b=e.cells[g+Of],S=!!(b&67108864),(_!==h||b!==p&&(f||S))&&((h!==0||f&&p!==0)&&(w=i++*Gr,this._updateRectangle(n,w,p,h,u,o,r)),u=o,h=_,p=b,f=S);(h!==0||f&&p!==0)&&(w=i++*Gr,this._updateRectangle(n,w,p,h,u,t.cols,r))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,r=0;(n.style==="bar"||n.style==="outline")&&(i=r++*Gr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style==="bar"?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style==="underline"||n.style==="outline")&&(i=r++*Gr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style==="outline"&&(i=r++*Gr,this._addRectangleFloat(t.attributes,i,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),i=r++*Gr,this._addRectangleFloat(t.attributes,i,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,n,i,r,o,u){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Fr=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Fr=(n&16777215)<<8;break;default:Fr=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:Fr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Fr=(i&16777215)<<8;break;default:Fr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=CP(e.attributes,this._terminal.rows*this._terminal.cols*Gr)),vk=r*this._dimensions.device.cell.width,yk=u*this._dimensions.device.cell.height,bk=(Fr>>24&255)/255,Sk=(Fr>>16&255)/255,wk=(Fr>>8&255)/255,xk=1,this._addRectangle(e.attributes,t,vk,yk,(o-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,bk,Sk,wk,xk)}_addRectangle(e,t,n,i,r,o,u,h,p,f){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u,e[t+5]=h,e[t+6]=p,e[t+7]=f}_addRectangleFloat(e,t,n,i,r,o,u){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=u[0],e[t+5]=u[1],e[t+6]=u[2],e[t+7]=u[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},PP=class extends Zs{constructor(t,n,i,r,o,u,h,p){super(),this._container=n,this._alpha=o,this._coreBrowserService=u,this._optionsService=h,this._themeService=p,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(Ai(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=qn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,n,i){}handleSelectionChanged(t,n,i,r=!1){}_setTransparency(t,n){if(n===this._alpha)return;let i=this._canvas;this._alpha=n,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,n){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=QA(t,this._optionsService.rawOptions,n,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,n){this._deviceCellWidth=n.device.cell.width,this._deviceCellHeight=n.device.cell.height,this._deviceCharWidth=n.device.char.width,this._deviceCharHeight=n.device.char.height,this._deviceCharLeft=n.device.char.left,this._deviceCharTop=n.device.char.top,this._canvas.width=n.device.canvas.width,this._canvas.height=n.device.canvas.height,this._canvas.style.width=`${n.css.canvas.width}px`,this._canvas.style.height=`${n.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,n,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(n+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,n,i,r){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,r){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=HA,this._clipCell(i,r,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,n,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,n,i){let r=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${r} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},$P=class extends PP{constructor(t,n,i,r,o,u,h){super(i,t,"link",n,!0,o,u,h),this._register(r.onShowLinkUnderline(p=>this._handleShowLinkUnderline(p))),this._register(r.onHideLinkUnderline(p=>this._handleHideLinkUnderline(p)))}resize(t,n){super.resize(t,n),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&SP(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let n=t.y1+1;n<t.y2;n++)this._fillBottomLineAtCells(0,n,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ro=typeof window=="object"?window:globalThis,wy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new vn,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new vn,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 i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}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 i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};wy.INSTANCE=new wy;var iR=wy;function zP(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}iR.INSTANCE.onDidChangeZoomLevel;iR.INSTANCE.onDidChangeFullscreen;var yc=typeof navigator=="object"?navigator.userAgent:"";yc.indexOf("Firefox")>=0;yc.indexOf("AppleWebKit")>=0;var HP=yc.indexOf("Chrome")>=0;!HP&&yc.indexOf("Safari")>=0;yc.indexOf("Electron/")>=0;yc.indexOf("Android")>=0;var $_=!1;if(typeof Ro.matchMedia=="function"){let e=Ro.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ro.matchMedia("(display-mode: fullscreen)");$_=e.matches,zP(Ro,e,({matches:n})=>{$_&&t.matches||($_=n)})}var ql="en",z_=!1,sR=!1,Qh,Df=ql,Ck=ql,FP,Wr,Po=globalThis,ds;typeof Po.vscode<"u"&&typeof Po.vscode.process<"u"?ds=Po.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ds=process);var UP=typeof ds?.versions?.electron=="string",WP=UP&&ds?.type==="renderer";if(typeof ds=="object"){ds.platform,ds.platform,z_=ds.platform==="linux",z_&&ds.env.SNAP&&ds.env.SNAP_REVISION,ds.env.CI||ds.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Qh=ql,Df=ql;let e=ds.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Qh=t.userLocale,Ck=t.osLocale,Df=t.resolvedLanguage||ql,FP=t.languagePack?.translationsConfigFile}catch{}sR=!0}else typeof navigator=="object"&&!WP?(Wr=navigator.userAgent,Wr.indexOf("Windows")>=0,Wr.indexOf("Macintosh")>=0,(Wr.indexOf("Macintosh")>=0||Wr.indexOf("iPad")>=0||Wr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,z_=Wr.indexOf("Linux")>=0,Wr?.indexOf("Mobi")>=0,Df=globalThis._VSCODE_NLS_LANGUAGE||ql,Qh=navigator.language.toLowerCase(),Ck=Qh):console.error("Unable to resolve platform.");var kk=sR,pr=Wr,Ra=Df,qP;(e=>{function t(){return Ra}e.value=t;function n(){return Ra.length===2?Ra==="en":Ra.length>=3?Ra[0]==="e"&&Ra[1]==="n"&&Ra[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ra==="en"}e.isDefault=i})(qP||={});var GP=typeof Po.postMessage=="function"&&!Po.importScripts;(()=>{if(GP){let e=[];Po.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),Po.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var KP=!!(pr&&pr.indexOf("Chrome")>=0);pr&&pr.indexOf("Firefox")>=0;!KP&&pr&&pr.indexOf("Safari")>=0;pr&&pr.indexOf("Edg/")>=0;pr&&pr.indexOf("Android")>=0;var Rl=typeof navigator=="object"?navigator:{};kk||document.queryCommandSupported&&document.queryCommandSupported("copy")||Rl&&Rl.clipboard&&Rl.clipboard.writeText,kk||Rl&&Rl.clipboard&&Rl.clipboard.readText;var O0=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}},H_=new O0,Ek=new O0,Tk=new O0;new Array(230);var VP;(e=>{function t(h){return H_.keyCodeToStr(h)}e.toString=t;function n(h){return H_.strToKeyCode(h)}e.fromString=n;function i(h){return Ek.keyCodeToStr(h)}e.toUserSettingsUS=i;function r(h){return Tk.keyCodeToStr(h)}e.toUserSettingsGeneral=r;function o(h){return Ek.strToKeyCode(h)||Tk.strToKeyCode(h)}e.fromUserSettings=o;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return H_.keyCodeToStr(h)}e.toElectronAccelerator=u})(VP||={});var rR=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),YP;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof XP?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rR})})(YP||={});var XP=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?rR:(this._emitter||(this._emitter=new vn),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},ZP;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.then(h=>h,h=>{r||(r=h)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(u){o(u)}})}e.withAsyncBody=n})(ZP||={});var Ak=class Ns{static fromArray(t){return new Ns(n=>{n.emitMany(t)})}static fromPromise(t){return new Ns(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ns(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ns(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new vn,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 Kr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ns(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ns.map(this,t)}static filter(t,n){return new Ns(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ns.filter(this,t)}static coalesce(t){return Ns.filter(t,n=>!!n)}coalesce(){return Ns.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ns.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())}};Ak.EMPTY=Ak.fromArray([]);var{getWindow:JP}=(function(){let e=new Map,t={window:Ro,disposables:new Zl};e.set(Ro.vscodeWindowId,t);let n=new vn,i=new vn,r=new vn;function o(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Zs.None;let h=new Zl,p={window:u,disposables:h.add(new Zl)};return e.set(u.vscodeWindowId,p),h.add(Ai(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),h.add(xy(u,e$.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(p),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let p=u;return p?.view?p.view.window:Ro},getDocument(u){return JP(u).document}}})(),QP=class{constructor(t,n,i,r){this._node=t,this._type=n,this._handler=i,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 xy(e,t,n,i){return new QP(e,t,n,i)}var e$={BEFORE_UNLOAD:"beforeunload"},t$=class extends Zs{constructor(t,n,i,r,o,u,h,p,f){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=r,this._coreService=o,this._decorationService=u,this._optionsService=h,this._themeService=p,this._cursorBlinkStateManager=new yu,this._charAtlasDisposable=this._register(new yu),this._observerDisposable=this._register(new yu),this._model=new jP,this._workCell=new mk,this._workCell2=new mk,this._rectangleRenderer=this._register(new yu),this._glyphRenderer=this._register(new yu),this._onChangeTextureAtlas=this._register(new vn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new vn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new vn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new vn),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new vn),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let g={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",g),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new VB(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new $P(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,h,this._themeService)],this.dimensions=GB(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(h.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(xy(this._canvas,"webglcontextlost",_=>{console.log("webglcontextlost event received"),_.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(_)},3e3)})),this._register(xy(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,fk(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pk(this._canvas,this._coreBrowserService.window,(_,b)=>this._setCanvasDevicePixelDimensions(_,b)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=pk(this._canvas,_,(b,S)=>this._setCanvasDevicePixelDimensions(b,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Ai(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),fk(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,n){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,n,i){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,t,n,i);this._model.selection.update(this._core,t,n,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new BP(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new RP(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=QA(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=IA(Kr.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Kr.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,n){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,n);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,n),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new wP(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,r=this._workCell,o,u,h,p,f,g,_=0,b=!0,S,w,C,x,I,z,U,A,O;t=Rk(t,i.rows-1,0),n=Rk(n,i.rows-1,0);let R=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",$=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,H=$-i.buffer.ydisp,J=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Z=-1,K=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let M=!1;for(u=t;u<=n;u++)for(h=u+i.buffer.ydisp,p=i.buffer.lines.get(h),this._model.lineLengths[u]=0,C=$===h,_=0,f=this._characterJoinerService.getJoinedCharacters(h),A=0;A<i.cols;A++){if(o=this._cellColorResolver.result.bg,p.loadCell(A,r),A===0&&(o=this._cellColorResolver.result.bg),g=!1,b=A>=_,S=A,f.length>0&&A===f[0][0]&&b){w=f.shift();let N=this._model.selection.isCellSelected(this._terminal,w[0],h);for(U=w[0]+1;U<w[1];U++)b&&=N===this._model.selection.isCellSelected(this._terminal,U,h);b&&=!C||J<w[0]||J>=w[1],b?(g=!0,r=new n$(r,p.translateToString(!0,w[0],w[1]),w[1]-w[0]),S=w[1]-1):_=w[1]}if(x=r.getChars(),I=r.getCode(),U=(u*i.cols+A)*hp,this._cellColorResolver.resolve(r,A,h,this.dimensions.device.cell.width),K&&h===$&&(A===J&&(this._model.cursor={x:J,y:H,width:r.getWidth(),style:this._coreBrowserService.isFocused?R:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Z=J+r.getWidth()-1),A>=J&&A<=Z&&(this._coreBrowserService.isFocused&&R==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),I!==0&&(this._model.lineLengths[u]=A+1),!(this._model.cells[U]===I&&this._model.cells[U+jf]===this._cellColorResolver.result.bg&&this._model.cells[U+Of]===this._cellColorResolver.result.fg&&this._model.cells[U+B_]===this._cellColorResolver.result.ext)&&(M=!0,x.length>1&&(I|=MP),this._model.cells[U]=I,this._model.cells[U+jf]=this._cellColorResolver.result.bg,this._model.cells[U+Of]=this._cellColorResolver.result.fg,this._model.cells[U+B_]=this._cellColorResolver.result.ext,z=r.getWidth(),this._glyphRenderer.value.updateCell(A,u,I,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,x,z,o),g)){for(r=this._workCell,A++;A<=S;A++)O=(u*i.cols+A)*hp,this._glyphRenderer.value.updateCell(A,u,0,0,0,0,$B,0,0),this._model.cells[O]=0,this._model.cells[O+jf]=this._cellColorResolver.result.bg,this._model.cells[O+Of]=this._cellColorResolver.result.fg,this._model.cells[O+B_]=this._cellColorResolver.result.ext;A--}}M&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,n){this._canvas.width===t&&this._canvas.height===n||(this._canvas.width=t,this._canvas.height=n,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},n$=class extends Wl{constructor(t,n,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=n,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Rk(e,t,n=0){return Math.max(Math.min(e,t),n)}var Nk="di$target",Lk="di$dependencies",F_=new Map;function br(e){if(F_.has(e))return F_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");i$(t,n,r)};return t._id=e,F_.set(e,t),t}function i$(e,t,n){t[Nk]===t?t[Lk].push({id:e,index:n}):(t[Lk]=[{id:e,index:n}],t[Nk]=t)}br("BufferService");br("CoreMouseService");br("CoreService");br("CharsetService");br("InstantiationService");br("LogService");var s$=br("OptionsService");br("OscLinkService");br("UnicodeService");br("DecorationService");var r$={trace:0,debug:1,info:2,warn:3,error:4,off:5},a$="xterm.js: ",Mk=class extends Zs{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=r$[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let n=0;n<t.length;n++)typeof t[n]=="function"&&(t[n]=t[n]())}_log(t,n,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":a$)+n,...i)}trace(t,...n){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,n)}debug(t,...n){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,n)}info(t,...n){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,n)}warn(t,...n){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,n)}error(t,...n){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,n)}};Mk=TB([AB(0,s$)],Mk);var o$=class extends Zs{constructor(t){if($A&&PB()<16){let n={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",n))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new vn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new vn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new vn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new vn),this.onContextLoss=this._onContextLoss.event}activate(t){let n=t._core;if(!t.element){this._register(n.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=n.coreService,r=n.optionsService,o=n,u=o._renderService,h=o._characterJoinerService,p=o._charSizeService,f=o._coreBrowserService,g=o._decorationService;o._logService;let _=o._themeService;this._renderer=this._register(new t$(t,h,p,f,i,g,r,_,this._preserveDrawingBuffer)),this._register(Kr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Kr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Kr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Kr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),u.setRenderer(this._renderer),this._register(Ai(()=>{if(this._terminal._core._store._isDisposed)return;let b=this._terminal._core._renderService;b.setRenderer(this._terminal._core._createRenderer()),b.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var aR=Object.defineProperty,l$=Object.getOwnPropertyDescriptor,c$=(e,t)=>{for(var n in t)aR(e,n,{get:t[n],enumerable:!0})},On=(e,t,n,i)=>{for(var r=i>1?void 0:i?l$(t,n):t,o=e.length-1,u;o>=0;o--)(u=e[o])&&(r=(i?u(t,n,r):u(r))||r);return i&&r&&aR(t,n,r),r},Be=(e,t)=>(n,i)=>t(n,i,e),jk="Terminal input",Cy={get:()=>jk,set:e=>jk=e},Ok="Too much output to announce, navigate to rows manually to read",ky={get:()=>Ok,set:e=>Ok=e};function u$(e){return e.replace(/\r?\n/g,"\r")}function d$(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function h$(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function f$(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");oR(r,t,n,i)}}function oR(e,t,n,i){e=u$(e),e=d$(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function lR(e,t,n){let i=n.getBoundingClientRect(),r=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function Dk(e,t,n,i,r){lR(e,t,n),r&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Pa(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Kp(e,t=0,n=e.length){let i="";for(let r=t;r<n;++r){let o=e[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var p$=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r=0;if(this._interim){let o=e.charCodeAt(r++);56320<=o&&o<=57343?t[i++]=(this._interim-55296)*1024+o-56320+65536:(t[i++]=this._interim,t[i++]=o),this._interim=0}for(let o=r;o<n;++o){let u=e.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=n)return this._interim=u,i;let h=e.charCodeAt(o);56320<=h&&h<=57343?t[i++]=(u-55296)*1024+h-56320+65536:(t[i++]=u,t[i++]=h);continue}u!==65279&&(t[i++]=u)}return i}},m$=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,r,o,u,h,p=0,f=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let w=0,C;for(;(C=this.interim[++w]&63)&&w<4;)S<<=6,S|=C;let x=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,I=x-w;for(;f<I;){if(f>=n)return 0;if(C=e[f++],(C&192)!==128){f--,b=!0;break}else this.interim[w++]=C,S<<=6,S|=C&63}b||(x===2?S<128?f--:t[i++]=S:x===3?S<2048||S>=55296&&S<=57343||S===65279||(t[i++]=S):S<65536||S>1114111||(t[i++]=S)),this.interim.fill(0)}let g=n-4,_=f;for(;_<n;){for(;_<g&&!((r=e[_])&128)&&!((o=e[_+1])&128)&&!((u=e[_+2])&128)&&!((h=e[_+3])&128);)t[i++]=r,t[i++]=o,t[i++]=u,t[i++]=h,_+=4;if(r=e[_++],r<128)t[i++]=r;else if((r&224)===192){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(p=(r&31)<<6|o&63,p<128){_--;continue}t[i++]=p}else if((r&240)===224){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(p=(r&15)<<12|(o&63)<<6|u&63,p<2048||p>=55296&&p<=57343||p===65279)continue;t[i++]=p}else if((r&248)===240){if(_>=n)return this.interim[0]=r,i;if(o=e[_++],(o&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,i;if(u=e[_++],(u&192)!==128){_--;continue}if(_>=n)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=u,i;if(h=e[_++],(h&192)!==128){_--;continue}if(p=(r&7)<<18|(o&63)<<12|(u&63)<<6|h&63,p<65536||p>1114111)continue;t[i++]=p}}return i}},cR="",Fa=" ",Ad=class uR{constructor(){this.fg=0,this.bg=0,this.extended=new fp}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 uR;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}},fp=class dR{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 dR(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Is=class hR extends Ad{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fp,this.combinedData=""}static fromCharData(t){let n=new hR;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?Pa(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 i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ik="di$target",Ey="di$dependencies",U_=new Map;function g$(e){return e[Ey]||[]}function fi(e){if(U_.has(e))return U_.get(e);let t=function(n,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_$(t,n,r)};return t._id=e,U_.set(e,t),t}function _$(e,t,n){t[Ik]===t?t[Ey].push({id:e,index:n}):(t[Ey]=[{id:e,index:n}],t[Ik]=t)}var zi=fi("BufferService"),fR=fi("CoreMouseService"),Ko=fi("CoreService"),v$=fi("CharsetService"),D0=fi("InstantiationService"),pR=fi("LogService"),Hi=fi("OptionsService"),mR=fi("OscLinkService"),y$=fi("UnicodeService"),Rd=fi("DecorationService"),Ty=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new Is,u=n.getTrimmedLength(),h=-1,p=-1,f=!1;for(let g=0;g<u;g++)if(!(p===-1&&!n.hasContent(g))){if(n.loadCell(g,o),o.hasExtendedAttrs()&&o.extended.urlId)if(p===-1){p=g,h=o.extended.urlId;continue}else f=o.extended.urlId!==h;else p!==-1&&(f=!0);if(f||p!==-1&&g===u-1){let _=this._oscLinkService.getLinkData(h)?.uri;if(_){let b={start:{x:p+1,y:e},end:{x:g+(!f&&g===u-1?1:0),y:e}},S=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(_);["http:","https:"].includes(w.protocol)||(S=!0)}catch{S=!0}S||i.push({text:_,range:b,activate:(w,C)=>r?r.activate(w,C,b):b$(w,C),hover:(w,C)=>r?.hover?.(w,C,b),leave:(w,C)=>r?.leave?.(w,C,b)})}f=!1,o.hasExtendedAttrs()&&o.extended.urlId?(p=g,h=o.extended.urlId):(p=-1,h=-1)}}t(i)}};Ty=On([Be(0,zi),Be(1,Hi),Be(2,mR)],Ty);function b$(e,t){if(confirm(`Do you want to navigate to ${t}?
81
+
82
+ 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 Vp=fi("CharSizeService"),ea=fi("CoreBrowserService"),I0=fi("MouseService"),ta=fi("RenderService"),S$=fi("SelectionService"),gR=fi("CharacterJoinerService"),bc=fi("ThemeService"),_R=fi("LinkProviderService"),w$=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Bk.isErrorNoTelemetry(e)?new Bk(e.message+`
83
+
84
+ `+e.stack):new Error(e.message+`
85
+
86
+ `+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)}},x$=new w$;function If(e){C$(e)||x$.onUnexpectedError(e)}var Ay="Canceled";function C$(e){return e instanceof k$?!0:e instanceof Error&&e.name===Ay&&e.message===Ay}var k$=class extends Error{constructor(){super(Ay),this.name=this.message}};function E$(e){return new Error(`Illegal argument: ${e}`)}var Bk=class Ry extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ry)return t;let n=new Ry;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ny=class vR extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,vR.prototype)}};function cs(e,t=0){return e[e.length-(1+t)]}var T$;(e=>{function t(o){return o<0}e.isLessThan=t;function n(o){return o<=0}e.isLessThanOrEqual=n;function i(o){return o>0}e.isGreaterThan=i;function r(o){return o===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(T$||={});function A$(e,t){let n=this,i=!1,r;return function(){return i||(i=!0,t||(r=e.apply(n,arguments))),r}}var yR;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*r(A){yield A}e.single=r;function o(A){return t(A)?A:r(A)}e.wrap=o;function u(A){return A||n}e.from=u;function*h(A){for(let O=A.length-1;O>=0;O--)yield A[O]}e.reverse=h;function p(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(A){return A[Symbol.iterator]().next().value}e.first=f;function g(A,O){let R=0;for(let $ of A)if(O($,R++))return!0;return!1}e.some=g;function _(A,O){for(let R of A)if(O(R))return R}e.find=_;function*b(A,O){for(let R of A)O(R)&&(yield R)}e.filter=b;function*S(A,O){let R=0;for(let $ of A)yield O($,R++)}e.map=S;function*w(A,O){let R=0;for(let $ of A)yield*O($,R++)}e.flatMap=w;function*C(...A){for(let O of A)yield*O}e.concat=C;function x(A,O,R){let $=R;for(let H of A)$=O($,H);return $}e.reduce=x;function*I(A,O,R=A.length){for(O<0&&(O+=A.length),R<0?R+=A.length:R>A.length&&(R=A.length);O<R;O++)yield A[O]}e.slice=I;function z(A,O=Number.POSITIVE_INFINITY){let R=[];if(O===0)return[R,A];let $=A[Symbol.iterator]();for(let H=0;H<O;H++){let J=$.next();if(J.done)return[R,e.empty()];R.push(J.value)}return[R,{[Symbol.iterator](){return $}}]}e.consume=z;async function U(A){let O=[];for await(let R of A)O.push(R);return Promise.resolve(O)}e.asyncToArray=U})(yR||={});function Uo(e){if(yR.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}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 R$(...e){return wn(()=>Uo(e))}function wn(e){return{dispose:A$(()=>{e()})}}var bR=class SR{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{Uo(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?SR.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)}};bR.DISABLE_DISPOSED_WARNING=!1;var Ga=bR,Et=class{constructor(){this._store=new Ga,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)}};Et.None=Object.freeze({dispose(){}});var cc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Vr=typeof window=="object"?window:globalThis,Ly=class My{constructor(t){this.element=t,this.next=My.Undefined,this.prev=My.Undefined}};Ly.Undefined=new Ly(void 0);var kn=Ly,Pk=class{constructor(){this._first=kn.Undefined,this._last=kn.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===kn.Undefined}clear(){let e=this._first;for(;e!==kn.Undefined;){let t=e.next;e.prev=kn.Undefined,e.next=kn.Undefined,e=t}this._first=kn.Undefined,this._last=kn.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new kn(e);if(this._first===kn.Undefined)this._first=n,this._last=n;else if(t){let r=this._last;this._last=n,n.prev=r,r.next=n}else{let r=this._first;this._first=n,n.next=r,r.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==kn.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==kn.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==kn.Undefined&&e.next!==kn.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===kn.Undefined&&e.next===kn.Undefined?(this._first=kn.Undefined,this._last=kn.Undefined):e.next===kn.Undefined?(this._last=this._last.prev,this._last.next=kn.Undefined):e.prev===kn.Undefined&&(this._first=this._first.next,this._first.prev=kn.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==kn.Undefined;)yield e.element,e=e.next}},N$=globalThis.performance&&typeof globalThis.performance.now=="function",L$=class wR{static create(t){return new wR(t)}constructor(t){this._now=N$&&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}},Si;(e=>{e.None=()=>Et.None;function t(M,N){return _(M,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(M){return(N,D=null,j)=>{let T=!1,B;return B=M(L=>{if(!T)return B?B.dispose():T=!0,N.call(D,L)},null,j),T&&B.dispose(),B}}e.once=n;function i(M,N,D){return f((j,T=null,B)=>M(L=>j.call(T,N(L)),null,B),D)}e.map=i;function r(M,N,D){return f((j,T=null,B)=>M(L=>{N(L),j.call(T,L)},null,B),D)}e.forEach=r;function o(M,N,D){return f((j,T=null,B)=>M(L=>N(L)&&j.call(T,L),null,B),D)}e.filter=o;function u(M){return M}e.signal=u;function h(...M){return(N,D=null,j)=>{let T=R$(...M.map(B=>B(L=>N.call(D,L))));return g(T,j)}}e.any=h;function p(M,N,D,j){let T=D;return i(M,B=>(T=N(T,B),T),j)}e.reduce=p;function f(M,N){let D,j={onWillAddFirstListener(){D=M(T.fire,T)},onDidRemoveLastListener(){D?.dispose()}},T=new Te(j);return N?.add(T),T.event}function g(M,N){return N instanceof Array?N.push(M):N&&N.add(M),M}function _(M,N,D=100,j=!1,T=!1,B,L){let F,W,E,G=0,Y,re={leakWarningThreshold:B,onWillAddFirstListener(){F=M(ae=>{G++,W=N(W,ae),j&&!E&&(he.fire(W),W=void 0),Y=()=>{let ke=W;W=void 0,E=void 0,(!j||G>1)&&he.fire(ke),G=0},typeof D=="number"?(clearTimeout(E),E=setTimeout(Y,D)):E===void 0&&(E=0,queueMicrotask(Y))})},onWillRemoveListener(){T&&G>0&&Y?.()},onDidRemoveLastListener(){Y=void 0,F.dispose()}},he=new Te(re);return L?.add(he),he.event}e.debounce=_;function b(M,N=0,D){return e.debounce(M,(j,T)=>j?(j.push(T),j):[T],N,void 0,!0,void 0,D)}e.accumulate=b;function S(M,N=(j,T)=>j===T,D){let j=!0,T;return o(M,B=>{let L=j||!N(B,T);return j=!1,T=B,L},D)}e.latch=S;function w(M,N,D){return[e.filter(M,N,D),e.filter(M,j=>!N(j),D)]}e.split=w;function C(M,N=!1,D=[],j){let T=D.slice(),B=M(W=>{T?T.push(W):F.fire(W)});j&&j.add(B);let L=()=>{T?.forEach(W=>F.fire(W)),T=null},F=new Te({onWillAddFirstListener(){B||(B=M(W=>F.fire(W)),j&&j.add(B))},onDidAddFirstListener(){T&&(N?setTimeout(L):L())},onDidRemoveLastListener(){B&&B.dispose(),B=null}});return j&&j.add(F),F.event}e.buffer=C;function x(M,N){return(D,j,T)=>{let B=N(new z);return M(function(L){let F=B.evaluate(L);F!==I&&D.call(j,F)},void 0,T)}}e.chain=x;let I=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(D=>(N(D),D)),this}filter(N){return this.steps.push(D=>N(D)?D:I),this}reduce(N,D){let j=D;return this.steps.push(T=>(j=N(j,T),j)),this}latch(N=(D,j)=>D===j){let D=!0,j;return this.steps.push(T=>{let B=D||!N(T,j);return D=!1,j=T,B?T:I}),this}evaluate(N){for(let D of this.steps)if(N=D(N),N===I)break;return N}}function U(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.on(N,j),B=()=>M.removeListener(N,j),L=new Te({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromNodeEventEmitter=U;function A(M,N,D=j=>j){let j=(...F)=>L.fire(D(...F)),T=()=>M.addEventListener(N,j),B=()=>M.removeEventListener(N,j),L=new Te({onWillAddFirstListener:T,onDidRemoveLastListener:B});return L.event}e.fromDOMEventEmitter=A;function O(M){return new Promise(N=>n(M)(N))}e.toPromise=O;function R(M){let N=new Te;return M.then(D=>{N.fire(D)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=R;function $(M,N){return M(D=>N.fire(D))}e.forward=$;function H(M,N,D){return N(D),M(j=>N(j))}e.runAndSubscribe=H;class J{constructor(N,D){this._observable=N,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Te(j),D&&D.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,D){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Z(M,N){return new J(M,N).emitter.event}e.fromObservable=Z;function K(M){return(N,D,j)=>{let T=0,B=!1,L={beginUpdate(){T++},endUpdate(){T--,T===0&&(M.reportChanges(),B&&(B=!1,N.call(D)))},handlePossibleChange(){},handleChange(){B=!0}};M.addObserver(L),M.reportChanges();let F={dispose(){M.removeObserver(L)}};return j instanceof Ga?j.add(F):Array.isArray(j)&&j.push(F),F}}e.fromObservableLight=K})(Si||={});var jy=class Oy{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Oy._idPool++}`,Oy.all.add(this)}start(t){this._stopWatch=new L$,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}}};jy.all=new Set,jy._idPool=0;var M$=jy,j$=-1,xR=class CR{constructor(t,n,i=(CR._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(o);let p=new I$(h,o);this._errorHandler(p)}return()=>{let o=this._stacks.get(t.value)||0;this._stacks.set(t.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,r]of this._stacks)(!t||n<r)&&(t=[i,r],n=r);return t}};xR._idPool=1;var O$=xR,D$=class kR{constructor(t){this.value=t}static create(){let t=new Error;return new kR(t.stack??"")}print(){console.warn(this.value.split(`
87
+ `).slice(2).join(`
88
+ `))}},I$=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},B$=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},P$=0,W_=class{constructor(e){this.value=e,this.id=P$++}},$$=2,z$,Te=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new O$(t?.onListenerError??If,this._options?.leakWarningThreshold??j$):void 0,this._perfMon=this._options?._profName?new M$(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,n,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new B$(`${h}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||If)(f),Et.None}if(this._disposed)return Et.None;n&&(t=t.bind(n));let r=new W_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=D$.create(),o=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof W_?(this._deliveryQueue??=new H$,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=wn(()=>{o?.(),this._removeListener(r)});return i instanceof Ga?i.add(u):Array.isArray(i)&&i.push(u),u},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let n=this._listeners,i=n.indexOf(t);if(i===-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--,n[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*$$<=n.length){let o=0;for(let u=0;u<n.length;u++)n[u]?n[o++]=n[u]:r&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||If;if(!i){t.value(n);return}try{t.value(n)}catch(r){i(r)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof W_)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},H$=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}},Dy=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Te,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Te,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 i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}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 i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Dy.INSTANCE=new Dy;var B0=Dy;function F$(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}B0.INSTANCE.onDidChangeZoomLevel;function U$(e){return B0.INSTANCE.getZoomFactor(e)}B0.INSTANCE.onDidChangeFullscreen;var Sc=typeof navigator=="object"?navigator.userAgent:"",Iy=Sc.indexOf("Firefox")>=0,W$=Sc.indexOf("AppleWebKit")>=0,P0=Sc.indexOf("Chrome")>=0,q$=!P0&&Sc.indexOf("Safari")>=0;Sc.indexOf("Electron/")>=0;Sc.indexOf("Android")>=0;var q_=!1;if(typeof Vr.matchMedia=="function"){let e=Vr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Vr.matchMedia("(display-mode: fullscreen)");q_=e.matches,F$(Vr,e,({matches:n})=>{q_&&t.matches||(q_=n)})}var Gl="en",By=!1,Py=!1,Bf=!1,ER=!1,ef,Pf=Gl,$k=Gl,G$,qr,$o=globalThis,hs;typeof $o.vscode<"u"&&typeof $o.vscode.process<"u"?hs=$o.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(hs=process);var K$=typeof hs?.versions?.electron=="string",V$=K$&&hs?.type==="renderer";if(typeof hs=="object"){By=hs.platform==="win32",Py=hs.platform==="darwin",Bf=hs.platform==="linux",Bf&&hs.env.SNAP&&hs.env.SNAP_REVISION,hs.env.CI||hs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ef=Gl,Pf=Gl;let e=hs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ef=t.userLocale,$k=t.osLocale,Pf=t.resolvedLanguage||Gl,G$=t.languagePack?.translationsConfigFile}catch{}ER=!0}else typeof navigator=="object"&&!V$?(qr=navigator.userAgent,By=qr.indexOf("Windows")>=0,Py=qr.indexOf("Macintosh")>=0,(qr.indexOf("Macintosh")>=0||qr.indexOf("iPad")>=0||qr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Bf=qr.indexOf("Linux")>=0,qr?.indexOf("Mobi")>=0,Pf=globalThis._VSCODE_NLS_LANGUAGE||Gl,ef=navigator.language.toLowerCase(),$k=ef):console.error("Unable to resolve platform.");var TR=By,hr=Py,Y$=Bf,zk=ER,mr=qr,Na=Pf,X$;(e=>{function t(){return Na}e.value=t;function n(){return Na.length===2?Na==="en":Na.length>=3?Na[0]==="e"&&Na[1]==="n"&&Na[2]==="-":!1}e.isDefaultVariant=n;function i(){return Na==="en"}e.isDefault=i})(X$||={});var Z$=typeof $o.postMessage=="function"&&!$o.importScripts;(()=>{if(Z$){let e=[];$o.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let o=e[i];if(o.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),o.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),$o.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var J$=!!(mr&&mr.indexOf("Chrome")>=0);mr&&mr.indexOf("Firefox")>=0;!J$&&mr&&mr.indexOf("Safari")>=0;mr&&mr.indexOf("Edg/")>=0;mr&&mr.indexOf("Android")>=0;var Nl=typeof navigator=="object"?navigator:{};zk||document.queryCommandSupported&&document.queryCommandSupported("copy")||Nl&&Nl.clipboard&&Nl.clipboard.writeText,zk||Nl&&Nl.clipboard&&Nl.clipboard.readText;var $0=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}},G_=new $0,Hk=new $0,Fk=new $0,Q$=new Array(230),AR;(e=>{function t(h){return G_.keyCodeToStr(h)}e.toString=t;function n(h){return G_.strToKeyCode(h)}e.fromString=n;function i(h){return Hk.keyCodeToStr(h)}e.toUserSettingsUS=i;function r(h){return Fk.keyCodeToStr(h)}e.toUserSettingsGeneral=r;function o(h){return Hk.strToKeyCode(h)||Fk.strToKeyCode(h)}e.fromUserSettings=o;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return G_.keyCodeToStr(h)}e.toElectronAccelerator=u})(AR||={});var e9=class RR{constructor(t,n,i,r,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=r,this.keyCode=o}equals(t){return t instanceof RR&&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",i=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${n}${i}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new t9([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},t9=class{constructor(e){if(e.length===0)throw E$("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 n9(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return AR.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Iy)switch(t){case 59:return 85;case 60:if(Y$)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(hr)return 57;break}else if(W$&&(hr&&t===93||!hr&&t===92))return 57;return Q$[t]||0}var i9=hr?256:2048,s9=512,r9=1024,a9=hr?2048:256,Uk=class{constructor(e){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=t.getModifierState?.("AltGraph"),this.keyCode=n9(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|=i9),this.altKey&&(t|=s9),this.shiftKey&&(t|=r9),this.metaKey&&(t|=a9),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new e9(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Wk=new WeakMap;function o9(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 l9=class{static getSameOriginWindowChain(e){let t=Wk.get(e);if(!t){t=[],Wk.set(e,t);let n=e,i;do i=o9(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,r=this.getSameOriginWindowChain(e);for(let o of r){let u=o.window.deref();if(n+=u?.scrollY??0,i+=u?.scrollX??0,u===t||!o.iframeElement)break;let h=o.iframeElement.getBoundingClientRect();n+=h.top,i+=h.left}return{top:n,left:i}}},tf=class{constructor(t,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=l9.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},qk=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(P0){let r=navigator.userAgent.match(/Chrome\/(\d+)/);i=(r?parseInt(r[1]):123)<=122}if(e){let r=e,o=e,u=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")i?this.deltaY=r.wheelDeltaY/(120*u):this.deltaY=r.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 h=e;h.deltaMode===h.DOM_DELTA_LINE?Iy&&!hr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")q$&&TR?this.deltaX=-(r.wheelDeltaX/120):i?this.deltaX=r.wheelDeltaX/(120*u):this.deltaX=r.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 h=e;h.deltaMode===h.DOM_DELTA_LINE?Iy&&!hr?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*u):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},NR=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),c9;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof u9?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Si.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:NR})})(c9||={});var u9=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?NR:(this._emitter||(this._emitter=new Te),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},z0=class{constructor(t,n){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof n=="number"&&this.setIfNotSet(t,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,n){if(this._isDisposed)throw new Ny("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Ny("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},d9=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Ny("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=wn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},h9;(e=>{async function t(i){let r,o=await Promise.all(i.map(u=>u.then(h=>h,h=>{r||(r=h)})));if(typeof r<"u")throw r;return o}e.settled=t;function n(i){return new Promise(async(r,o)=>{try{await i(r,o)}catch(u){o(u)}})}e.withAsyncBody=n})(h9||={});var Gk=class Ls{static fromArray(t){return new Ls(n=>{n.emitMany(t)})}static fromPromise(t){return new Ls(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ls(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Ls(async n=>{await Promise.all(t.map(async i=>{for await(let r of i)n.emitOne(r)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Te,queueMicrotask(async()=>{let i={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(i)),this.resolve()}catch(r){this.reject(r)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 Si.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ls(async i=>{for await(let r of t)i.emitOne(n(r))})}map(t){return Ls.map(this,t)}static filter(t,n){return new Ls(async i=>{for await(let r of t)n(r)&&i.emitOne(r)})}filter(t){return Ls.filter(this,t)}static coalesce(t){return Ls.filter(t,n=>!!n)}coalesce(){return Ls.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Ls.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())}};Gk.EMPTY=Gk.fromArray([]);var{getWindow:dr,getWindowId:f9,onDidRegisterWindow:p9}=(function(){let e=new Map,t={window:Vr,disposables:new Ga};e.set(Vr.vscodeWindowId,t);let n=new Te,i=new Te,r=new Te;function o(u,h){return(typeof u=="number"?e.get(u):void 0)??(h?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:i.event,registerWindow(u){if(e.has(u.vscodeWindowId))return Et.None;let h=new Ga,p={window:u,disposables:h.add(new Ga)};return e.set(u.vscodeWindowId,p),h.add(wn(()=>{e.delete(u.vscodeWindowId),i.fire(u)})),h.add(ut(u,si.BEFORE_UNLOAD,()=>{r.fire(u)})),n.fire(p),h},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return e.has(u)},getWindowById:o,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let p=u;return p?.view?p.view.window:Vr},getDocument(u){return dr(u).document}}})(),m9=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!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 ut(e,t,n,i){return new m9(e,t,n,i)}var Kk=function(e,t,n,i){return ut(e,t,n,i)},H0,g9=class extends d9{constructor(e){super(),this.defaultTarget=e&&dr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Vk=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){If(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,r=o=>{n.set(o,!1);let u=e.get(o)??[];for(t.set(o,u),e.set(o,[]),i.set(o,!0);u.length>0;)u.sort(Vk.sort),u.shift().execute();i.set(o,!1)};H0=(o,u,h=0)=>{let p=f9(o),f=new Vk(u,h),g=e.get(p);return g||(g=[],e.set(p,g)),g.push(f),n.get(p)||(n.set(p,!0),o.requestAnimationFrame(()=>r(p))),f}})();function _9(e){let t=e.getBoundingClientRect(),n=dr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var si={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"},v9=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=Zi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Zi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Zi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Zi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Zi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Zi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Zi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Zi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Zi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Zi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Zi(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=Zi(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=Zi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Zi(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 Zi(e){return typeof e=="number"?`${e}px`:e}function sd(e){return new v9(e)}var LR=class{constructor(){this._hooks=new Ga,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,i,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=r;let o=e;try{e.setPointerCapture(t),this._hooks.add(wn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=dr(e)}this._hooks.add(ut(o,si.POINTER_MOVE,u=>{if(u.buttons!==n){this.stopMonitoring(!0);return}u.preventDefault(),this._pointerMoveCallback(u)})),this._hooks.add(ut(o,si.POINTER_UP,u=>this.stopMonitoring(!0)))}};function y9(e,t,n){let i=null,r=null;if(typeof n.value=="function"?(i="value",r=n.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",r=n.get),!r)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...u){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,u)}),this[o]}}var or;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(or||={});var qu=class Ei extends Et{constructor(){super(),this.dispatched=!1,this.targets=new Pk,this.ignoreTargets=new Pk,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Si.runAndSubscribe(p9,({window:t,disposables:n})=>{n.add(ut(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(ut(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(ut(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Vr,disposables:this._store}))}static addTarget(t){if(!Ei.isTouchDevice())return Et.None;Ei.INSTANCE||(Ei.INSTANCE=new Ei);let n=Ei.INSTANCE.targets.push(t);return wn(n)}static ignoreTarget(t){if(!Ei.isTouchDevice())return Et.None;Ei.INSTANCE||(Ei.INSTANCE=new Ei);let n=Ei.INSTANCE.ignoreTargets.push(t);return wn(n)}static isTouchDevice(){return"ontouchstart"in Vr||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 i=0,r=t.targetTouches.length;i<r;i++){let o=t.targetTouches.item(i);this.activeTouches[o.identifier]={id:o.identifier,initialTarget:o.target,initialTimeStamp:n,initialPageX:o.pageX,initialPageY:o.pageY,rollingTimestamps:[n],rollingPageX:[o.pageX],rollingPageY:[o.pageY]};let u=this.newGestureEvent(or.Start,o.target);u.pageX=o.pageX,u.pageY=o.pageY,this.dispatchEvent(u)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),r=Object.keys(this.activeTouches).length;for(let o=0,u=n.changedTouches.length;o<u;o++){let h=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let p=this.activeTouches[h.identifier],f=Date.now()-p.initialTimeStamp;if(f<Ei.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let g=this.newGestureEvent(or.Tap,p.initialTarget);g.pageX=cs(p.rollingPageX),g.pageY=cs(p.rollingPageY),this.dispatchEvent(g)}else if(f>=Ei.HOLD_DELAY&&Math.abs(p.initialPageX-cs(p.rollingPageX))<30&&Math.abs(p.initialPageY-cs(p.rollingPageY))<30){let g=this.newGestureEvent(or.Contextmenu,p.initialTarget);g.pageX=cs(p.rollingPageX),g.pageY=cs(p.rollingPageY),this.dispatchEvent(g)}else if(r===1){let g=cs(p.rollingPageX),_=cs(p.rollingPageY),b=cs(p.rollingTimestamps)-p.rollingTimestamps[0],S=g-p.rollingPageX[0],w=_-p.rollingPageY[0],C=[...this.targets].filter(x=>p.initialTarget instanceof Node&&x.contains(p.initialTarget));this.inertia(t,C,i,Math.abs(S)/b,S>0?1:-1,g,Math.abs(w)/b,w>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(or.End,p.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===or.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ei.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===or.Change||t.type===or.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let r=0,o=t.initialTarget;for(;o&&o!==i;)r++,o=o.parentElement;n.push([r,i])}n.sort((i,r)=>i[0]-r[0]);for(let[i,r]of n)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,r,o,u,h,p,f){this.handle=H0(t,()=>{let g=Date.now(),_=g-i,b=0,S=0,w=!0;r+=Ei.SCROLL_FRICTION*_,h+=Ei.SCROLL_FRICTION*_,r>0&&(w=!1,b=o*r*_),h>0&&(w=!1,S=p*h*_);let C=this.newGestureEvent(or.Change);C.translationX=b,C.translationY=S,n.forEach(x=>x.dispatchEvent(C)),w||this.inertia(t,n,g,r,o,u+b,h,p,f+S)})}onTouchMove(t){let n=Date.now();for(let i=0,r=t.changedTouches.length;i<r;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let u=this.activeTouches[o.identifier],h=this.newGestureEvent(or.Change,u.initialTarget);h.translationX=o.pageX-cs(u.rollingPageX),h.translationY=o.pageY-cs(u.rollingPageY),h.pageX=o.pageX,h.pageY=o.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(o.pageX),u.rollingPageY.push(o.pageY),u.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};qu.SCROLL_FRICTION=-.005,qu.HOLD_DELAY=700,qu.CLEAR_TAP_COUNT_TIME=400,On([y9],qu,"isTouchDevice",1);var b9=qu,F0=class extends Et{onclick(e,t){this._register(ut(e,si.CLICK,n=>t(new tf(dr(e),n))))}onmousedown(e,t){this._register(ut(e,si.MOUSE_DOWN,n=>t(new tf(dr(e),n))))}onmouseover(e,t){this._register(ut(e,si.MOUSE_OVER,n=>t(new tf(dr(e),n))))}onmouseleave(e,t){this._register(ut(e,si.MOUSE_LEAVE,n=>t(new tf(dr(e),n))))}onkeydown(e,t){this._register(ut(e,si.KEY_DOWN,n=>t(new Uk(n))))}onkeyup(e,t){this._register(ut(e,si.KEY_UP,n=>t(new Uk(n))))}oninput(e,t){this._register(ut(e,si.INPUT,t))}onblur(e,t){this._register(ut(e,si.BLUR,t))}onfocus(e,t){this._register(ut(e,si.FOCUS,t))}onchange(e,t){this._register(ut(e,si.CHANGE,t))}ignoreGesture(e){return b9.ignoreTarget(e)}},Yk=11,S9=class extends F0{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=Yk+"px",this.domNode.style.height=Yk+"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 LR),this._register(Kk(this.bgDomNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Kk(this.domNode,si.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new g9),this._pointerdownScheduleRepeatTimer=this._register(new z0)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,dr(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()}},w9=class $y{constructor(t,n,i,r,o,u,h){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,r=r|0,o=o|0,u=u|0,h=h|0),this.rawScrollLeft=r,this.rawScrollTop=h,n<0&&(n=0),r+n>i&&(r=i-n),r<0&&(r=0),o<0&&(o=0),h+o>u&&(h=u-o),h<0&&(h=0),this.width=n,this.scrollWidth=i,this.scrollLeft=r,this.height=o,this.scrollHeight=u,this.scrollTop=h}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 $y(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 $y(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 i=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,u=this.height!==t.height,h=this.scrollHeight!==t.scrollHeight,p=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:i,scrollWidthChanged:r,scrollLeftChanged:o,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:p}}},x9=class extends Et{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new w9(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){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.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 i;t?i=new Zk(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Zk.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)))}},Xk=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function K_(e,t){let n=t-e;return function(i){return e+n*E9(i)}}function C9(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var Zk=class zy{constructor(t,n,i,r){this.from=t,this.to=n,this.duration=r,this.startTime=i,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,i){if(Math.abs(t-n)>2.5*i){let r,o;return t<n?(r=t+.75*i,o=n-.75*i):(r=t-.75*i,o=n+.75*i),C9(K_(t,r),K_(o,n),.33)}return K_(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 i=this.scrollLeft(n),r=this.scrollTop(n);return new Xk(i,r,!1)}return new Xk(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return zy.start(t,n,i)}static start(t,n,i){i=i+10;let r=Date.now()-10;return new zy(t,n,r,i)}};function k9(e){return Math.pow(e,3)}function E9(e){return 1-k9(1-e)}var T9=class extends Et{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 z0)}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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},A9=140,MR=class extends F0{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 T9(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new LR),this._shouldRender=!0,this.domNode=sd(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(ut(this.domNode.domNode,si.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new S9(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=sd(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 i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(ut(this.slider.domNode,si.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);n<=r&&r<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let r=_9(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),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),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let o=this._sliderOrthogonalPointerPosition(r),u=Math.abs(o-n);if(TR&&u>A9){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let h=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(h))},()=>{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()}},jR=class Hy{constructor(t,n,i,r,o,u){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=o,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Hy(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,i,r,o){let u=Math.max(0,i-t),h=Math.max(0,u-2*n),p=r>0&&r>i;if(!p)return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(i*h/r))),g=(h-f)/(r-i),_=o*g;return{computedAvailableSize:Math.round(u),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:g,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Hy._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,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},R9=class extends MR{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jR(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},N9=class extends MR{constructor(e,t,n){let i=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jR(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},L9=500,Jk=50,M9=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Fy=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,i=1,r=this._rear;do{let o=r===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[r].score*o,r===this._front)break;r=(this._capacity+r-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(P0){let n=dr(t.browserEvent),i=U$(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let r=null,o=new M9(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=o),o.score=this._computeScore(o,r)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let r=Math.abs(t.deltaX),o=Math.abs(t.deltaY),u=Math.abs(n.deltaX),h=Math.abs(n.deltaY),p=Math.max(Math.min(r,u),1),f=Math.max(Math.min(o,h),1),g=Math.max(r,u),_=Math.max(o,h);g%p===0&&_%f===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Fy.INSTANCE=new Fy;var j9=Fy,O9=class extends F0{constructor(e,t,n){super(),this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Te),this.onWillScroll=this._onWillScroll.event,this._options=I9(t),this._scrollable=n,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let i={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new N9(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new R9(this._scrollable,this._options,i)),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=sd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=sd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=sd(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new z0),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Uo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,hr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new qk(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Uo(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new qk(n))};this._mouseWheelToDispose.push(ut(this._listenOnDomNode,si.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=j9.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+r===0?o=r=0:Math.abs(r)>=Math.abs(o)?o=0:r=0),this._options.flipAxes&&([r,o]=[o,r]);let u=!hr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!o&&(o=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),p={};if(r){let f=Jk*r,g=h.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,g)}if(o){let f=Jk*o,g=h.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,g)}p=this._scrollable.validateScrollPosition(p),(h.scrollLeft!==p.scrollLeft||h.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(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,i=n?" left":"",r=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${r}${i}`)}}_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(),L9)}},D9=class extends O9{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 I9(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,hr&&(t.className+=" mac"),t}var Uy=class extends Et{constructor(e,t,n,i,r,o,u,h){super(),this._bufferService=n,this._optionsService=u,this._renderService=h,this._onRequestScrollLines=this._register(new Te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new x9({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>H0(i.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new D9(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Si.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(wn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(wn(()=>this._styleElement.remove())),this._register(Si.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
89
+ `)})),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(f=>this._handleScroll(f)))}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(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.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}};Uy=On([Be(2,zi),Be(3,ea),Be(4,fR),Be(5,bc),Be(6,Hi),Be(7,ta)],Uy);var Wy=class extends Et{constructor(e,t,n,i,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=r,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(wn(()=>{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){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.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){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Wy=On([Be(1,zi),Be(2,ea),Be(3,Rd),Be(4,ta)],Wy);var B9=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},La={full:0,left:0,center:0,right:0},xu={full:0,left:0,center:0,right:0},pp=class extends Et{constructor(e,t,n,i,r,o,u,h){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=r,this._optionsService=o,this._themeService=u,this._coreBrowserService=h,this._colorZoneStore=new B9,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(wn(()=>this._canvas?.remove()));let p=this._canvas.getContext("2d");if(p)this._ctx=p;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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);La.full=this._canvas.width,La.left=e,La.center=t,La.right=e,this._refreshDrawHeightConstants(),xu.full=1,xu.left=1,xu.center=1+La.left,xu.right=1+La.left+La.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(xu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-rr[e.position||"full"]/2),La[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}))}};pp=On([Be(2,zi),Be(3,Rd),Be(4,ta),Be(5,Hi),Be(6,bc),Be(7,ea)],pp);var ve;(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=`
90
+ `,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=""))(ve||={});var $f;(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="Ÿ"))($f||={});var OR;(e=>e.ST=`${ve.ESC}\\`)(OR||={});var qy=class{constructor(e,t,n,i,r,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=r,this._renderService=o,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(`${ve.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,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=i+"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 o=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};qy=On([Be(2,zi),Be(3,Hi),Be(4,Ko),Be(5,ta)],qy);var li=0,ci=0,ui=0,jn=0,Qk={css:"#00000000",rgba:0},Gn;(e=>{function t(r,o,u,h){return h!==void 0?`#${wo(r)}${wo(o)}${wo(u)}${wo(h)}`:`#${wo(r)}${wo(o)}${wo(u)}`}e.toCss=t;function n(r,o,u,h=255){return(r<<24|o<<16|u<<8|h)>>>0}e.toRgba=n;function i(r,o,u,h){return{css:e.toCss(r,o,u,h),rgba:e.toRgba(r,o,u,h)}}e.toColor=i})(Gn||={});var _n;(e=>{function t(p,f){if(jn=(f.rgba&255)/255,jn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,_=f.rgba>>16&255,b=f.rgba>>8&255,S=p.rgba>>24&255,w=p.rgba>>16&255,C=p.rgba>>8&255;li=S+Math.round((g-S)*jn),ci=w+Math.round((_-w)*jn),ui=C+Math.round((b-C)*jn);let x=Gn.toCss(li,ci,ui),I=Gn.toRgba(li,ci,ui);return{css:x,rgba:I}}e.blend=t;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function i(p,f,g){let _=zf.ensureContrastRatio(p.rgba,f.rgba,g);if(_)return Gn.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=i;function r(p){let f=(p.rgba|255)>>>0;return[li,ci,ui]=zf.toChannels(f),{css:Gn.toCss(li,ci,ui),rgba:f}}e.opaque=r;function o(p,f){return jn=Math.round(f*255),[li,ci,ui]=zf.toChannels(p.rgba),{css:Gn.toCss(li,ci,ui,jn),rgba:Gn.toRgba(li,ci,ui,jn)}}e.opacity=o;function u(p,f){return jn=p.rgba&255,o(p,jn*f/255)}e.multiplyOpacity=u;function h(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=h})(_n||={});var En;(e=>{let t,n;try{let r=document.createElement("canvas");r.width=1,r.height=1;let o=r.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),Gn.toColor(li,ci,ui);case 5:return li=parseInt(r.slice(1,2).repeat(2),16),ci=parseInt(r.slice(2,3).repeat(2),16),ui=parseInt(r.slice(3,4).repeat(2),16),jn=parseInt(r.slice(4,5).repeat(2),16),Gn.toColor(li,ci,ui,jn);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let o=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return li=parseInt(o[1]),ci=parseInt(o[2]),ui=parseInt(o[3]),jn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Gn.toColor(li,ci,ui,jn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[li,ci,ui,jn]=t.getImageData(0,0,1,1).data,jn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gn.toRgba(li,ci,ui,jn),css:r}}e.toColor=i})(En||={});var ji;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,r,o){let u=i/255,h=r/255,p=o/255,f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),_=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+g*.7152+_*.0722}e.relativeLuminance2=n})(ji||={});var zf;(e=>{function t(u,h){if(jn=(h&255)/255,jn===1)return h;let p=h>>24&255,f=h>>16&255,g=h>>8&255,_=u>>24&255,b=u>>16&255,S=u>>8&255;return li=_+Math.round((p-_)*jn),ci=b+Math.round((f-b)*jn),ui=S+Math.round((g-S)*jn),Gn.toRgba(li,ci,ui)}e.blend=t;function n(u,h,p){let f=ji.relativeLuminance(u>>8),g=ji.relativeLuminance(h>>8);if(Ur(f,g)<p){if(g<f){let S=i(u,h,p),w=Ur(f,ji.relativeLuminance(S>>8));if(w<p){let C=r(u,h,p),x=Ur(f,ji.relativeLuminance(C>>8));return w>x?S:C}return S}let _=r(u,h,p),b=Ur(f,ji.relativeLuminance(_>>8));if(b<p){let S=i(u,h,p),w=Ur(f,ji.relativeLuminance(S>>8));return b>w?_:S}return _}}e.ensureContrastRatio=n;function i(u,h,p){let f=u>>24&255,g=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,C=Ur(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,g,_));for(;C<p&&(b>0||S>0||w>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),w-=Math.max(0,Math.ceil(w*.1)),C=Ur(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.reduceLuminance=i;function r(u,h,p){let f=u>>24&255,g=u>>16&255,_=u>>8&255,b=h>>24&255,S=h>>16&255,w=h>>8&255,C=Ur(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,g,_));for(;C<p&&(b<255||S<255||w<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),C=Ur(ji.relativeLuminance2(b,S,w),ji.relativeLuminance2(f,g,_));return(b<<24|S<<16|w<<8|255)>>>0}e.increaseLuminance=r;function o(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}e.toChannels=o})(zf||={});function wo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ur(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var P9=class extends Ad{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()]}},mp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Is}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=[],i=t.translateToString(!0),r=0,o=0,u=0,h=t.getFg(0),p=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==p){if(f-r>1){let g=this._getJoinedRanges(i,u,o,t,r);for(let _=0;_<g.length;_++)n.push(g[_])}r=f,u=o,h=this._workCell.fg,p=this._workCell.bg}o+=this._workCell.getChars().length||Fa.length}if(this._bufferService.cols-r>1){let f=this._getJoinedRanges(i,u,o,t,r);for(let g=0;g<f.length;g++)n.push(f[g])}return n}_getJoinedRanges(e,t,n,i,r){let o=e.substring(t,n),u=[];try{u=this._characterJoiners[0].handler(o)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let p=this._characterJoiners[h].handler(o);for(let f=0;f<p.length;f++)mp._mergeRanges(u,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(u,i,r),u}_stringRangesToCellRanges(e,t,n){let i=0,r=!1,o=0,u=e[i];if(u){for(let h=n;h<this._bufferService.cols;h++){let p=t.getWidth(h),f=t.getString(h).length||Fa.length;if(p!==0){if(!r&&u[0]<=o&&(u[0]=h,r=!0),u[1]<=o){if(u[1]=h,u=e[++i],!u)break;u[0]<=o?(u[0]=h,r=!0):r=!1}o+=f}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let r=e[i];if(n){if(t[1]<=r[0])return e[i-1][1]=t[1],e;if(t[1]<=r[1])return e[i-1][1]=Math.max(t[1],r[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=r[0])return e.splice(i,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};mp=On([Be(0,zi)],mp);function $9(e){return 57508<=e&&e<=57558}function z9(e){return 9472<=e&&e<=9631}function H9(e){return $9(e)||z9(e)}function F9(){return{css:{canvas:nf(),cell:nf()},device:{canvas:nf(),cell:nf(),char:{width:0,height:0,left:0,top:0}}}}function nf(){return{width:0,height:0}}var Gy=class{constructor(e,t,n,i,r,o,u){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=r,this._decorationService=o,this._themeService=u,this._workCell=new Is,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,r,o,u,h,p,f,g){let _=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,w=e.getNoBgTrimmedLength();n&&w<o+1&&(w=o+1);let C,x=0,I="",z=0,U=0,A=0,O=0,R=!1,$=0,H=!1,J=0,Z=0,K=[],M=f!==-1&&g!==-1;for(let N=0;N<w;N++){e.loadCell(N,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let j=!1,T=N>=Z,B=N,L=this._workCell;if(b.length>0&&N===b[0][0]&&T){let we=b.shift(),Ie=this._isCellInSelection(we[0],t);for(z=we[0]+1;z<we[1];z++)T&&=Ie===this._isCellInSelection(z,t);T&&=!n||o<we[0]||o>=we[1],T?(j=!0,L=new P9(this._workCell,e.translateToString(!0,we[0],we[1]),we[1]-we[0]),B=we[1]-1,D=L.getWidth()):Z=we[1]}let F=this._isCellInSelection(N,t),W=n&&N===o,E=M&&N>=f&&N<=g,G=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,we=>{G=!0});let Y=L.getChars()||Fa;if(Y===" "&&(L.isUnderline()||L.isOverline())&&(Y=" "),J=D*h-p.get(Y,L.isBold(),L.isItalic()),!C)C=this._document.createElement("span");else if(x&&(F&&H||!F&&!H&&L.bg===U)&&(F&&H&&S.selectionForeground||L.fg===A)&&L.extended.ext===O&&E===R&&J===$&&!W&&!j&&!G&&T){L.isInvisible()?I+=Fa:I+=Y,x++;continue}else x&&(C.textContent=I),C=this._document.createElement("span"),x=0,I="";if(U=L.bg,A=L.fg,O=L.extended.ext,R=E,$=J,H=F,j&&o>=N&&o<=B&&(o=N),!this._coreService.isCursorHidden&&W&&this._coreService.isCursorInitialized){if(K.push("xterm-cursor"),this._coreBrowserService.isFocused)u&&K.push("xterm-cursor-blink"),K.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":K.push("xterm-cursor-outline");break;case"block":K.push("xterm-cursor-block");break;case"bar":K.push("xterm-cursor-bar");break;case"underline":K.push("xterm-cursor-underline");break}}if(L.isBold()&&K.push("xterm-bold"),L.isItalic()&&K.push("xterm-italic"),L.isDim()&&K.push("xterm-dim"),L.isInvisible()?I=Fa:I=L.getChars()||Fa,L.isUnderline()&&(K.push(`xterm-underline-${L.extended.underlineStyle}`),I===" "&&(I=" "),!L.isUnderlineColorDefault()))if(L.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${Ad.toColorRGB(L.getUnderlineColor()).join(",")})`;else{let we=L.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&L.isBold()&&we<8&&(we+=8),C.style.textDecorationColor=S.ansi[we].css}L.isOverline()&&(K.push("xterm-overline"),I===" "&&(I=" ")),L.isStrikethrough()&&K.push("xterm-strikethrough"),E&&(C.style.textDecoration="underline");let re=L.getFgColor(),he=L.getFgColorMode(),ae=L.getBgColor(),ke=L.getBgColorMode(),Re=!!L.isInverse();if(Re){let we=re;re=ae,ae=we;let Ie=he;he=ke,ke=Ie}let De,Ue,Oe=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,we=>{we.options.layer!=="top"&&Oe||(we.backgroundColorRGB&&(ke=50331648,ae=we.backgroundColorRGB.rgba>>8&16777215,De=we.backgroundColorRGB),we.foregroundColorRGB&&(he=50331648,re=we.foregroundColorRGB.rgba>>8&16777215,Ue=we.foregroundColorRGB),Oe=we.options.layer==="top")}),!Oe&&F&&(De=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ae=De.rgba>>8&16777215,ke=50331648,Oe=!0,S.selectionForeground&&(he=50331648,re=S.selectionForeground.rgba>>8&16777215,Ue=S.selectionForeground)),Oe&&K.push("xterm-decoration-top");let Le;switch(ke){case 16777216:case 33554432:Le=S.ansi[ae],K.push(`xterm-bg-${ae}`);break;case 50331648:Le=Gn.toColor(ae>>16,ae>>8&255,ae&255),this._addStyle(C,`background-color:#${e2((ae>>>0).toString(16),"0",6)}`);break;default:Re?(Le=S.foreground,K.push("xterm-bg-257")):Le=S.background}switch(De||L.isDim()&&(De=_n.multiplyOpacity(Le,.5)),he){case 16777216:case 33554432:L.isBold()&&re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(re+=8),this._applyMinimumContrast(C,Le,S.ansi[re],L,De,void 0)||K.push(`xterm-fg-${re}`);break;case 50331648:let we=Gn.toColor(re>>16&255,re>>8&255,re&255);this._applyMinimumContrast(C,Le,we,L,De,Ue)||this._addStyle(C,`color:#${e2(re.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(C,Le,S.foreground,L,De,Ue)||Re&&K.push("xterm-fg-257")}K.length&&(C.className=K.join(" "),K.length=0),!W&&!j&&!G&&T?x++:C.textContent=I,J!==this.defaultSpacing&&(C.style.letterSpacing=`${J}px`),_.push(C),N=B}return C&&x&&(C.textContent=I),_}_applyMinimumContrast(e,t,n,i,r,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||H9(i.getCode()))return!1;let u=this._getContrastCache(i),h;if(!r&&!o&&(h=u.getColor(t.rgba,n.rgba)),h===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);h=_n.ensureContrastRatio(r||t,o||n,p),u.setColor((r||t).rgba,(o||n).rgba,h??null)}return h?(this._addStyle(e,`color:${h.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,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};Gy=On([Be(1,gR),Be(2,Hi),Be(3,ea),Be(4,Ko),Be(5,Rd),Be(6,bc)],Gy);function e2(e,t,n){for(;e.length<n;)e=t+e;return e}var U9=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,i,r,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(o),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,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let u=this._measure(e,0);return u>0&&(this._flat[i]=u),u}let r=e;t&&(r+="B"),n&&(r+="I");let o=this._holey.get(r);if(o===void 0){let u=0;t&&(u|=1),n&&(u|=2),o=this._measure(e,u),o>0&&this._holey.set(r,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},W9=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,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let r=e.buffers.active.ydisp,o=t[1]-r,u=n[1]-r,h=Math.max(o,0),p=Math.min(u,e.rows-1);if(h>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=p,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 q9(){return new W9}var V_="xterm-dom-renderer-owner-",Ts="xterm-rows",sf="xterm-fg-",t2="xterm-bg-",Cu="xterm-focus",rf="xterm-selection",G9=1,Ky=class extends Et{constructor(e,t,n,i,r,o,u,h,p,f,g,_,b,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=r,this._helperContainer=o,this._linkifier2=u,this._charSizeService=p,this._optionsService=f,this._bufferService=g,this._coreService=_,this._coreBrowserService=b,this._themeService=S,this._terminalClass=G9++,this._rowElements=[],this._selectionRenderModel=q9(),this.onRequestRedraw=this._register(new Te).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ts),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(rf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=F9(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(w=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=h.createInstance(Gy,document),this._element.classList.add(V_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(w=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline(w=>this._handleLinkLeave(w))),this._register(wn(()=>{this._element.classList.remove(V_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new U9(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} .${Ts} 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} .${Ts} { 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} .${Ts} .xterm-dim { color: ${_n.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}`,i=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Ts}.${Cu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Ts}.${Cu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ts}.${Cu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ts} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${rf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,u]of e.ansi.entries())t+=`${this._terminalSelector} .${sf}${o} { color: ${u.css}; }${this._terminalSelector} .${sf}${o}.xterm-dim { color: ${_n.multiplyOpacity(u,.5).css}; }${this._terminalSelector} .${t2}${o} { background-color: ${u.css}; }`;t+=`${this._terminalSelector} .${sf}257 { color: ${_n.opaque(e.background).css}; }${this._terminalSelector} .${sf}257.xterm-dim { color: ${_n.multiplyOpacity(_n.opaque(e.background),.5).css}; }${this._terminalSelector} .${t2}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 i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(Cu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Cu),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 i=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,u=this._selectionRenderModel.viewportCappedEndRow,h=this._document.createDocumentFragment();if(n){let p=e[0]>t[0];h.appendChild(this._createSelectionElement(o,p?t[0]:e[0],p?e[0]:t[0],u-o+1))}else{let p=i===o?e[0]:0,f=o===r?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(o,p,f));let g=u-o-1;if(h.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,g)),o!==u){let _=r===u?t[0]:this._bufferService.cols;h.appendChild(this._createSelectionElement(u,0,_))}}this._selectionContainer.appendChild(h)}_createSelectionElement(e,t,n,i=1){let r=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,u=this.dimensions.css.cell.width*(n-t);return o+u>this.dimensions.css.canvas.width&&(u=this.dimensions.css.canvas.width-o),r.style.height=`${i*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${o}px`,r.style.width=`${u}px`,r}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,r=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,u=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,h=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=t;p++){let f=p+n.ydisp,g=this._rowElements[p],_=n.lines.get(f);if(!g||!_)break;g.replaceChildren(...this._rowFactory.createRow(_,f,f===i,u,h,r,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${V_}${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,i,r,o){n<0&&(e=0),i<0&&(t=0);let u=this._bufferService.rows-1;n=Math.max(Math.min(n,u),0),i=Math.max(Math.min(i,u),0),r=Math.min(r,this._bufferService.cols);let h=this._bufferService.buffer,p=h.ybase+h.y,f=Math.min(h.x,r-1),g=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=n;S<=i;++S){let w=S+h.ydisp,C=this._rowElements[S],x=h.lines.get(w);if(!C||!x)break;C.replaceChildren(...this._rowFactory.createRow(x,w,w===p,_,b,f,g,this.dimensions.css.cell.width,this._widthCache,o?S===n?e:0:-1,o?(S===i?t:r)-1:-1))}}};Ky=On([Be(7,D0),Be(8,Vp),Be(9,Hi),Be(10,zi),Be(11,Ko),Be(12,ea),Be(13,bc)],Ky);var Vy=class extends Et{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Te),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new V9(this._optionsService))}catch{this._measureStrategy=this._register(new K9(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())}};Vy=On([Be(2,Hi)],Vy);var DR=class extends Et{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)}},K9=class extends DR{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}},V9=class extends DR{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}},Y9=class extends Et{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 X9(this._window)),this._onDprChange=this._register(new Te),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Te),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Si.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(ut(this._textarea,"focus",()=>this._isFocused=!0)),this._register(ut(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}},X9=class extends Et{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cc),this._onDprChange=this._register(new Te),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(wn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=ut(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Z9=class extends Et{constructor(){super(),this.linkProviders=[],this._register(wn(()=>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 U0(e,t,n){let i=n.getBoundingClientRect(),r=e.getComputedStyle(n),o=parseInt(r.getPropertyValue("padding-left")),u=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-u]}function J9(e,t,n,i,r,o,u,h,p){if(!o)return;let f=U0(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(p?u/2:0))/u),f[1]=Math.ceil(f[1]/h),f[0]=Math.min(Math.max(f[0],1),i+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),r),f}var Yy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,r){return J9(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let n=U0(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])}}};Yy=On([Be(0,ta),Be(1,Vp)],Yy);var Q9=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=[]}},IR={};c$(IR,{getSafariVersion:()=>tz,isChromeOS:()=>zR,isFirefox:()=>BR,isIpad:()=>nz,isIphone:()=>iz,isLegacyEdge:()=>ez,isLinux:()=>W0,isMac:()=>gp,isNode:()=>Yp,isSafari:()=>PR,isWindows:()=>$R});var Yp=typeof process<"u"&&"title"in process,Nd=Yp?"node":navigator.userAgent,Ld=Yp?"node":navigator.platform,BR=Nd.includes("Firefox"),ez=Nd.includes("Edge"),PR=/^((?!chrome|android).)*safari/i.test(Nd);function tz(){if(!PR)return 0;let e=Nd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var gp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ld),nz=Ld==="iPad",iz=Ld==="iPhone",$R=["Windows","Win16","Win32","WinCE"].includes(Ld),W0=Ld.indexOf("Linux")>=0,zR=/\bCrOS\b/.test(Nd),HR=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,i=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),r=e.timeRemaining(),n*1.5>r){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=r}this.clear()}},sz=class extends HR{_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())}}},rz=class extends HR{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},_p=!Yp&&"requestIdleCallback"in window?rz:sz,az=class{constructor(){this._queue=new _p}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Xy=class extends Et{constructor(e,t,n,i,r,o,u,h,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=r,this._coreBrowserService=h,this._renderer=this._register(new cc),this._pausedResizeTask=new az,this._observerDisposable=this._register(new cc),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 Te),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Te),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Te),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Te),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Q9((f,g)=>this._renderRows(f,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new oz(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(wn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(u.onResize(()=>this._fullRefresh())),this._register(u.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(u.cols,u.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(u.buffer.y,u.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=wn(()=>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 i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),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(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Xy=On([Be(2,Hi),Be(3,Vp),Be(4,Ko),Be(5,Rd),Be(6,zi),Be(7,ea),Be(8,bc)],Xy);var oz=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 lz(e,t,n,i){let r=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return dz(r,o,e,t,n,i)+Xp(o,t,n,i)+hz(r,o,e,t,n,i);let u;if(o===t)return u=r>e?"D":"C",pd(Math.abs(r-e),fd(u,i));u=o>t?"D":"C";let h=Math.abs(o-t),p=uz(o>t?e:r,n)+(h-1)*n.cols+1+cz(o>t?r:e);return pd(p,fd(u,i))}function cz(e,t){return e-1}function uz(e,t){return t.cols-e}function dz(e,t,n,i,r,o){return Xp(t,i,r,o).length===0?"":pd(UR(e,t,e,t-Wo(t,r),!1,r).length,fd("D",o))}function Xp(e,t,n,i){let r=e-Wo(e,n),o=t-Wo(t,n),u=Math.abs(r-o)-fz(e,t,n);return pd(u,fd(FR(e,t),i))}function hz(e,t,n,i,r,o){let u;Xp(t,i,r,o).length>0?u=i-Wo(i,r):u=t;let h=i,p=pz(e,t,n,i,r,o);return pd(UR(e,u,n,h,p==="C",r).length,fd(p,o))}function fz(e,t,n){let i=0,r=e-Wo(e,n),o=t-Wo(t,n);for(let u=0;u<Math.abs(r-o);u++){let h=FR(e,t)==="A"?-1:1;n.buffer.lines.get(r+h*u)?.isWrapped&&i++}return i}function Wo(e,t){let n=0,i=t.buffer.lines.get(e),r=i?.isWrapped;for(;r&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),r=i?.isWrapped;return n}function pz(e,t,n,i,r,o){let u;return Xp(n,i,r,o).length>0?u=i-Wo(i,r):u=t,e<n&&u<=i||e>=n&&u<i?"C":"D"}function FR(e,t){return e>t?"A":"B"}function UR(e,t,n,i,r,o){let u=e,h=t,p="";for(;(u!==n||h!==i)&&h>=0&&h<o.buffer.lines.length;)u+=r?1:-1,r&&u>o.cols-1?(p+=o.buffer.translateBufferLineToString(h,!1,e,u),u=0,e=0,h++):!r&&u<0&&(p+=o.buffer.translateBufferLineToString(h,!1,0,e+1),u=o.cols-1,e=u,h--);return p+o.buffer.translateBufferLineToString(h,!1,e,u)}function fd(e,t){let n=t?"O":"[";return ve.ESC+n+e}function pd(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var mz=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function n2(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 Y_=50,gz=15,_z=50,vz=500,yz=" ",bz=new RegExp(yz,"g"),Zy=class extends Et{constructor(e,t,n,i,r,o,u,h,p){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=r,this._mouseService=o,this._optionsService=u,this._renderService=h,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Is,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Te),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Te),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Te),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Te),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new mz(this._bufferService),this._activeSelectionMode=0,this._register(wn(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let u=e[1];u<=t[1];u++){let h=n.translateBufferLineToString(u,!0,r,o);i.push(h)}}else{let r=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],r));for(let o=e[1]+1;o<=t[1]-1;o++){let u=n.lines.get(o),h=n.translateBufferLineToString(o,!0);u?.isWrapped?i[i.length-1]+=h:i.push(h)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),u=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=u:i.push(u)}}return i.map(r=>r.replace(bz," ")).join($R?`\r
91
+ `:`
92
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),W0&&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,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_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){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=n2(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,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=U0(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,-Y_),Y_),t/=Y_,t/Math.abs(t)+Math.round(t*(gz-1)))}shouldForceSelection(e){return gp?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(),_z)}_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&&!(gp&&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 i=n.lines.get(this._model.selectionEnd[1]);i&&i.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<vz&&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 i=lz(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!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 i=0;t>=i;i++){let r=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:r>1&&t!==i&&(n+=r-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,o=r.lines.get(e[1]);if(!o)return;let u=r.translateBufferLineToString(e[1],!1),h=this._convertViewportColToCharacterIndex(o,e[0]),p=h,f=e[0]-h,g=0,_=0,b=0,S=0;if(u.charAt(h)===" "){for(;h>0&&u.charAt(h-1)===" ";)h--;for(;p<u.length&&u.charAt(p+1)===" ";)p++}else{let x=e[0],I=e[0];o.getWidth(x)===0&&(g++,x--),o.getWidth(I)===2&&(_++,I++);let z=o.getString(I).length;for(z>1&&(S+=z-1,p+=z-1);x>0&&h>0&&!this._isCharWordSeparator(o.loadCell(x-1,this._workCell));){o.loadCell(x-1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,x--):U>1&&(b+=U-1,h-=U-1),h--,x--}for(;I<o.length&&p+1<u.length&&!this._isCharWordSeparator(o.loadCell(I+1,this._workCell));){o.loadCell(I+1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,I++):U>1&&(S+=U-1,p+=U-1),p++,I++}}p++;let w=h+f-g+b,C=Math.min(this._bufferService.cols,p-h+g+_-b-S);if(!(!t&&u.slice(h,p).trim()==="")){if(n&&w===0&&o.getCodePoint(0)!==32){let x=r.lines.get(e[1]-1);if(x&&o.isWrapped&&x.getCodePoint(this._bufferService.cols-1)!==32){let I=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(I){let z=this._bufferService.cols-I.start;w-=z,C+=z}}}if(i&&w+C===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let x=r.lines.get(e[1]+1);if(x?.isWrapped&&x.getCodePoint(0)!==32){let I=this._getWordAt([0,e[1]+1],!1,!1,!0);I&&(C+=I.length)}}return{start:w,length:C}}}_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=n2(n,this._bufferService.cols)}};Zy=On([Be(3,zi),Be(4,Ko),Be(5,I0),Be(6,Hi),Be(7,ta),Be(8,ea)],Zy);var i2=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={}}},s2=class{constructor(){this._color=new i2,this._css=new i2}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()}},Jn=Object.freeze((()=>{let e=[En.toColor("#2e3436"),En.toColor("#cc0000"),En.toColor("#4e9a06"),En.toColor("#c4a000"),En.toColor("#3465a4"),En.toColor("#75507b"),En.toColor("#06989a"),En.toColor("#d3d7cf"),En.toColor("#555753"),En.toColor("#ef2929"),En.toColor("#8ae234"),En.toColor("#fce94f"),En.toColor("#729fcf"),En.toColor("#ad7fa8"),En.toColor("#34e2e2"),En.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],r=t[n/6%6|0],o=t[n%6];e.push({css:Gn.toCss(i,r,o),rgba:Gn.toRgba(i,r,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:Gn.toCss(i,i,i),rgba:Gn.toRgba(i,i,i)})}return e})()),To=En.toColor("#ffffff"),Gu=En.toColor("#000000"),r2=En.toColor("#ffffff"),a2=Gu,ku={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Sz=To,Jy=class extends Et{constructor(e){super(),this._optionsService=e,this._contrastCache=new s2,this._halfContrastCache=new s2,this._onChangeColors=this._register(new Te),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:To,background:Gu,cursor:r2,cursorAccent:a2,selectionForeground:void 0,selectionBackgroundTransparent:ku,selectionBackgroundOpaque:_n.blend(Gu,ku),selectionInactiveBackgroundTransparent:ku,selectionInactiveBackgroundOpaque:_n.blend(Gu,ku),scrollbarSliderBackground:_n.opacity(To,.2),scrollbarSliderHoverBackground:_n.opacity(To,.4),scrollbarSliderActiveBackground:_n.opacity(To,.5),overviewRulerBorder:To,ansi:Jn.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=rn(e.foreground,To),t.background=rn(e.background,Gu),t.cursor=_n.blend(t.background,rn(e.cursor,r2)),t.cursorAccent=_n.blend(t.background,rn(e.cursorAccent,a2)),t.selectionBackgroundTransparent=rn(e.selectionBackground,ku),t.selectionBackgroundOpaque=_n.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=rn(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=_n.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?rn(e.selectionForeground,Qk):void 0,t.selectionForeground===Qk&&(t.selectionForeground=void 0),_n.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=_n.opacity(t.selectionBackgroundTransparent,.3)),_n.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=_n.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=rn(e.scrollbarSliderBackground,_n.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=rn(e.scrollbarSliderHoverBackground,_n.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=rn(e.scrollbarSliderActiveBackground,_n.opacity(t.foreground,.5)),t.overviewRulerBorder=rn(e.overviewRulerBorder,Sz),t.ansi=Jn.slice(),t.ansi[0]=rn(e.black,Jn[0]),t.ansi[1]=rn(e.red,Jn[1]),t.ansi[2]=rn(e.green,Jn[2]),t.ansi[3]=rn(e.yellow,Jn[3]),t.ansi[4]=rn(e.blue,Jn[4]),t.ansi[5]=rn(e.magenta,Jn[5]),t.ansi[6]=rn(e.cyan,Jn[6]),t.ansi[7]=rn(e.white,Jn[7]),t.ansi[8]=rn(e.brightBlack,Jn[8]),t.ansi[9]=rn(e.brightRed,Jn[9]),t.ansi[10]=rn(e.brightGreen,Jn[10]),t.ansi[11]=rn(e.brightYellow,Jn[11]),t.ansi[12]=rn(e.brightBlue,Jn[12]),t.ansi[13]=rn(e.brightMagenta,Jn[13]),t.ansi[14]=rn(e.brightCyan,Jn[14]),t.ansi[15]=rn(e.brightWhite,Jn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=rn(e.extendedAnsi[i],Jn[i+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()}}};Jy=On([Be(0,Hi)],Jy);function rn(e,t){if(e!==void 0)try{return En.toColor(e)}catch{}return t}var wz=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)}},xz=class{constructor(){this._services=new wz,this._services.set(D0,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=g$(e).sort((o,u)=>o.index-u.index),i=[];for(let o of n){let u=this._services.get(o.id);if(!u)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(u)}let r=n.length>0?n[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},Cz={trace:0,debug:1,info:2,warn:3,error:4,off:5},kz="xterm.js: ",Qy=class extends Et{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=Cz[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?"":kz)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Qy=On([Be(0,Hi)],Qy);var o2=class extends Et{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Te),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Te),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Te),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 i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},kt=3,Wn=Object.freeze(new Ad),af=0,X_=2,Ku=class WR{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*kt);let r=n||Is.fromCharData([0,cR,1,0]);for(let o=0;o<t;++o)this.setCell(o,r);this.length=t}get(t){let n=this._data[t*kt+0],i=n&2097151;return[this._data[t*kt+1],n&2097152?this._combined[t]:i?Pa(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*kt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*kt+0]=t|2097152|n[2]<<22):this._data[t*kt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*kt+0]>>22}hasWidth(t){return this._data[t*kt+0]&12582912}getFg(t){return this._data[t*kt+1]}getBg(t){return this._data[t*kt+2]}hasContent(t){return this._data[t*kt+0]&4194303}getCodePoint(t){let n=this._data[t*kt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*kt+0]&2097152}getString(t){let n=this._data[t*kt+0];return n&2097152?this._combined[t]:n&2097151?Pa(n&2097151):""}isProtected(t){return this._data[t*kt+2]&536870912}loadCell(t,n){return af=t*kt,n.content=this._data[af+0],n.fg=this._data[af+1],n.bg=this._data[af+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*kt+0]=n.content,this._data[t*kt+1]=n.fg,this._data[t*kt+2]=n.bg}setCellFromCodepoint(t,n,i,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*kt+0]=n|i<<22,this._data[t*kt+1]=r.fg,this._data[t*kt+2]=r.bg}addCodepointToCell(t,n,i){let r=this._data[t*kt+0];r&2097152?this._combined[t]+=Pa(n):r&2097151?(this._combined[t]=Pa(r&2097151)+Pa(n),r&=-2097152,r|=2097152):r=n|1<<22,i&&(r&=-12582913,r|=i<<22),this._data[t*kt+0]=r}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let r=new Is;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,r));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let r=new Is;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,r));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let r=t;r<this.length;++r)this.setCell(r,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*X_<this._data.buffer.byteLength;let i=t*kt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let r=new Uint32Array(i);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,n)}else{this._data=this._data.subarray(0,i);let r=Object.keys(this._combined);for(let u=0;u<r.length;u++){let h=parseInt(r[u],10);h>=t&&delete this._combined[h]}let o=Object.keys(this._extendedAttrs);for(let u=0;u<o.length;u++){let h=parseInt(o[u],10);h>=t&&delete this._extendedAttrs[h]}}return this.length=t,i*4*X_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*X_<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 i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,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 WR(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*kt+0]&4194303)return t+(this._data[t*kt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*kt+0]&4194303||this._data[t*kt+2]&50331648)return t+(this._data[t*kt+0]>>22);return 0}copyCellsFrom(t,n,i,r,o){let u=t._data;if(o)for(let p=r-1;p>=0;p--){for(let f=0;f<kt;f++)this._data[(i+p)*kt+f]=u[(n+p)*kt+f];u[(n+p)*kt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}else for(let p=0;p<r;p++){for(let f=0;f<kt;f++)this._data[(i+p)*kt+f]=u[(n+p)*kt+f];u[(n+p)*kt+2]&268435456&&(this._extendedAttrs[i+p]=t._extendedAttrs[n+p])}let h=Object.keys(t._combined);for(let p=0;p<h.length;p++){let f=parseInt(h[p],10);f>=n&&(this._combined[f-n+i]=t._combined[f])}}translateToString(t,n,i,r){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),r&&(r.length=0);let o="";for(;n<i;){let u=this._data[n*kt+0],h=u&2097151,p=u&2097152?this._combined[n]:h?Pa(h):Fa;if(o+=p,r)for(let f=0;f<p.length;++f)r.push(n);n+=u>>22||1}return r&&r.push(n),o}};function Ez(e,t,n,i,r,o){let u=[];for(let h=0;h<e.length-1;h++){let p=h,f=e.get(++p);if(!f.isWrapped)continue;let g=[e.get(h)];for(;p<e.length&&f.isWrapped;)g.push(f),f=e.get(++p);if(!o&&i>=h&&i<p){h+=g.length-1;continue}let _=0,b=md(g,_,t),S=1,w=0;for(;S<g.length;){let x=md(g,S,t),I=x-w,z=n-b,U=Math.min(I,z);g[_].copyCellsFrom(g[S],w,b,U,!1),b+=U,b===n&&(_++,b=0),w+=U,w===x&&(S++,w=0),b===0&&_!==0&&g[_-1].getWidth(n-1)===2&&(g[_].copyCellsFrom(g[_-1],n-1,b++,1,!1),g[_-1].setCell(n-1,r))}g[_].replaceCells(b,n,r);let C=0;for(let x=g.length-1;x>0&&(x>_||g[x].getTrimmedLength()===0);x--)C++;C>0&&(u.push(h+g.length-C),u.push(C)),h+=g.length-1}return u}function Tz(e,t){let n=[],i=0,r=t[i],o=0;for(let u=0;u<e.length;u++)if(r===u){let h=t[++i];e.onDeleteEmitter.fire({index:u-o,amount:h}),u+=h-1,o+=h,r=t[++i]}else n.push(u);return{layout:n,countRemoved:o}}function Az(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function Rz(e,t,n){let i=[],r=e.map((p,f)=>md(e,f,t)).reduce((p,f)=>p+f),o=0,u=0,h=0;for(;h<r;){if(r-h<n){i.push(r-h);break}o+=n;let p=md(e,u,t);o>p&&(o-=p,u++);let f=e[u].getWidth(o-1)===2;f&&o--;let g=f?n-1:n;i.push(g),h+=g}return i}function md(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,r=e[t+1].getWidth(0)===2;return i&&r?n-1:n}var qR=class GR{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=GR._nextId++,this._onDispose=this.register(new Te),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Uo(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};qR._nextId=1;var Nz=qR,ei={},Ao=ei.B;ei[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ei.A={"#":"£"};ei.B=void 0;ei[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ei.C=ei[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ei.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ei.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ei.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ei.E=ei[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ei.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ei.H=ei[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ei["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var l2=4294967295,c2=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=Wn.clone(),this.savedCharset=Ao,this.markers=[],this._nullCell=Is.fromCharData([0,cR,1,0]),this._whitespaceCell=Is.fromCharData([0,Fa,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _p,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new o2(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 fp),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 fp),this._whitespaceCell}getBlankLine(e,t){return new Ku(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>l2?l2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Wn);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 o2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Wn),i=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let u=0;u<this.lines.length;u++)i+=+this.lines.get(u).resize(e,n);let o=0;if(this._rows<t)for(let u=this._rows;u<t;u++)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 Ku(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ku(e,n)));else for(let u=this._rows;u>t;u--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let u=this.lines.length-r;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.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,i=Ez(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Wn),n);if(i.length>0){let r=Tz(this.lines,i);Az(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(Wn),r=n;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ku(e,i))):(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,i=this.getNullCell(Wn),r=[],o=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=e)continue;let p=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),p.unshift(h);if(!n){let U=this.ybase+this.y;if(U>=u&&U<u+p.length)continue}let f=p[p.length-1].getTrimmedLength(),g=Rz(p,this._cols,e),_=g.length-p.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+_):b=Math.max(0,this.lines.length-this.lines.maxLength+_);let S=[];for(let U=0;U<_;U++){let A=this.getBlankLine(Wn,!0);S.push(A)}S.length>0&&(r.push({start:u+p.length+o,newLines:S}),o+=S.length),p.push(...S);let w=g.length-1,C=g[w];C===0&&(w--,C=g[w]);let x=p.length-_-1,I=f;for(;x>=0;){let U=Math.min(I,C);if(p[w]===void 0)break;if(p[w].copyCellsFrom(p[x],I-U,C-U,U,!0),C-=U,C===0&&(w--,C=g[w]),I-=U,I===0){x--;let A=Math.max(x,0);I=md(p,A,this._cols)}}for(let U=0;U<p.length;U++)g[U]<e&&p[U].setCell(g[U],i);let z=_-b;for(;z-- >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+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(r.length>0){let u=[],h=[];for(let C=0;C<this.lines.length;C++)h.push(this.lines.get(C));let p=this.lines.length,f=p-1,g=0,_=r[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let b=0;for(let C=Math.min(this.lines.maxLength-1,p+o-1);C>=0;C--)if(_&&_.start>f+b){for(let x=_.newLines.length-1;x>=0;x--)this.lines.set(C--,_.newLines[x]);C++,u.push({index:f+1,amount:_.newLines.length}),b+=_.newLines.length,_=r[++g]}else this.lines.set(C,h[f--]);let S=0;for(let C=u.length-1;C>=0;C--)u[C].index+=S,this.lines.onInsertEmitter.fire(u[C]),S+=u[C].amount;let w=Math.max(0,p+o-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,n=0,i){let r=this.lines.get(e);return r?r.translateToString(t,n,i):""}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 Nz(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)}},Lz=class extends Et{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Te),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 c2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c2(!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)}},KR=2,VR=1,eb=class extends Et{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Te),this.onResize=this._onResize.event,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,KR),this.rows=Math.max(e.rawOptions.rows||0,VR),this.buffers=this._register(new Lz(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,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let r=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let u=n.lines.isFull;o===n.lines.length-1?u?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),u?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let u=o-r+1;n.lines.shiftElements(r+1,u-1,-1),n.lines.set(o,i.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 i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};eb=On([Be(0,Hi)],eb);var Ll={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:gp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Mz=["normal","bold","100","200","300","400","500","600","700","800","900"],jz=class extends Et{constructor(e){super(),this._onOptionChange=this._register(new Te),this.onOptionChange=this._onOptionChange.event;let t={...Ll};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(wn(()=>{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 Ll))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in Ll))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ll[e]),!Oz(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ll[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Mz.includes(t)?t:Ll[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 Oz(e){return e==="block"||e==="underline"||e==="bar"}function Vu(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&Vu(e[i],t-1);return n}var u2=Object.freeze({insertMode:!1}),d2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),tb=class extends Et{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 Te),this.onData=this._onData.event,this._onUserInput=this._register(new Te),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Te),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Te),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Vu(u2),this.decPrivateModes=Vu(d2)}reset(){this.modes=Vu(u2),this.decPrivateModes=Vu(d2)}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(i=>i.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))}};tb=On([Be(0,zi),Be(1,pR),Be(2,Hi)],tb);var h2={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 Z_(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 J_=String.fromCharCode,f2={DEFAULT:e=>{let t=[Z_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${J_(t[0])}${J_(t[1])}${J_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Z_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Z_(e,!0)};${e.x};${e.y}${t}`}},nb=class extends Et{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 Te),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(h2))this.addProtocol(i,h2[i]);for(let i of Object.keys(f2))this.addEncoding(i,f2[i]);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 i=t/n,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};nb=On([Be(0,zi),Be(1,Ko),Be(2,Hi)],nb);var Q_=[[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]],Dz=[[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]],Qn;function Iz(e,t){let n=0,i=t.length-1,r;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else if(e<t[r][0])i=r-1;else return!0;return!1}var Bz=class{constructor(){if(this.version="6",!Qn){Qn=new Uint8Array(65536),Qn.fill(1),Qn[0]=0,Qn.fill(0,1,32),Qn.fill(0,127,160),Qn.fill(2,4352,4448),Qn[9001]=2,Qn[9002]=2,Qn.fill(2,11904,42192),Qn[12351]=1,Qn.fill(2,44032,55204),Qn.fill(2,63744,64256),Qn.fill(2,65040,65050),Qn.fill(2,65072,65136),Qn.fill(2,65280,65377),Qn.fill(2,65504,65511);for(let e=0;e<Q_.length;++e)Qn.fill(0,Q_[e][0],Q_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Qn[e]:Iz(e,Dz)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let r=No.extractWidth(t);r===0?i=!1:r>n&&(n=r)}return No.createPropertyValue(0,n,i)}},No=class Hf{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Te,this.onChange=this._onChange.event;let t=new Bz;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,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?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,i=0,r=t.length;for(let o=0;o<r;++o){let u=t.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=r)return n+this.wcwidth(u);let f=t.charCodeAt(o);56320<=f&&f<=57343?u=(u-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let h=this.charProperties(u,i),p=Hf.extractWidth(h);Hf.extractShouldJoin(h)&&(p-=Hf.extractWidth(i)),n+=p,i=h}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Pz=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 p2(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.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 Eu=2147483647,$z=256,YR=class ib{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>$z)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 ib;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let r=t[i];if(Array.isArray(r))for(let o=0;o<r.length;++o)n.addSubParam(r[o]);else n.addParam(r)}return n}clone(){let t=new ib(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 i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Eu?Eu: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>Eu?Eu: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,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,r=this._subParamsIdx[n]&255;r-i>0&&(t[n]=this._subParams.slice(i,r))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,r=i[n-1];i[n-1]=~r?Math.min(r*10+t,Eu):t}},Tu=[],zz=class{constructor(){this._state=0,this._active=Tu,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 i=n.indexOf(t);i!==-1&&n.splice(i,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=Tu}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=Tu,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Tu,!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",Kp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].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 i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-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,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=Tu,this._id=-1,this._state=0}}},us=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,n,i){this._hitLimit||(this._data+=Kp(t,n,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,n}},Au=[],Hz=class{constructor(){this._handlers=Object.create(null),this._active=Au,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Au}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,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=Au,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Au,!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",Kp(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,r=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=Au,this._ident=0}},Yu=new YR;Yu.addParam(0);var m2=class{constructor(e){this._handler=e,this._data="",this._params=Yu,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Yu,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Kp(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=Yu,this._data="",this._hitLimit=!1,n));return this._params=Yu,this._data="",this._hitLimit=!1,t}},Fz=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=n<<4|i}},js=160,Uz=(function(){let e=new Fz(4095),t=Array.apply(null,Array(256)).map((h,p)=>p),n=(h,p)=>t.slice(h,p),i=n(32,127),r=n(0,24);r.push(25),r.push.apply(r,n(28,32));let o=n(0,14),u;e.setDefault(1,0),e.addMany(i,0,2,0);for(u in o)e.addMany([24,26,153,154],u,3,0),e.addMany(n(128,144),u,3,0),e.addMany(n(144,152),u,3,0),e.add(156,u,0,0),e.add(27,u,11,1),e.add(157,u,4,8),e.addMany([152,158,159],u,0,7),e.add(155,u,11,3),e.add(144,u,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,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(i,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(js,0,2,0),e.add(js,8,5,8),e.add(js,6,0,6),e.add(js,11,0,11),e.add(js,13,13,13),e})(),Wz=class extends Et{constructor(e=Uz){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 YR,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},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(wn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zz),this._dcsParser=this._register(new Hz),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let o=e.intermediates.charCodeAt(r);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,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 i=this._escHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=r}parse(e,t,n){let i=0,r=0,o=0,u;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=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 h=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(u=h[p](this._params),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(u=h[p](),u!==!0);p--)if(u instanceof Promise)return this._parseStack.handlerPos=p,u}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],u=this._dcsParser.unhook(i!==24&&i!==26,n),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],u=this._oscParser.end(i!==24&&i!==26,n),u)return u;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let h=o;h<t;++h){switch(i=e[h],r=this._transitions.table[this.currentState<<8|(i<160?i:js)],r>>4){case 2:for(let b=h+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<js){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<js){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<js){this._printHandler(e,h,b),h=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<js){this._printHandler(e,h,b),h=b-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:h,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(u=p[f](this._params),u!==!0);f--)if(u instanceof Promise)return this._preserveStack(3,p,f,r,h),u;f<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++h<t&&(i=e[h])>47&&i<60);h--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],_=g?g.length-1:-1;for(;_>=0&&(u=g[_](),u!==!0);_--)if(u instanceof Promise)return this._preserveStack(4,g,_,r,h),u;_<0&&this._escHandlerFb(this._collect<<8|i),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|i,this._params);break;case 13:for(let b=h+1;;++b)if(b>=t||(i=e[b])===24||i===26||i===27||i>127&&i<js){this._dcsParser.put(e,h,b),h=b-1;break}break;case 14:if(u=this._dcsParser.unhook(i!==24&&i!==26),u)return this._preserveStack(6,[],0,r,h),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let b=h+1;;b++)if(b>=t||(i=e[b])<32||i>127&&i<js){this._oscParser.put(e,h,b),h=b-1;break}break;case 6:if(u=this._oscParser.end(i!==24&&i!==26),u)return this._preserveStack(5,[],0,r,h),u;i===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},qz=/^([\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})$/,Gz=/^[\da-f]+$/;function g2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=qz.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Gz.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let r=0;r<3;++r){let o=parseInt(t.slice(n*r,n*r+n),16);i[r]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function ev(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function Kz(e,t=16){let[n,i,r]=e;return`rgb:${ev(n,t)}/${ev(i,t)}/${ev(r,t)}`}var Vz={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ma=131072,_2=10;function v2(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 y2=5e3,b2=0,Yz=class extends Et{constructor(e,t,n,i,r,o,u,h,p=new Wz){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=r,this._oscLinkService=o,this._coreMouseService=u,this._unicodeService=h,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new p$,this._utf8Decoder=new m$,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wn.clone(),this._eraseAttrDataInternal=Wn.clone(),this._onRequestBell=this._register(new Te),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Te),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Te),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Te),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Te),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Te),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Te),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Te),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Te),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Te),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Te),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Te),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Te),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 sb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:g.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,g,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:g,data:_})}),this._parser.setDcsHandlerFallback((f,g,_)=>{g==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:g,payload:_})}),this._parser.setPrintHandler((f,g,_)=>this.print(f,g,_)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(ve.BEL,()=>this.bell()),this._parser.setExecuteHandler(ve.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ve.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ve.BS,()=>this.backspace()),this._parser.setExecuteHandler(ve.HT,()=>this.tab()),this._parser.setExecuteHandler(ve.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ve.SI,()=>this.shiftIn()),this._parser.setExecuteHandler($f.IND,()=>this.index()),this._parser.setExecuteHandler($f.NEL,()=>this.nextLine()),this._parser.setExecuteHandler($f.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new us(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new us(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new us(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new us(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new us(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new us(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new us(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new us(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new us(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new us(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new us(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new us(f=>this.restoreCursorColor(f))),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 f in ei)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m2((f,g)=>this.requestStatusString(f,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),y2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${y2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,r=this._activeBuffer.y,o=0,u=this._parseStack.paused;if(u){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ma&&(o=this._parseStack.position+Ma)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ma&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ma))),u||this._dirtyRowTracker.clearRange(),e.length>Ma)for(let f=o;f<e.length;f+=Ma){let g=f+Ma<e.length?f+Ma:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(f,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,_))return this._preserveStack(i,r,_,f),this._logSlowResolvingAsync(n),n}else if(!u){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,r,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(e,t,n){let i,r,o=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,g=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let S=t;S<n;++S){if(i=e[S],i<127&&o){let I=o[String.fromCharCode(i)];I&&(i=I.charCodeAt(0))}let w=this._unicodeService.charProperties(i,b);r=No.extractWidth(w);let C=No.extractShouldJoin(w),x=C?No.extractWidth(b):0;if(b=w,u&&this._onA11yChar.fire(Pa(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-x>h){if(p){let I=_,z=this._activeBuffer.x-x;for(this._activeBuffer.x=x,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&_ instanceof Ku&&_.copyCellsFrom(I,z,0,x,!1);z<h;)I.setCellFromCodepoint(z++,0,1,g)}else if(this._activeBuffer.x=h-1,r===2)continue}if(C&&this._activeBuffer.x){let I=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-I,i,r);for(let z=r-x;--z>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(f&&(_.insertCells(this._activeBuffer.x,r-x,this._activeBuffer.getNullCell(g)),_.getWidth(h-1)===2&&_.setCellFromCodepoint(h-1,0,1,g)),_.setCellFromCodepoint(this._activeBuffer.x++,i,r,g),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<h&&n-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>v2(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new m2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new us(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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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,i=!1,r=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),r),i&&(o.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){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--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.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 i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(i,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(Wn));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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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 i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.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,i=No.extractWidth(t),r=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),u=new Uint32Array(o.length*n),h=0;for(let f=0;f<o.length;){let g=o.codePointAt(f)||0;u[h++]=g,f+=g>65535?2:1}let p=h;for(let f=1;f<n;++f)u.copyWithin(p,0,h),p+=h;return this.print(u,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ve.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ve.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ve.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ve.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ve.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,Ao),this._charsetService.setgCharset(1,Ao),this._charsetService.setgCharset(2,Ao),this._charsetService.setgCharset(3,Ao);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){let n;(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:o}=this._coreMouseService,u=this._coreService,{buffers:h,cols:p}=this._bufferService,{active:f,alt:g}=h,_=this._optionsService.rawOptions,b=(C,x)=>(u.triggerDataEvent(`${ve.ESC}[${t?"":"?"}${C};${x}$y`),!0),S=C=>C?1:2,w=e.params[0];return t?w===2?b(w,4):w===4?b(w,S(u.modes.insertMode)):w===12?b(w,3):w===20?b(w,S(_.convertEol)):b(w,0):w===1?b(w,S(i.applicationCursorKeys)):w===3?b(w,_.windowOptions.setWinLines?p===80?2:p===132?1:0:0):w===6?b(w,S(i.origin)):w===7?b(w,S(i.wraparound)):w===8?b(w,3):w===9?b(w,S(r==="X10")):w===12?b(w,S(_.cursorBlink)):w===25?b(w,S(!u.isCursorHidden)):w===45?b(w,S(i.reverseWraparound)):w===66?b(w,S(i.applicationKeypad)):w===67?b(w,4):w===1e3?b(w,S(r==="VT200")):w===1002?b(w,S(r==="DRAG")):w===1003?b(w,S(r==="ANY")):w===1004?b(w,S(i.sendFocus)):w===1005?b(w,4):w===1006?b(w,S(o==="SGR")):w===1015?b(w,4):w===1016?b(w,S(o==="SGR_PIXELS")):w===1048?b(w,1):w===47||w===1047||w===1049?b(w,S(f===g)):w===2004?b(w,S(i.bracketedPasteMode)):w===2026?b(w,S(i.synchronizedOutput)):b(w,0)}_updateAttrColor(e,t,n,i,r){return t===2?(e|=50331648,e&=-16777216,e|=Ad.fromColorRGB([n,i,r])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],r=0,o=0;do{if(i[o+r]=e.params[t+o],e.hasSubParams(t+o)){let u=e.getSubParams(t+o),h=0;do i[1]===5&&(r=1),i[o+h+1+r]=u[h];while(++h<u.length&&h+o+1+r<i.length);break}if(i[1]===5&&o+r>=2||i[1]===2&&o+r>=5)break;i[1]&&(r=1)}while(++o+t<e.length&&o+r<i.length);for(let u=2;u<i.length;++u)i[u]===-1&&(i[u]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[5])}return o}_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=Wn.fg,e.bg=Wn.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,i=this._curAttrData;for(let r=0;r<t;r++)n=e.params[r],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=Wn.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=Wn.bg&16777215):n===38||n===48||n===58?r+=this._extractColor(e,r,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=Wn.fg&16777215,i.bg&=-67108864,i.bg|=Wn.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ve.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ve.ESC}[?${t};${n}R`)}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=Wn.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(!v2(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(`${ve.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>_2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>_2&&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 i=n.shift(),r=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(S2(o))if(r==="?")t.push({type:0,index:o});else{let u=g2(r);u&&t.push({type:1,index:o,color:u})}}}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(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,r=n.findIndex(o=>o.startsWith("id="));return r!==-1&&(i=n[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,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 i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=g2(n[i]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let r=parseInt(n[i]);S2(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Ao),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Vz[e[0]],ei[e[1]]||Ao),!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=Wn.clone(),this._eraseAttrDataInternal=Wn.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 Is;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,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=u=>(this._coreService.triggerDataEvent(`${ve.ESC}${u}${ve.ESC}\\`),!0),i=this._bufferService.buffer,r=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sb=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&&(b2=e,e=t,t=b2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sb=On([Be(0,zi)],sb);function S2(e){return 0<=e&&e<256}var Xz=5e7,w2=12,Zz=50,Jz=class extends Et{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 Te),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 i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Xz)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 i=this._writeBuffer[this._bufferOffset],r=this._action(i,t);if(r){let u=h=>performance.now()-n>=w2?setTimeout(()=>this._innerWrite(0,h)):this._innerWrite(n,h);r.catch(h=>(queueMicrotask(()=>{throw h}),Promise.resolve(!1))).then(u);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=w2)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Zz&&(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()}},rb=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 h=t.addMarker(t.ybase+t.y),p={data:e,id:this._nextId++,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(p,h)),this._dataByLinkId.set(p.id,p),p.id}let n=e,i=this._getEntryIdKey(n),r=this._entriesWithId.get(i);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let o=t.addMarker(t.ybase+t.y),u={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(u,o)),this._entriesWithId.set(u.key,u),this._dataByLinkId.set(u.id,u),u.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.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)))}};rb=On([Be(0,zi)],rb);var x2=!1,Qz=class extends Et{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cc),this._onBinary=this._register(new Te),this.onBinary=this._onBinary.event,this._onData=this._register(new Te),this.onData=this._onData.event,this._onLineFeed=this._register(new Te),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Te),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Te),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Te),this._instantiationService=new xz,this.optionsService=this._register(new jz(e)),this._instantiationService.setService(Hi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(eb)),this._instantiationService.setService(zi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Qy)),this._instantiationService.setService(pR,this._logService),this.coreService=this._register(this._instantiationService.createInstance(tb)),this._instantiationService.setService(Ko,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(nb)),this._instantiationService.setService(fR,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(No)),this._instantiationService.setService(y$,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Pz),this._instantiationService.setService(v$,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(rb),this._instantiationService.setService(mR,this._oscLinkService),this._inputHandler=this._register(new Yz(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Si.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Si.forward(this._bufferService.onResize,this._onResize)),this._register(Si.forward(this.coreService.onData,this._onData)),this._register(Si.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 Jz((t,n)=>this._inputHandler.parse(t,n))),this._register(Si.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Te),this._onScroll.event(e=>{this._onScrollApi?.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&&!x2&&(this._logService.warn("writeSync is unreliable and will be removed soon."),x2=!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,KR),t=Math.max(t,VR),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(p2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(p2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=wn(()=>{for(let t of e)t.dispose()})}}},eH={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 tH(e,t,n,i){let r={type:0,cancel:!1,key:void 0},o=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":ve.DEL,e.altKey&&(r.key=ve.ESC+r.key);break;case 9:if(e.shiftKey){r.key=ve.ESC+"[Z";break}r.key=ve.HT,r.cancel=!0;break;case 13:r.key=e.altKey?ve.ESC+ve.CR:ve.CR,r.cancel=!0;break;case 27:r.key=ve.ESC,e.altKey&&(r.key=ve.ESC+ve.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"D":t?r.key=ve.ESC+"OD":r.key=ve.ESC+"[D";break;case 39:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"C":t?r.key=ve.ESC+"OC":r.key=ve.ESC+"[C";break;case 38:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"A":t?r.key=ve.ESC+"OA":r.key=ve.ESC+"[A";break;case 40:if(e.metaKey)break;o?r.key=ve.ESC+"[1;"+(o+1)+"B":t?r.key=ve.ESC+"OB":r.key=ve.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=ve.ESC+"[2~");break;case 46:o?r.key=ve.ESC+"[3;"+(o+1)+"~":r.key=ve.ESC+"[3~";break;case 36:o?r.key=ve.ESC+"[1;"+(o+1)+"H":t?r.key=ve.ESC+"OH":r.key=ve.ESC+"[H";break;case 35:o?r.key=ve.ESC+"[1;"+(o+1)+"F":t?r.key=ve.ESC+"OF":r.key=ve.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=ve.ESC+"[5;"+(o+1)+"~":r.key=ve.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=ve.ESC+"[6;"+(o+1)+"~":r.key=ve.ESC+"[6~";break;case 112:o?r.key=ve.ESC+"[1;"+(o+1)+"P":r.key=ve.ESC+"OP";break;case 113:o?r.key=ve.ESC+"[1;"+(o+1)+"Q":r.key=ve.ESC+"OQ";break;case 114:o?r.key=ve.ESC+"[1;"+(o+1)+"R":r.key=ve.ESC+"OR";break;case 115:o?r.key=ve.ESC+"[1;"+(o+1)+"S":r.key=ve.ESC+"OS";break;case 116:o?r.key=ve.ESC+"[15;"+(o+1)+"~":r.key=ve.ESC+"[15~";break;case 117:o?r.key=ve.ESC+"[17;"+(o+1)+"~":r.key=ve.ESC+"[17~";break;case 118:o?r.key=ve.ESC+"[18;"+(o+1)+"~":r.key=ve.ESC+"[18~";break;case 119:o?r.key=ve.ESC+"[19;"+(o+1)+"~":r.key=ve.ESC+"[19~";break;case 120:o?r.key=ve.ESC+"[20;"+(o+1)+"~":r.key=ve.ESC+"[20~";break;case 121:o?r.key=ve.ESC+"[21;"+(o+1)+"~":r.key=ve.ESC+"[21~";break;case 122:o?r.key=ve.ESC+"[23;"+(o+1)+"~":r.key=ve.ESC+"[23~";break;case 123:o?r.key=ve.ESC+"[24;"+(o+1)+"~":r.key=ve.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=ve.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=ve.DEL:e.keyCode===219?r.key=ve.ESC:e.keyCode===220?r.key=ve.FS:e.keyCode===221&&(r.key=ve.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let u=eH[e.keyCode]?.[e.shiftKey?1:0];if(u)r.key=ve.ESC+u;else if(e.keyCode>=65&&e.keyCode<=90){let h=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(h);e.shiftKey&&(p=p.toUpperCase()),r.key=ve.ESC+p}else if(e.keyCode===32)r.key=ve.ESC+(e.ctrlKey?ve.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let h=e.code.slice(3,4);e.shiftKey||(h=h.toLowerCase()),r.key=ve.ESC+h,r.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=ve.US),e.key==="@"&&(r.key=ve.NUL));break}return r}var Bn=0,nH=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _p,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _p,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,o)=>this._getKey(r)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<i.length;r++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[r]=e[t],t++):i[r]=this._array[n++];this._array=i,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||(Bn=this._search(t),Bn===-1)||this._getKey(this._array[Bn])!==t)return!1;do if(this._array[Bn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Bn),!0;while(++Bn<this._array.length&&this._getKey(this._array[Bn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,o)=>r-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:n[i++]=this._array[r];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Bn=this._search(e),!(Bn<0||Bn>=this._array.length)&&this._getKey(this._array[Bn])===e))do yield this._array[Bn];while(++Bn<this._array.length&&this._getKey(this._array[Bn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Bn=this._search(e),!(Bn<0||Bn>=this._array.length)&&this._getKey(this._array[Bn])===e))do t(this._array[Bn]);while(++Bn<this._array.length&&this._getKey(this._array[Bn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,r=this._getKey(this._array[i]);if(r>e)n=i-1;else if(r<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},tv=0,C2=0,iH=class extends Et{constructor(){super(),this._decorations=new nH(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Te),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Te),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(wn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new sH(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.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 i=0,r=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,r=i+(o.options.width??1),e>=i&&e<r&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,r=>{tv=r.options.x??0,C2=tv+(r.options.width??1),e>=tv&&e<C2&&(!n||(r.options.layer??"bottom")===n)&&i(r)})}},sH=class extends Ga{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Te),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Te),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=En.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=En.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rH=1e3,aH=class{constructor(e,t=rH){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 i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=i-this._lastRefreshMs,o=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_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)}},k2=20,vp=class extends Et{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let o=0;o<this._terminal.rows;o++)this._rowElements[o]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[o]);if(this._topBoundaryFocusListener=o=>this._handleBoundaryFocus(o,0),this._bottomBoundaryFocusListener=o=>this._handleBoundaryFocus(o,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new aH(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(o=>this._handleResize(o.rows))),this._register(this._terminal.onRender(o=>this._refreshRows(o.start,o.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(o=>this._handleChar(o))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
93
+ `))),this._register(this._terminal.onA11yTab(o=>this._handleTab(o))),this._register(this._terminal.onKey(o=>this._handleKey(o.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(ut(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(wn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<k2+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
94
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===k2+1&&(this._liveRegion.textContent+=ky.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,i=n.lines.length.toString();for(let r=e;r<=t;r++){let o=n.lines.get(n.ydisp+r),u=[],h=o?.translateToString(!0,void 0,void 0,u)||"",p=(n.ydisp+r+1).toString(),f=this._rowElements[r];f&&(h.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=h,this._rowColumns.set(f,u)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",i),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],r=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===o||e.relatedTarget!==i)return;let u,h;if(t===0?(u=n,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=n,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}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(){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 i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let r=({node:h,offset:p})=>{let f=h instanceof Text?h.parentNode:h,g=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(f);if(!_)return console.warn("columns is null. Race condition?"),null;let b=p<_.length?_[p]:_.slice(-1)[0]+1;return b>=this._terminal.cols&&(++g,b=0),{row:g,column:b}},o=r(t),u=r(n);if(!(!o||!u)){if(o.row>u.row||o.row===u.row&&o.column>=u.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(u.row-o.row)*this._terminal.cols-o.column+u.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){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};vp=On([Be(1,D0),Be(2,ea),Be(3,ta)],vp);var ab=class extends Et{constructor(e,t,n,i,r){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Te),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Te),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(wn(()=>{Uo(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(ut(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(ut(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(ut(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(ut(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 i=0;i<n.length;i++){let r=n[i];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(r=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):r.provideLinks(e.y,o=>{if(this._isMouseOut)return;let u=o?.map(h=>({link:h}));this._activeProviderReplies?.set(i,u),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let r=t.get(i);if(r)for(let o=0;o<r.length;o++){let u=r[o],h=u.link.range.start.y<e?0:u.link.range.start.x,p=u.link.range.end.y>e?this._bufferService.cols:u.link.range.end.x;for(let f=h;f<=p;f++){if(n.has(f)){r.splice(o--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),r=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&i){let o=i.find(u=>this._linkAtPosition(u.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 u=this._activeProviderReplies.get(o)?.find(h=>this._linkAtPosition(h.link,t));if(u){n=!0,this._handleNewLink(u);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&&oH(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,Uo(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:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.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:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.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 i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let o=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);o&&this._askForLink(o,!1)}})))}_linkHover(e,t,n){this._currentLink?.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,i=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,n){this._currentLink?.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,i=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return n<=r&&r<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,r){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:r}}};ab=On([Be(1,I0),Be(2,ta),Be(3,zi),Be(4,_R)],ab);function oH(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 lH=class extends Qz{constructor(e={}){super(e),this._linkifier=this._register(new cc),this.browser=IR,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cc),this._onCursorMove=this._register(new Te),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Te),this.onKey=this._onKey.event,this._onRender=this._register(new Te),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Te),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Te),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Te),this.onBell=this._onBell.event,this._onFocus=this._register(new Te),this._onBlur=this._register(new Te),this._onA11yCharEmitter=this._register(new Te),this._onA11yTabEmitter=this._register(new Te),this._onWillOpen=this._register(new Te),this._setup(),this._decorationService=this._instantiationService.createInstance(iH),this._instantiationService.setService(Rd,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Z9),this._instantiationService.setService(_R,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ty)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??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(Si.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Si.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Si.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Si.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(wn(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let r=_n.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ve.ESC}]${i};${Kz(r)}${OR.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Gn.toColor(...t.color));else{let o=n;this._themeService.modifyColors(u=>u[o]=Gn.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(vp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ve.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),i=this._renderService.dimensions.css.cell.height,r=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*r,u=this.buffer.y*this._renderService.dimensions.css.cell.height,h=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=u+"px",this.textarea.style.width=o+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(ut(this.element,"copy",t=>{this.hasSelection()&&h$(t,this._selectionService)}));let e=t=>f$(t,this.textarea,this.coreService,this.optionsService);this._register(ut(this.textarea,"paste",e)),this._register(ut(this.element,"paste",e)),BR?this._register(ut(this.element,"mousedown",t=>{t.button===2&&Dk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(ut(this.element,"contextmenu",t=>{Dk(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),W0&&this._register(ut(this.element,"auxclick",t=>{t.button===1&&lR(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(ut(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(ut(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(ut(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(ut(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(ut(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(ut(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(ut(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){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"),this.element?.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(ut(this.screenElement,"mousemove",r=>this.updateCursorStyle(r))),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",Cy.get()),zR||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(Y9,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ea,this._coreBrowserService),this._register(ut(this.textarea,"focus",r=>this._handleTextAreaFocus(r))),this._register(ut(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Vy,this._document,this._helperContainer),this._instantiationService.setService(Vp,this._charSizeService),this._themeService=this._instantiationService.createInstance(Jy),this._instantiationService.setService(bc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(mp),this._instantiationService.setService(gR,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Xy,this.rows,this.screenElement)),this._instantiationService.setService(ta,this._renderService),this._register(this._renderService.onRenderedViewportChange(r=>this._onRender.fire(r))),this.onResize(r=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(qy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Yy),this._instantiationService.setService(I0,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(ab,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(Uy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(r=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Zy,this.element,this.screenElement,i)),this._instantiationService.setService(S$,this._selectionService),this._register(this._selectionService.onRequestScrollLines(r=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(r=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(r=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(Si.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Wy,this.screenElement)),this._register(ut(this.element,"mousedown",r=>this._selectionService.handleMouseDown(r))),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(vp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",r=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",r=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(pp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ky,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let u=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!u)return!1;let h,p;switch(o.overrideType||o.type){case"mousemove":p=32,o.buttons===void 0?(h=3,o.button!==void 0&&(h=o.button<3?o.button:3)):h=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":p=0,h=o.button<3?o.button:3;break;case"mousedown":p=1,h=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let f=o.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,h=4;break;default:return!1}return p===void 0||h===void 0||h>4?!1:e.coreMouseService.triggerMouseEvent({col:u.col,row:u.row,x:u.x,y:u.y,button:h,action:p,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:o=>(n(o),o.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(o)),wheel:o=>(n(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&n(o)},mousemove:o=>{o.buttons||n(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),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()),o&8?i.mousemove||(t.addEventListener("mousemove",r.mousemove),i.mousemove=r.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),i.wheel=r.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(ut(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return n(o),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(o)})),this._register(ut(t,"wheel",o=>{if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(o,!0);let u=ve.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(u,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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){oR(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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.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=tH(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),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===ve.ETX||n.key===ve.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)&&(cH(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){this._charSizeService?.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(Wn));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(ve.ESC+"[I"):this.coreService.triggerDataEvent(ve.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(`${ve.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ve.ESC}[6;${r};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function cH(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var uH=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)}},dH=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 Is)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},E2=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 dH(t)}getNullCell(){return new Is}},hH=class extends Et{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Te),this.onBufferChange=this._onBufferChange.event,this._normal=new E2(this._core.buffers.normal,"normal"),this._alternate=new E2(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)}},fH=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,i)=>t(n,i.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)}},pH=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}},mH=["cols","rows"],ar=0,gH=class extends Et{constructor(e){super(),this._core=this._register(new lH(e)),this._addonManager=this._register(new uH),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,r)=>{this._checkReadonlyOptions(i),this._core.options[i]=r};for(let i in this._core.options){let r={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,r)}}_checkReadonlyOptions(e){if(mH.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 fH(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new pH(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 hH(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
95
+ `,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 Cy.get()},set promptLabel(e){Cy.set(e)},get tooMuchOutput(){return ky.get()},set tooMuchOutput(e){ky.set(e)}}}_verifyIntegers(...e){for(ar of e)if(ar===1/0||isNaN(ar)||ar%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ar of e)if(ar&&(ar===1/0||isNaN(ar)||ar%1!==0||ar<0))throw new Error("This API only accepts positive integers")}};function _H(e){let t=!1,n=!1,i=!1,r=!1,o=null,u=null;const h=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},p=()=>{u!==null&&(clearTimeout(u),u=null),n=!1},f=()=>{p(),n=!0,u=setTimeout(()=>{u=null,n=!1},0)},g=()=>{i=!1,o!==null&&clearTimeout(o),u!==null&&(clearTimeout(u),u=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},_=()=>{t=!1,o===null&&(p(),i=!1)},b=()=>{t=!1,r=!1,p(),h()},S=w=>{if(o===null){if(t||n||yH(w)){i=!0,n&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),i&&g()},onCompositionCancel:_,handleKeyEvent(w){return vH(w)&&w.shiftKey?(w.preventDefault?.(),w.type==="keydown"?(r=!0,S(w)):w.type==="keypress"?(r||S(w),r=!1):w.type==="keyup"&&(r=!1),!1):!0},dispose:b}}function vH(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function yH(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function bH({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let r=!1,o=!1,u=!1;const h=()=>{o=!1,u=!1},p=b=>{T2(b)&&(o=!0,u=!1)},f=()=>{o&&(u=!0)},g=b=>{const S=o&&u&&T2(b);if(h(),!S)return;const w=e.getSelection();if(!(!w||!i))try{i.writeText(w).catch(()=>{})}catch{}},_=e.onSelectionChange(f);return t.addEventListener("mousedown",p,!0),n.addEventListener("mouseup",g),n.addEventListener("blur",h),{dispose:()=>{r||(r=!0,h(),_.dispose(),t.removeEventListener("mousedown",p,!0),n.removeEventListener("mouseup",g),n.removeEventListener("blur",h))}}}function T2(e){return e.button===0}function SH(e,t){return{activate(n,i){try{const r=new URL(i);if(r.protocol!=="http:"&&r.protocol!=="https:"||!t(r.href))return;e(r.href,"_blank","noopener,noreferrer")}catch{}}}}const wH={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:SH((e,t,n)=>window.open(e,t,n),e=>window.confirm(`Do you want to navigate to ${e}?
96
+
97
+ WARNING: This link could potentially be dangerous`)),lineHeight:1},xH="Symbols Nerd Font Mono",of=`ui-monospace, "SF Mono", Menlo, "${xH}", monospace`,q0=14,XR=10,ZR=22,CH={min:XR,max:ZR},kH="cascadia",gd=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${of}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${of}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${of}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${of}`,meta:"Variable · Adobe mono"}],Jl=gd[0];function EH(e){return gd.find(t=>t.id===e)??Jl}function _d(){return{source:"curated",id:kH,customName:"",family:Jl.family,size:q0}}function G0(e,t){const n=EH(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:Y0(t)}}function K0(e,t){const n=RH(e);return{source:"custom",id:null,customName:n,family:ip(n,Jl.family),size:Y0(t)}}function JR(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=Y0(typeof t.size=="number"?t.size:q0);return t.source==="custom"&&typeof t.customName=="string"?K0(t.customName,n):typeof t.id=="string"&&AH(t.id)?G0(t.id,n):null}function V0(e){if(!e)return _d();try{const t=JR(JSON.parse(e));if(t!==null)return t}catch{}return _d()}function TH(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function Y0(e){return Number.isFinite(e)?Math.min(ZR,Math.max(XR,Math.round(e))):q0}function AH(e){return gd.some(t=>t.id===e)}function RH(e){return Pp(e)}const yp="fleet-plugin.terminal.renderer",Ql="fleet-plugin.terminal.font",A2="fleet-console.terminalRenderer",R2="fleet-console.terminalFont",ob=new Set;let Ka=FH(),vd=null,zo=0;function NH(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(yp)!==null||window.localStorage.getItem(Ql)!==null)return;const e=window.localStorage.getItem(A2),t=window.localStorage.getItem(R2),n=e==="webgl"||e==="dom"?e:"webgl",i=V0(t);window.localStorage.setItem(yp,n),window.localStorage.setItem(Ql,TH(i)),window.localStorage.removeItem(A2),window.localStorage.removeItem(R2)}catch{}}function LH(e){zo+=1,vd=e,IH()}function QR(){return v.useSyncExternalStore(HH,N2,N2)}function MH(e){$H(e),uc({renderer:e})}function jH(e){const t=G0(e,Ka.font.size);zo+=1,uc({font:t}),Zp(t)}function OH(e){const t=K0(e,Ka.font.size);zo+=1,uc({font:t}),Zp(t)}function DH(e){const t=Ka.font.source==="custom"?K0(Ka.font.customName,e):G0(Ka.font.id,e);zo+=1,uc({font:t}),Zp(t)}async function IH(){if(!vd)return;const e=zo;try{const t=await vd.read("terminal");if(t!==null){const n=JR(t.font);if(n!==null){if(e!==zo)return;uc({font:n});try{window.localStorage.removeItem(Ql)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Ql)}catch{}if(n!==null){const i=V0(n);if(e!==zo)return;uc({font:i}),Zp(i);try{window.localStorage.removeItem(Ql)}catch{}}}}catch{}}async function Zp(e){if(vd)try{await vd.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function BH(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(yp);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function PH(){if(typeof window>"u")return _d();try{return V0(window.localStorage.getItem(Ql))}catch{return _d()}}function $H(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yp,e)}catch{}}function zH(){for(const e of ob)e()}function uc(e){Ka={...Ka,...e},zH()}function HH(e){return ob.add(e),()=>{ob.delete(e)}}function N2(){return Ka}function FH(){return typeof window>"u"?{renderer:"webgl",font:_d()}:(NH(),{renderer:BH(),font:PH()})}function L2({baseY:e,viewportY:t}){return t>=e}function UH(e){let t=!0,n=null,i=null;const r=()=>{const{baseY:f,viewportY:g}=e.getViewport();n=Math.max(0,f-g)},o=()=>{if(n===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-n)))},u=()=>{if(t){e.scrollToBottom();return}o()},h=()=>{i===null&&(i=e.requestFrame(()=>{i=null,u()}))},p=()=>{t&&(u(),h())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=L2(e.getViewport()),t){n=null;return}r()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,p()},preserveAfterGeometryChange:f=>{f(),u(),h()},restoreAfterOutputParsing:()=>{if(t){p();return}L2(e.getViewport())||r()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function WH({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!qH(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const r=t();return r&&!i.repeat&&n(r).catch(()=>{}),!1}}}function qH(e,t){return e.type==="keydown"&&/^win/i.test(t)&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey&&(e.code==="KeyC"||e.key.toLowerCase()==="c")}const GH="Symbols Nerd Font Mono",KH=`1em "${GH}"`,VH=650;let lf=null;function eN(){return lf||(lf=XH(),lf)}async function YH(){await ZH(eN(),VH)}async function XH(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(KH)}catch{}}async function ZH(e,t){await new Promise(n=>{let i=!1;const r=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(r),n())}})}const JH=80,QH=16,eF=250,tF=1024*1024,nF=120,iF={background:"oklch(16.5% 0.016 245)",foreground:"oklch(94% 0.008 90)",cursor:"oklch(77% 0.085 200)",selectionBackground:"oklch(80% 0.085 78 / 13%)",black:"oklch(13% 0.014 245)",brightBlack:"oklch(29% 0.018 245)",red:"oklch(68% 0.13 25)",green:"oklch(76% 0.11 160)",yellow:"oklch(75% 0.08 90)",blue:"oklch(77% 0.085 200)",magenta:"oklch(70% 0.012 245)",cyan:"oklch(77% 0.085 200)",white:"oklch(94% 0.008 90)",brightRed:"oklch(68% 0.13 25)",brightGreen:"oklch(76% 0.11 160)",brightYellow:"oklch(80% 0.085 78)",brightBlue:"oklch(77% 0.085 200)",brightMagenta:"oklch(70% 0.012 245)",brightCyan:"oklch(77% 0.085 200)",brightWhite:"oklch(94% 0.008 90)"},sF={background:"oklch(23% 0.03 248)",foreground:"oklch(86% 0.018 90)",cursor:"oklch(82% 0.13 195)",selectionBackground:"oklch(78% 0.13 75 / 28%)",black:"oklch(18% 0.045 248)",brightBlack:"oklch(48% 0.03 248)",red:"oklch(72% 0.17 25)",green:"oklch(82% 0.13 195)",yellow:"oklch(86% 0.16 78)",blue:"oklch(70% 0.08 248)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(82% 0.13 195)",white:"oklch(82% 0.018 90)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(88% 0.14 195)",brightYellow:"oklch(90% 0.16 78)",brightBlue:"oklch(78% 0.09 248)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(88% 0.14 195)",brightWhite:"oklch(96% 0.012 88)"},rF={background:"oklch(19% 0.008 252)",foreground:"oklch(85% 0.005 250)",cursor:"oklch(80% 0.105 205)",selectionBackground:"oklch(76% 0.115 62 / 28%)",black:"oklch(16% 0.008 252)",brightBlack:"oklch(46% 0.006 250)",red:"oklch(72% 0.17 25)",green:"oklch(80% 0.11 205)",yellow:"oklch(84% 0.14 64)",blue:"oklch(68% 0.05 250)",magenta:"oklch(75% 0.11 320)",cyan:"oklch(80% 0.11 205)",white:"oklch(81% 0.005 250)",brightRed:"oklch(78% 0.18 25)",brightGreen:"oklch(86% 0.13 205)",brightYellow:"oklch(88% 0.15 66)",brightBlue:"oklch(74% 0.06 250)",brightMagenta:"oklch(82% 0.12 320)",brightCyan:"oklch(86% 0.13 205)",brightWhite:"oklch(95% 0.003 250)"};function X0({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:r,active:o,keyboardFocusRequestId:u,zoom:h=1}){const p=i,{renderer:f,font:g}=QR(),_=v.useRef(null),b=v.useRef(null),S=v.useRef(null),w=v.useRef(null),C=v.useRef(null),x=v.useRef(null),I=v.useRef(null),[z,U]=v.useState(h),A=v.useRef(r);A.current=r;const O=v.useRef(o);O.current=o;const[R,$]=v.useState("connecting"),[H,J]=v.useState(0),[Z,K]=v.useState(0);v.useEffect(()=>{const D=_.current;if(!D)return;let j=!1,T=null,B=null,L=null;return(async()=>{if(await YH(),j)return;const W=M2(p),E=new gH({...wH,fontFamily:g.family,fontSize:g.size*z,theme:W});b.current=E;const G=new Q7;I.current=G,E.loadAddon(G),E.open(D),j2(D,W);const Y=bH({terminal:E,selectionTarget:D,windowTarget:window,clipboard:navigator.clipboard});E.loadAddon(new EB),E.unicode.activeVersion="11";const re=_H(()=>E.input(`
98
+ `)),he=D.querySelector("textarea.xterm-helper-textarea, textarea")??D;he.addEventListener("compositionstart",re.onCompositionStart),he.addEventListener("compositionend",re.onCompositionEnd),he.addEventListener("focusout",re.onCompositionCancel);const ae=WH({getPlatform:()=>navigator.platform,getSelection:()=>E.getSelection(),writeText:Ie=>navigator.clipboard.writeText(Ie)});E.attachCustomKeyEventHandler(Ie=>ae.handleKeyEvent(Ie)&&re.handleKeyEvent(Ie));const ke=UH({getViewport:()=>E.buffer.active,scrollToBottom:()=>aF(E),scrollToLine:Ie=>oF(E,Ie),requestFrame:Ie=>window.requestAnimationFrame(Ie),cancelFrame:Ie=>window.cancelAnimationFrame(Ie)});x.current=ke;const Re=lF(D,he,ke.recordUserViewportChange),De=dF(E,O.current!==!1,ke.restoreAfterOutputParsing);C.current=De;const Ue=G7({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:Ie=>E.onData(Qe=>{ke.resumeFollowing(),Ie(Qe)}),write:De.write},onExit:()=>A.current?.(),onStatus:(Ie,Qe)=>{$(Qe?`${Ie}: ${Qe}`:Ie)}});S.current=Ue;const Oe=()=>{ke.preserveAfterGeometryChange(()=>{G.fit(),Ue.resize(E.cols,E.rows),E.refresh(0,E.rows-1)})},Le=()=>{B&&clearTimeout(B),B=setTimeout(()=>{B=null,j||Oe()},JH)},we=async()=>{await document.fonts?.ready,!j&&(Oe(),Ue.start(),K(Ie=>Ie+1),O.current!==!1&&E.focus())};T=new ResizeObserver(Le),T.observe(D),we(),L=()=>{B&&clearTimeout(B),he.removeEventListener("compositionstart",re.onCompositionStart),he.removeEventListener("compositionend",re.onCompositionEnd),he.removeEventListener("focusout",re.onCompositionCancel),re.dispose(),Ue.dispose(),Y.dispose(),Re.dispose(),De.dispose(),ke.dispose(),b.current=null,S.current=null,C.current=null,x.current=null,I.current=null;try{E.dispose()}catch{}},J(Ie=>Ie+1)})(),()=>{j=!0,T?.disconnect(),L?.()}},[e,t,n]),v.useEffect(()=>{C.current?.setActive(o!==!1),o&&(b.current?.focus(),x.current?.resumeFollowing())},[o,u,Z]),v.useEffect(()=>{const D=b.current;if(!D)return;let j=!1;if(f==="webgl")try{const T=new o$;w.current=T,T.onContextLoss(()=>{if(!j){try{T.dispose()}catch{}w.current===T&&(w.current=null)}}),D.loadAddon(T)}catch{try{w.current?.dispose()}catch{}w.current=null}return()=>{j=!0;const T=w.current;if(T){w.current=null;try{T.dispose()}catch{}}}},[f,e,H]),v.useEffect(()=>{const D=b.current,j=_.current;if(!D||!j)return;const T=M2(p);D.options.theme=T,j2(j,T)},[p,H]),v.useEffect(()=>{const D=b.current;D&&(D.options.fontFamily=g.family,O2(D,I.current,S.current,x.current))},[g.family,H]),v.useEffect(()=>{if(h===z)return;const D=setTimeout(()=>U(h),nF);return()=>clearTimeout(D)},[h,z]),v.useEffect(()=>{const D=b.current;D&&(D.options.fontSize=g.size*z,O2(D,I.current,S.current,x.current))},[z,g.size,H]);const M=R.startsWith("live"),N=z===1?void 0:{width:`${z*100}%`,height:`${z*100}%`,transform:`scale(${1/z})`,transformOrigin:"0 0"};return c.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:c.jsxs("div",{className:"terminal-shell",children:[M?null:c.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[c.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),R]}),c.jsx("div",{className:"terminal-viewport",children:c.jsx("div",{className:"terminal-canvas",ref:_,style:N})})]})})}function M2(e){return e==="carbon"?rF:e==="maritime"?sF:iF}function j2(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function aF(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function oF(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function lF(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let r=!1,o=null;const u=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},h=()=>u(),p=()=>{r=!0},f=S=>{r=cF(S,i)},g=()=>{r&&u()},_=()=>{const S=r;r=!1,S&&u()},b=S=>{uF(S)&&u()};return i.addEventListener("wheel",h,{capture:!0,passive:!0}),i.addEventListener("touchstart",p,{capture:!0,passive:!0}),i.addEventListener("touchend",_),i.addEventListener("touchcancel",_),i.addEventListener("pointerdown",f,!0),i.addEventListener("scroll",g),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",h,!0),i.removeEventListener("touchstart",p,!0),i.removeEventListener("touchend",_),i.removeEventListener("touchcancel",_),i.removeEventListener("pointerdown",f,!0),i.removeEventListener("scroll",g),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function cF(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function uF(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function dF(e,t,n){let i=t,r=!1,o=null,u=0,h=[];const p=()=>{o&&(clearTimeout(o),o=null)},f=()=>{if(p(),r||u===0)return;const _=hF(h,u);h=[],u=0,e.write(_,()=>{r||n()})},g=()=>{r||o||u===0||(o=setTimeout(f,i?QH:eF))};return{write:_=>{if(!(r||_.byteLength===0)){if(h.push(_),u+=_.byteLength,u>=tF){f();return}g()}},setActive:_=>{if(i!==_){if(i=_,p(),i){f();return}g()}},dispose:()=>{f(),r=!0,h=[],u=0,p()}}}function hF(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const r of e)n.set(r,i),i+=r.byteLength;return n}function O2(e,t,n,i){const r=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(r);return}r()}const fF=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),pF=50*1024;function yd(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(yd):Object.entries(e).some(([t,n])=>fF.has(t.toLowerCase())||yd(n))}function mF(e){if(yd(e)||!qo(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(vF);return t.every(n=>n!==null)?{clis:t}:null}function gF(e){return yd(e)||!qo(e)||typeof e.type!="string"?null:e.type==="connected"?{type:"connected"}:(e.type==="chunk"||e.type==="thought")&&typeof e.text=="string"?{type:e.type,text:e.text}:e.type==="tool"&&typeof e.title=="string"&&typeof e.status=="string"?{type:"tool",title:e.title,status:e.status}:e.type==="complete"?{type:"complete"}:e.type==="error"&&tN(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&qo(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&yF(e.artifact.html)<=pF?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function _F(e){return!yd(e)&&qo(e)&&tN(e.error)?e.error:null}function vF(e){if(!qo(e)||typeof e.cliId!="string"||typeof e.label!="string"||typeof e.available!="boolean"||!Array.isArray(e.models))return null;const t=e.models.map(n=>qo(n)&&typeof n.id=="string"&&typeof n.label=="string"&&Array.isArray(n.effortLevels)&&n.effortLevels.every(i=>typeof i=="string")?{id:n.id,label:n.label,effortLevels:n.effortLevels,defaultEffort:typeof n.defaultEffort=="string"?n.defaultEffort:void 0}:null);return t.every(n=>n!==null)?{cliId:e.cliId,label:e.label,available:e.available,defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0,models:t}:null}function tN(e){return qo(e)&&typeof e.code=="string"&&typeof e.message=="string"}function qo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yF(e){return new TextEncoder().encode(e).byteLength}class lb extends Error{constructor(t,n){super(n),this.code=t}code}const wc=e=>`analysis/${encodeURIComponent(e)}`;function bF(e,t,n,i){const r=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${r.toString()}`}async function SF(e){const t=await Jp(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=mF(n);if(i)return i;throw Qp(t.status,n)}async function nN(e,t){try{const n=await Jp(e,`${wc(t)}/ready`);if(!n.ok)return!1;const i=await n.json().catch(()=>null);return!!i&&typeof i=="object"&&!Array.isArray(i)&&i.ready===!0}catch{return!1}}async function wF(e,t,n,i){await Z0(e,`${wc(t)}/start`,n,i)}async function xF(e,t,n){await Z0(e,`${wc(t)}/message`,{text:n})}async function nv(e,t){await Z0(e,`${wc(t)}/stop`,{})}async function iN(e,t){const n=await Jp(e,`${wc(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw Qp(n.status,await n.json().catch(()=>null))}function CF(e,t,n){return e.subscribe("terminal",`${wc(t)}/stream`,i=>{try{const r=gF(JSON.parse(i.data));r&&n(r)}catch{}})}async function Z0(e,t,n,i){const r=await Jp(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!r.ok)throw Qp(r.status,await r.json().catch(()=>null))}async function Jp(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Ti?Qp(i.status,i.body):i}}function Qp(e,t){const n=_F(t);return new lb(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const kF=32,cb={catalog:null,cliId:"",model:"",effort:"",draft:"",queue:[],started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],artifactAuthoring:null,artifactPublished:null,artifactsAutoOpenArmed:!0,error:null};function EF(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...D2(t.catalog)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),r=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:r?.id??"",effort:r?.defaultEffort??r?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(r=>r.cliId===e.cliId)?.models.find(r=>r.id===t.model);return{...e,model:t.model,effort:i?.defaultEffort??i?.effortLevels[0]??""}}if(t.type==="select-effort"&&!e.started)return{...e,effort:t.effort};if(t.type==="set-draft")return{...e,draft:t.draft};if(t.type==="queue-push")return{...e,queue:[...e.queue,t.text]};if(t.type==="queue-cancel")return t.index<0||t.index>=e.queue.length?e:{...e,queue:e.queue.filter((i,r)=>r!==t.index)};if(t.type==="queue-clear")return e.queue.length>0?{...e,queue:[]}:e;if(t.type==="sending")return{...e,started:e.started||t.started,busy:!0,phase:"starting",latestActivity:{kind:"starting",connected:!t.started},runStartedAt:t.now,runEndedAt:null,error:null,tools:[],artifactAuthoring:null,artifactPublished:null,entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return Ru(e,t.message,t.now);if(t.type==="session-lost")return{...Ru(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...Ru(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,queue:[],started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,artifactAuthoring:null,error:null};if(t.type==="stop-failed")return{...Ru(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...cb,catalog:i,...D2(i)}:cb}if(t.type==="clear-artifacts")return{...e,artifacts:[],artifactPublished:null,artifactsAutoOpenArmed:!0};if(t.type==="artifacts-chip-disarm")return e.artifactsAutoOpenArmed?{...e,artifactsAutoOpenArmed:!1}:e;if(t.type==="artifacts-chip-rearm")return e.artifactsAutoOpenArmed?e:{...e,artifactsAutoOpenArmed:!0};if(t.type!=="event")return e;const n=t.event;if(n.type==="connected")return e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e;if(n.type==="chunk")return{...e,phase:"writing",latestActivity:{kind:"writing"},entries:TF(e.entries,n.text)};if(n.type==="thought")return{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}};if(n.type==="tool"){const i=n.status.toLowerCase(),r=n.title.toLowerCase().includes("publish_artifact")&&(i==="pending"||i==="in_progress");return{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(o=>o.title!==n.title),{title:n.title,status:n.status}],...r?{artifactAuthoring:e.artifactAuthoring??{startedAt:t.now},artifactPublished:null}:{}}}return n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)].slice(0,kF),artifactPublished:{artifact:n.artifact,durationMs:e.artifactAuthoring?t.now-e.artifactAuthoring.startedAt:null},artifactAuthoring:null}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,artifactAuthoring:null,error:null}:Ru(e,n.error.message,t.now)}function D2(e){const t=e.clis.find(r=>r.cliId==="claude"&&r.available)??e.clis.find(r=>r.available)??e.clis[0],n=t?.models.find(r=>t.cliId==="claude"&&r.id==="sonnet")??t?.models.find(r=>r.id===t.defaultModel)??t?.models[0],i=n?.effortLevels.includes("medium")?"medium":n?.defaultEffort??n?.effortLevels[0]??"";return{cliId:t?.cliId??"",model:n?.id??"",effort:i}}function Ru(e,t,n){return{...e,queue:[],busy:!1,phase:"error",runEndedAt:n,artifactAuthoring:null,error:t}}function TF(e,t){const n=e.at(-1);return n?.role==="analyst"?[...e.slice(0,-1),{role:"analyst",text:n.text+t}]:[...e,{role:"analyst",text:t}]}const bd=new Map,Nu=new Map;function sN(e){const t=AF(e.operationId,e.api);return{state:v.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function AF(e,t){const n=bd.get(e);if(n)return n;const i=jF(e,t);return bd.set(e,i),i}function RF(e){bd.get(e)?.dispose()}function NF(e){bd.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const LF=2e3,MF=12e4;function jF(e,t){let n=cb,i=!1,r=null,o=null,u=null,h=null,p=null,f=null,g=0,_=0;const b=new Set,S=O=>{if(i)return;const R=EF(n,O);if(R!==n){n=R;for(const $ of b)$()}},w=()=>{o!==null&&(clearTimeout(o),o=null)},C=()=>{w(),o=setTimeout(()=>{o=null,S({type:"error",message:"Analysis response timed out.",now:Date.now()})},MF)},x=()=>{w(),g+=1,_+=1;const O=r;r=null,O?.()},I=()=>{x(),S({type:"session-lost",now:Date.now()})},z=async()=>{if(r)return;const O=++g;let R=null;const $=new Promise(H=>{R=H});r=CF(t,e,H=>{if(O!==g||i)return;if(H.type==="connected"){S({type:"event",event:H,now:Date.now()}),R?.(),R=null;return}if(H.type==="error"&&I2(H.error.code)){R?.(),R=null,I();return}(H.type==="complete"||H.type==="error")&&w();const J=H.type==="complete"?n.queue[0]:void 0;S({type:"event",event:H,now:Date.now()}),J!==void 0&&!n.busy&&!i&&O===g&&(S({type:"queue-cancel",index:0}),A.send(J))}),await Promise.race([$,new Promise(H=>setTimeout(H,LF))])},A={getSnapshot:()=>n,subscribe:O=>(b.add(O),()=>b.delete(O)),dispatch:S,send:async O=>{const R=Nu.get(e);if(R&&await R,f)try{await f}catch{return}p&&await p;const $=O.trim();if(!$||n.busy||i)return;const H=!n.started,J=++_,Z={cliId:n.cliId,model:n.model,effort:n.effort};if(S({type:"sending",started:H,text:$,now:Date.now()}),H){const K=new AbortController,M=wF(t,e,Z,K.signal);h=K,u=M;try{await M}catch(N){if(i||J!==_)return;if(!(N instanceof lb&&N.code==="analysis_session_exists")){S({type:"start-failed",message:Lu(N),now:Date.now()});return}}finally{h===K&&(h=null),u===M&&(u=null)}if(i||J!==_||!n.started||(await z(),J!==_||!n.started))return}try{if(await xF(t,e,$),J!==_||!n.busy||!n.started)return;C()}catch(K){if(i||J!==_)return;K instanceof lb&&I2(K.code)?I():S({type:"error",message:Lu(K),now:Date.now()})}},stop:async()=>{if(f){await f.catch(()=>{});return}if(p)return p;if(i||!n.started)return;x(),S({type:"stopped",now:Date.now()});const O=nv(t,e).catch(R=>{S({type:"stop-failed",message:Lu(R),now:Date.now()})});p=O,await O,p===O&&(p=null)},reset:async()=>{if(f)return f;if(i)return;const O=n.started||n.phase!=="idle"||n.entries.length>0||n.artifacts.length>0;x();const R=(async()=>{p&&await p,u&&await u.catch(()=>{}),O&&await nv(t,e),await iN(t,e).catch(()=>{}),S({type:"reset"})})().catch($=>{throw S({type:"error",message:`Reset failed: ${Lu($)}`,now:Date.now()}),$});f=R;try{await R}finally{f===R&&(f=null)}},dispose:()=>{if(i)return;const O=Nu.get(e),R=f,$=p,H=u,J=h;i=!0,bd.delete(e),x(),b.clear(),J?.abort();const Z=(async()=>{O&&await O,H&&await H.catch(()=>{}),R&&await R.catch(()=>{}),$&&await $.catch(()=>{}),await nv(t,e)})().catch(()=>{});Nu.set(e,Z),Z.finally(()=>{Nu.get(e)===Z&&Nu.delete(e)})}};return SF(t).then(O=>S({type:"catalog",catalog:O})).catch(O=>S({type:"error",message:Lu(O),now:Date.now()})),A}function Lu(e){return e instanceof Error?e.message:"Analysis is unavailable."}function I2(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function OF({context:e}){const{state:t,dispatch:n}=sN(e),i=v.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),r=t.artifacts[0]?.id??null,[o,u]=v.useState(null),[h,p]=v.useState(!1),f=v.useId(),g=v.useRef(null);v.useEffect(()=>{r&&u(r)},[r]);const _=i.find(S=>S.id===o)??i.at(-1)??null,b=i.length;return v.useEffect(()=>{if(!h)return;const S=C=>{C.target instanceof Node&&!g.current?.contains(C.target)&&p(!1)},w=C=>{C.key==="Escape"&&p(!1)};return document.addEventListener("pointerdown",S),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",w)}},[h]),v.useEffect(()=>{b||p(!1)},[b]),c.jsxs("section",{className:"session-analyst__artifacts","aria-label":"Artifacts",children:[c.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[c.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:"Artifacts"}),c.jsx("small",{children:"Visual outputs from this analysis"})]}),c.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:g,children:[c.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":h,"aria-controls":f,"aria-haspopup":"listbox","aria-label":`${h?"Hide":"Show"} artifacts (${b} ${b===1?"item":"items"})`,onClick:()=>p(S=>!S),disabled:!b,children:[c.jsx("strong",{children:b})," ",c.jsx("span",{children:b===1?"item":"items"}),c.jsx("i",{"aria-hidden":"true"})]}),h?c.jsx("div",{className:"session-analyst__artifact-menu",id:f,role:"listbox","aria-label":"Published artifacts",children:i.map(S=>{const w=S.id===_?.id;return c.jsxs("button",{type:"button",role:"option","aria-selected":w,className:w?"is-active":void 0,title:S.title,onClick:()=>{u(S.id),p(!1)},children:[c.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),c.jsx("strong",{children:S.title}),c.jsx(rN,{createdAt:S.createdAt})]},S.id)})}):null]}),c.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{p(!1),n({type:"clear-artifacts"}),iN(e.api,e.operationId).catch(()=>{})},disabled:!b,children:"Clear"})]}),b===0?c.jsxs("div",{className:"session-analyst__artifacts-empty",children:[c.jsx("strong",{children:"No artifacts yet"}),"Artifacts the analyst publishes will appear here."]}):c.jsx("div",{className:"session-analyst__artifact-content",children:_?c.jsx(DF,{artifact:_,theme:e.theme},_.id):null})]})}function DF({artifact:e,theme:t}){if(!e.id)return null;const n=getComputedStyle(document.documentElement),i=n.getPropertyValue("--ink-veil").trim()||"Canvas",r=n.getPropertyValue("--ink-pearl").trim()||"CanvasText";return c.jsxs("article",{"aria-label":"Selected artifact preview",children:[c.jsxs("header",{children:[c.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),c.jsx(rN,{createdAt:e.createdAt})]}),c.jsx("iframe",{title:e.title,src:bF(e.id,t,i,r),sandbox:"allow-scripts"})]})}function rN({createdAt:e}){const t=new Date(e),n=Number.isFinite(t.getTime());return c.jsx("time",{dateTime:n?t.toISOString():void 0,children:n?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"Unknown time"})}const IF="modulepreload",BF=function(e){return"/console/"+e},B2={},PF=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let p=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");r=p(n.map(f=>{if(f=BF(f),f in B2)return;B2[f]=!0;const g=f.endsWith(".css"),_=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${_}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":IF,g||(b.as="script"),b.crossOrigin="",b.href=f,h&&b.setAttribute("nonce",h),document.head.appendChild(b),g)return new Promise((S,w)=>{b.addEventListener("load",S),b.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return r.then(u=>{for(const h of u||[])h.status==="rejected"&&o(h.reason);return t().catch(o)})};const{entries:aN,setPrototypeOf:P2,isFrozen:$F,getPrototypeOf:zF,getOwnPropertyDescriptor:HF}=Object;let{freeze:$i,seal:Ps,create:Bl}=Object,{apply:ub,construct:db}=typeof Reflect<"u"&&Reflect;$i||($i=function(t){return t});Ps||(Ps=function(t){return t});ub||(ub=function(t,n){for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];return t.apply(n,r)});db||(db=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return new t(...i)});const Mu=Kn(Array.prototype.forEach),FF=Kn(Array.prototype.lastIndexOf),$2=Kn(Array.prototype.pop),ju=Kn(Array.prototype.push),UF=Kn(Array.prototype.splice),Oi=Array.isArray,Xu=Kn(String.prototype.toLowerCase),iv=Kn(String.prototype.toString),z2=Kn(String.prototype.match),Ml=Kn(String.prototype.replace),H2=Kn(String.prototype.indexOf),WF=Kn(String.prototype.trim),qF=Kn(Number.prototype.toString),GF=Kn(Boolean.prototype.toString),F2=typeof BigInt>"u"?null:Kn(BigInt.prototype.toString),U2=typeof Symbol>"u"?null:Kn(Symbol.prototype.toString),Nn=Kn(Object.prototype.hasOwnProperty),Ou=Kn(Object.prototype.toString),bi=Kn(RegExp.prototype.test),cf=KF(TypeError);function Kn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return ub(e,t,i)}}function KF(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return db(e,n)}}function St(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Xu;if(P2&&P2(e,null),!Oi(t))return e;let i=t.length;for(;i--;){let r=t[i];if(typeof r=="string"){const o=n(r);o!==r&&($F(t)||(t[i]=o),r=o)}e[r]=!0}return e}function VF(e){for(let t=0;t<e.length;t++)Nn(e,t)||(e[t]=null);return e}function Ji(e){const t=Bl(null);for(const[n,i]of aN(e))Nn(e,n)&&(Oi(i)?t[n]=VF(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ji(i):t[n]=i);return t}function YF(e){switch(typeof e){case"string":return e;case"number":return qF(e);case"boolean":return GF(e);case"bigint":return F2?F2(e):"0";case"symbol":return U2?U2(e):"Symbol()";case"undefined":return Ou(e);case"function":case"object":{if(e===null)return Ou(e);const t=e,n=Pl(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:Ou(i)}return Ou(e)}default:return Ou(e)}}function Pl(e,t){for(;e!==null;){const i=HF(e,t);if(i){if(i.get)return Kn(i.get);if(typeof i.value=="function")return Kn(i.value)}e=zF(e)}function n(){return null}return n}function XF(e){try{return bi(e,""),!0}catch{return!1}}const W2=$i(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sv=$i(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),rv=$i(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ZF=$i(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),av=$i(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),JF=$i(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),q2=$i(["#text"]),G2=$i(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ov=$i(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),K2=$i(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),uf=$i(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),QF=Ps(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eU=Ps(/<%[\w\W]*|[\w\W]*%>/gm),tU=Ps(/\$\{[\w\W]*/gm),nU=Ps(/^data-[\-\w.\u00B7-\uFFFF]+$/),iU=Ps(/^aria-[\-\w]+$/),oN=Ps(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sU=Ps(/^(?:\w+script|data):/i),rU=Ps(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lN=Ps(/^html$/i),aU=Ps(/^[a-z][.\w]*(-[.\w]+)+$/i);var V2=Object.freeze({__proto__:null,ARIA_ATTR:iU,ATTR_WHITESPACE:rU,CUSTOM_ELEMENT:aU,DATA_ATTR:nU,DOCTYPE_NAME:lN,ERB_EXPR:eU,IS_ALLOWED_URI:oN,IS_SCRIPT_OR_DATA:sU,MUSTACHE_EXPR:QF,TMPLIT_EXPR:tU});const Du={element:1,text:3,progressingInstruction:7,comment:8,document:9},oU=function(){return typeof window>"u"?null:window},lU=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(i=n.getAttribute(r));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Y2=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function cN(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:oU();const t=Ce=>cN(Ce);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Du.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,r=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:u,Node:h,Element:p,NodeFilter:f,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:_,DOMParser:b,trustedTypes:S}=e,w=p.prototype,C=Pl(w,"cloneNode"),x=Pl(w,"remove"),I=Pl(w,"nextSibling"),z=Pl(w,"childNodes"),U=Pl(w,"parentNode");if(typeof u=="function"){const Ce=n.createElement("template");Ce.content&&Ce.content.ownerDocument&&(n=Ce.content.ownerDocument)}let A,O="";const{implementation:R,createNodeIterator:$,createDocumentFragment:H,getElementsByTagName:J}=n,{importNode:Z}=i;let K=Y2();t.isSupported=typeof aN=="function"&&typeof U=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:M,ERB_EXPR:N,TMPLIT_EXPR:D,DATA_ATTR:j,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:F}=V2;let{IS_ALLOWED_URI:W}=V2,E=null;const G=St({},[...W2,...sv,...rv,...av,...q2]);let Y=null;const re=St({},[...G2,...ov,...K2,...uf]);let he=Object.seal(Bl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,ke=null;const Re=Object.seal(Bl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,Ue=!0,Oe=!1,Le=!0,we=!1,Ie=!0,Qe=!1,dt=!1,Je=!1,le=!1,Ye=!1,Pe=!1,At=!0,Zt=!1;const fn="user-content-";let wt=!0,Kt=!1,xt={},Se=null;const We=St({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let xn=null;const $e=St({},["audio","video","img","source","image","track"]);let xe=null;const it=St({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",Dt="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";let Bt=Ct,Ni=!1,se=null;const me=St({},[ht,Dt,Ct],iv);let et=St({},["mi","mo","mn","ms","mtext"]),Ne=St({},["annotation-xml"]);const Ge=St({},["title","style","font","a","script"]);let vt=null;const V=["application/xhtml+xml","text/html"],ue="text/html";let be=null,Ze=null;const Pt=n.createElement("form"),gt=function(q){return q instanceof RegExp||q instanceof Function},je=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ze&&Ze===q)return;(!q||typeof q!="object")&&(q={}),q=Ji(q),vt=V.indexOf(q.PARSER_MEDIA_TYPE)===-1?ue:q.PARSER_MEDIA_TYPE,be=vt==="application/xhtml+xml"?iv:Xu,E=Nn(q,"ALLOWED_TAGS")&&Oi(q.ALLOWED_TAGS)?St({},q.ALLOWED_TAGS,be):G,Y=Nn(q,"ALLOWED_ATTR")&&Oi(q.ALLOWED_ATTR)?St({},q.ALLOWED_ATTR,be):re,se=Nn(q,"ALLOWED_NAMESPACES")&&Oi(q.ALLOWED_NAMESPACES)?St({},q.ALLOWED_NAMESPACES,iv):me,xe=Nn(q,"ADD_URI_SAFE_ATTR")&&Oi(q.ADD_URI_SAFE_ATTR)?St(Ji(it),q.ADD_URI_SAFE_ATTR,be):it,xn=Nn(q,"ADD_DATA_URI_TAGS")&&Oi(q.ADD_DATA_URI_TAGS)?St(Ji($e),q.ADD_DATA_URI_TAGS,be):$e,Se=Nn(q,"FORBID_CONTENTS")&&Oi(q.FORBID_CONTENTS)?St({},q.FORBID_CONTENTS,be):We,ae=Nn(q,"FORBID_TAGS")&&Oi(q.FORBID_TAGS)?St({},q.FORBID_TAGS,be):Ji({}),ke=Nn(q,"FORBID_ATTR")&&Oi(q.FORBID_ATTR)?St({},q.FORBID_ATTR,be):Ji({}),xt=Nn(q,"USE_PROFILES")?q.USE_PROFILES&&typeof q.USE_PROFILES=="object"?Ji(q.USE_PROFILES):q.USE_PROFILES:!1,De=q.ALLOW_ARIA_ATTR!==!1,Ue=q.ALLOW_DATA_ATTR!==!1,Oe=q.ALLOW_UNKNOWN_PROTOCOLS||!1,Le=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=q.SAFE_FOR_TEMPLATES||!1,Ie=q.SAFE_FOR_XML!==!1,Qe=q.WHOLE_DOCUMENT||!1,le=q.RETURN_DOM||!1,Ye=q.RETURN_DOM_FRAGMENT||!1,Pe=q.RETURN_TRUSTED_TYPE||!1,Je=q.FORCE_BODY||!1,At=q.SANITIZE_DOM!==!1,Zt=q.SANITIZE_NAMED_PROPS||!1,wt=q.KEEP_CONTENT!==!1,Kt=q.IN_PLACE||!1,W=XF(q.ALLOWED_URI_REGEXP)?q.ALLOWED_URI_REGEXP:oN,Bt=typeof q.NAMESPACE=="string"?q.NAMESPACE:Ct,et=Nn(q,"MATHML_TEXT_INTEGRATION_POINTS")&&q.MATHML_TEXT_INTEGRATION_POINTS&&typeof q.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ji(q.MATHML_TEXT_INTEGRATION_POINTS):St({},["mi","mo","mn","ms","mtext"]),Ne=Nn(q,"HTML_INTEGRATION_POINTS")&&q.HTML_INTEGRATION_POINTS&&typeof q.HTML_INTEGRATION_POINTS=="object"?Ji(q.HTML_INTEGRATION_POINTS):St({},["annotation-xml"]);const fe=Nn(q,"CUSTOM_ELEMENT_HANDLING")&&q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING=="object"?Ji(q.CUSTOM_ELEMENT_HANDLING):Bl(null);if(he=Bl(null),Nn(fe,"tagNameCheck")&&gt(fe.tagNameCheck)&&(he.tagNameCheck=fe.tagNameCheck),Nn(fe,"attributeNameCheck")&&gt(fe.attributeNameCheck)&&(he.attributeNameCheck=fe.attributeNameCheck),Nn(fe,"allowCustomizedBuiltInElements")&&typeof fe.allowCustomizedBuiltInElements=="boolean"&&(he.allowCustomizedBuiltInElements=fe.allowCustomizedBuiltInElements),we&&(Ue=!1),Ye&&(le=!0),xt&&(E=St({},q2),Y=Bl(null),xt.html===!0&&(St(E,W2),St(Y,G2)),xt.svg===!0&&(St(E,sv),St(Y,ov),St(Y,uf)),xt.svgFilters===!0&&(St(E,rv),St(Y,ov),St(Y,uf)),xt.mathMl===!0&&(St(E,av),St(Y,K2),St(Y,uf))),Re.tagCheck=null,Re.attributeCheck=null,Nn(q,"ADD_TAGS")&&(typeof q.ADD_TAGS=="function"?Re.tagCheck=q.ADD_TAGS:Oi(q.ADD_TAGS)&&(E===G&&(E=Ji(E)),St(E,q.ADD_TAGS,be))),Nn(q,"ADD_ATTR")&&(typeof q.ADD_ATTR=="function"?Re.attributeCheck=q.ADD_ATTR:Oi(q.ADD_ATTR)&&(Y===re&&(Y=Ji(Y)),St(Y,q.ADD_ATTR,be))),Nn(q,"ADD_URI_SAFE_ATTR")&&Oi(q.ADD_URI_SAFE_ATTR)&&St(xe,q.ADD_URI_SAFE_ATTR,be),Nn(q,"FORBID_CONTENTS")&&Oi(q.FORBID_CONTENTS)&&(Se===We&&(Se=Ji(Se)),St(Se,q.FORBID_CONTENTS,be)),Nn(q,"ADD_FORBID_CONTENTS")&&Oi(q.ADD_FORBID_CONTENTS)&&(Se===We&&(Se=Ji(Se)),St(Se,q.ADD_FORBID_CONTENTS,be)),wt&&(E["#text"]=!0),Qe&&St(E,["html","head","body"]),E.table&&(St(E,["tbody"]),delete ae.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw cf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=q.TRUSTED_TYPES_POLICY,O=A.createHTML("")}else A===void 0&&(A=lU(S,r)),A!==null&&typeof O=="string"&&(O=A.createHTML(""));$i&&$i(q),Ze=q},Me=St({},[...sv,...rv,...ZF]),nt=St({},[...av,...JF]),un=function(q){let fe=U(q);(!fe||!fe.tagName)&&(fe={namespaceURI:Bt,tagName:"template"});const Ee=Xu(q.tagName),lt=Xu(fe.tagName);return se[q.namespaceURI]?q.namespaceURI===Dt?fe.namespaceURI===Ct?Ee==="svg":fe.namespaceURI===ht?Ee==="svg"&&(lt==="annotation-xml"||et[lt]):!!Me[Ee]:q.namespaceURI===ht?fe.namespaceURI===Ct?Ee==="math":fe.namespaceURI===Dt?Ee==="math"&&Ne[lt]:!!nt[Ee]:q.namespaceURI===Ct?fe.namespaceURI===Dt&&!Ne[lt]||fe.namespaceURI===ht&&!et[lt]?!1:!nt[Ee]&&(Ge[Ee]||!Me[Ee]):!!(vt==="application/xhtml+xml"&&se[q.namespaceURI]):!1},Tt=function(q){ju(t.removed,{element:q});try{U(q).removeChild(q)}catch{x(q)}},Yn=function(q,fe){try{ju(t.removed,{attribute:fe.getAttributeNode(q),from:fe})}catch{ju(t.removed,{attribute:null,from:fe})}if(fe.removeAttribute(q),q==="is")if(le||Ye)try{Tt(fe)}catch{}else try{fe.setAttribute(q,"")}catch{}},_s=function(q){let fe=null,Ee=null;if(Je)q="<remove></remove>"+q;else{const He=z2(q,/^[\r\n\t ]+/);Ee=He&&He[0]}vt==="application/xhtml+xml"&&Bt===Ct&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const lt=A?A.createHTML(q):q;if(Bt===Ct)try{fe=new b().parseFromString(lt,vt)}catch{}if(!fe||!fe.documentElement){fe=R.createDocument(Bt,"template",null);try{fe.documentElement.innerHTML=Ni?O:lt}catch{}}const ft=fe.body||fe.documentElement;return q&&Ee&&ft.insertBefore(n.createTextNode(Ee),ft.childNodes[0]||null),Bt===Ct?J.call(fe,Qe?"html":"body")[0]:Qe?fe.documentElement:ft},$s=function(q){return $.call(q.ownerDocument||q,q,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},xi=function(q){return q instanceof _&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof g)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},on=function(q){return typeof h=="function"&&q instanceof h};function Gt(Ce,q,fe){Mu(Ce,Ee=>{Ee.call(t,q,fe,Ze)})}const Fi=function(q){let fe=null;if(Gt(K.beforeSanitizeElements,q,null),xi(q))return Tt(q),!0;const Ee=be(q.nodeName);if(Gt(K.uponSanitizeElement,q,{tagName:Ee,allowedTags:E}),Ie&&q.hasChildNodes()&&!on(q.firstElementChild)&&bi(/<[/\w!]/g,q.innerHTML)&&bi(/<[/\w!]/g,q.textContent)||Ie&&q.namespaceURI===Ct&&Ee==="style"&&on(q.firstElementChild)||q.nodeType===Du.progressingInstruction||Ie&&q.nodeType===Du.comment&&bi(/<[/\w]/g,q.data))return Tt(q),!0;if(ae[Ee]||!(Re.tagCheck instanceof Function&&Re.tagCheck(Ee))&&!E[Ee]){if(!ae[Ee]&&ce(Ee)&&(he.tagNameCheck instanceof RegExp&&bi(he.tagNameCheck,Ee)||he.tagNameCheck instanceof Function&&he.tagNameCheck(Ee)))return!1;if(wt&&!Se[Ee]){const lt=U(q)||q.parentNode,ft=z(q)||q.childNodes;if(ft&&lt){const He=ft.length;for(let $t=He-1;$t>=0;--$t){const zt=C(ft[$t],!0);lt.insertBefore(zt,I(q))}}}return Tt(q),!0}return q instanceof p&&!un(q)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&bi(/<\/no(script|embed|frames)/i,q.innerHTML)?(Tt(q),!0):(we&&q.nodeType===Du.text&&(fe=q.textContent,Mu([M,N,D],lt=>{fe=Ml(fe,lt," ")}),q.textContent!==fe&&(ju(t.removed,{element:q.cloneNode()}),q.textContent=fe)),Gt(K.afterSanitizeElements,q,null),!1)},zs=function(q,fe,Ee){if(ke[fe]||At&&(fe==="id"||fe==="name")&&(Ee in n||Ee in Pt))return!1;const lt=Y[fe]||Re.attributeCheck instanceof Function&&Re.attributeCheck(fe,q);if(!(Ue&&!ke[fe]&&bi(j,fe))){if(!(De&&bi(T,fe))){if(!lt||ke[fe]){if(!(ce(q)&&(he.tagNameCheck instanceof RegExp&&bi(he.tagNameCheck,q)||he.tagNameCheck instanceof Function&&he.tagNameCheck(q))&&(he.attributeNameCheck instanceof RegExp&&bi(he.attributeNameCheck,fe)||he.attributeNameCheck instanceof Function&&he.attributeNameCheck(fe,q))||fe==="is"&&he.allowCustomizedBuiltInElements&&(he.tagNameCheck instanceof RegExp&&bi(he.tagNameCheck,Ee)||he.tagNameCheck instanceof Function&&he.tagNameCheck(Ee))))return!1}else if(!xe[fe]){if(!bi(W,Ml(Ee,L,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&q!=="script"&&H2(Ee,"data:")===0&&xn[q])){if(!(Oe&&!bi(B,Ml(Ee,L,"")))){if(Ee)return!1}}}}}}return!0},Sr=St({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ce=function(q){return!Sr[Xu(q)]&&bi(F,q)},ot=function(q){Gt(K.beforeSanitizeAttributes,q,null);const{attributes:fe}=q;if(!fe||xi(q))return;const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let lt=fe.length;for(;lt--;){const ft=fe[lt],{name:He,namespaceURI:$t,value:zt}=ft,ye=be(He),ze=zt;let qe=He==="value"?ze:WF(ze);if(Ee.attrName=ye,Ee.attrValue=qe,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,Gt(K.uponSanitizeAttribute,q,Ee),qe=Ee.attrValue,Zt&&(ye==="id"||ye==="name")&&H2(qe,fn)!==0&&(Yn(He,q),qe=fn+qe),Ie&&bi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,qe)){Yn(He,q);continue}if(ye==="attributename"&&z2(qe,"href")){Yn(He,q);continue}if(Ee.forceKeepAttr)continue;if(!Ee.keepAttr){Yn(He,q);continue}if(!Le&&bi(/\/>/i,qe)){Yn(He,q);continue}we&&Mu([M,N,D],Qt=>{qe=Ml(qe,Qt," ")});const pt=be(q.nodeName);if(!zs(pt,ye,qe)){Yn(He,q);continue}if(A&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!$t)switch(S.getAttributeType(pt,ye)){case"TrustedHTML":{qe=A.createHTML(qe);break}case"TrustedScriptURL":{qe=A.createScriptURL(qe);break}}if(qe!==ze)try{$t?q.setAttributeNS($t,He,qe):q.setAttribute(He,qe),xi(q)?Tt(q):$2(t.removed)}catch{Yn(He,q)}}Gt(K.afterSanitizeAttributes,q,null)},Jt=function(q){let fe=null;const Ee=$s(q);for(Gt(K.beforeSanitizeShadowDOM,q,null);fe=Ee.nextNode();)Gt(K.uponSanitizeShadowNode,fe,null),Fi(fe),ot(fe),fe.content instanceof o&&Jt(fe.content);Gt(K.afterSanitizeShadowDOM,q,null)};return t.sanitize=function(Ce){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Ee=null,lt=null,ft=null;if(Ni=!Ce,Ni&&(Ce="<!-->"),typeof Ce!="string"&&!on(Ce)&&(Ce=YF(Ce),typeof Ce!="string"))throw cf("dirty is not a string, aborting");if(!t.isSupported)return Ce;if(dt||je(q),t.removed=[],typeof Ce=="string"&&(Kt=!1),Kt){const zt=Ce.nodeName;if(typeof zt=="string"){const ye=be(zt);if(!E[ye]||ae[ye])throw cf("root node is forbidden and cannot be sanitized in-place")}}else if(Ce instanceof h)fe=_s("<!---->"),Ee=fe.ownerDocument.importNode(Ce,!0),Ee.nodeType===Du.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?fe=Ee:fe.appendChild(Ee);else{if(!le&&!we&&!Qe&&Ce.indexOf("<")===-1)return A&&Pe?A.createHTML(Ce):Ce;if(fe=_s(Ce),!fe)return le?null:Pe?O:""}fe&&Je&&Tt(fe.firstChild);const He=$s(Kt?Ce:fe);for(;lt=He.nextNode();)Fi(lt),ot(lt),lt.content instanceof o&&Jt(lt.content);if(Kt)return Ce;if(le){if(we){fe.normalize();let zt=fe.innerHTML;Mu([M,N,D],ye=>{zt=Ml(zt,ye," ")}),fe.innerHTML=zt}if(Ye)for(ft=H.call(fe.ownerDocument);fe.firstChild;)ft.appendChild(fe.firstChild);else ft=fe;return(Y.shadowroot||Y.shadowrootmode)&&(ft=Z.call(i,ft,!0)),ft}let $t=Qe?fe.outerHTML:fe.innerHTML;return Qe&&E["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&bi(lN,fe.ownerDocument.doctype.name)&&($t="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
99
+ `+$t),we&&Mu([M,N,D],zt=>{$t=Ml($t,zt," ")}),A&&Pe?A.createHTML($t):$t},t.setConfig=function(){let Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};je(Ce),dt=!0},t.clearConfig=function(){Ze=null,dt=!1},t.isValidAttribute=function(Ce,q,fe){Ze||je({});const Ee=be(Ce),lt=be(q);return zs(Ee,lt,fe)},t.addHook=function(Ce,q){typeof q=="function"&&ju(K[Ce],q)},t.removeHook=function(Ce,q){if(q!==void 0){const fe=FF(K[Ce],q);return fe===-1?void 0:UF(K[Ce],fe,1)[0]}return $2(K[Ce])},t.removeHooks=function(Ce){K[Ce]=[]},t.removeAllHooks=function(){K=Y2()},t}var rd=cN();function J0(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Vo=J0();function uN(e){Vo=e}var ad={exec:()=>null};function Wt(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(r,o)=>{let u=typeof o=="string"?o:o.source;return u=u.replace(Pi.caret,"$1"),n=n.replace(r,u),i},getRegex:()=>new RegExp(n,t)};return i}var cU=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Pi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},uU=/^(?:[ \t]*(?:\n|$))+/,dU=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,hU=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Md=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,fU=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Q0=/(?:[*+-]|\d{1,9}[.)])/,dN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hN=Wt(dN).replace(/bull/g,Q0).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),pU=Wt(dN).replace(/bull/g,Q0).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),e1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,mU=/^[^\n]+/,t1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,gU=Wt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",t1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_U=Wt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Q0).getRegex(),em="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",n1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vU=Wt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",n1).replace("tag",em).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fN=Wt(e1).replace("hr",Md).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",em).getRegex(),yU=Wt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fN).getRegex(),i1={blockquote:yU,code:dU,def:gU,fences:hU,heading:fU,hr:Md,html:vU,lheading:hN,list:_U,newline:uU,paragraph:fN,table:ad,text:mU},X2=Wt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Md).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",em).getRegex(),bU={...i1,lheading:pU,table:X2,paragraph:Wt(e1).replace("hr",Md).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",X2).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",em).getRegex()},SU={...i1,html:Wt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",n1).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ad,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Wt(e1).replace("hr",Md).replace("heading",` *#{1,6} *[^
100
+ ]`).replace("lheading",hN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wU=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xU=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,pN=/^( {2,}|\\)\n(?!\s*$)/,CU=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tm=/[\p{P}\p{S}]/u,s1=/[\s\p{P}\p{S}]/u,mN=/[^\s\p{P}\p{S}]/u,kU=Wt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,s1).getRegex(),gN=/(?!~)[\p{P}\p{S}]/u,EU=/(?!~)[\s\p{P}\p{S}]/u,TU=/(?:[^\s\p{P}\p{S}]|~)/u,AU=Wt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",cU?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),_N=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,RU=Wt(_N,"u").replace(/punct/g,tm).getRegex(),NU=Wt(_N,"u").replace(/punct/g,gN).getRegex(),vN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",LU=Wt(vN,"gu").replace(/notPunctSpace/g,mN).replace(/punctSpace/g,s1).replace(/punct/g,tm).getRegex(),MU=Wt(vN,"gu").replace(/notPunctSpace/g,TU).replace(/punctSpace/g,EU).replace(/punct/g,gN).getRegex(),jU=Wt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,mN).replace(/punctSpace/g,s1).replace(/punct/g,tm).getRegex(),OU=Wt(/\\(punct)/,"gu").replace(/punct/g,tm).getRegex(),DU=Wt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),IU=Wt(n1).replace("(?:-->|$)","-->").getRegex(),BU=Wt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",IU).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,PU=Wt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",bp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),yN=Wt(/^!?\[(label)\]\[(ref)\]/).replace("label",bp).replace("ref",t1).getRegex(),bN=Wt(/^!?\[(ref)\](?:\[\])?/).replace("ref",t1).getRegex(),$U=Wt("reflink|nolink(?!\\()","g").replace("reflink",yN).replace("nolink",bN).getRegex(),Z2=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,r1={_backpedal:ad,anyPunctuation:OU,autolink:DU,blockSkip:AU,br:pN,code:xU,del:ad,emStrongLDelim:RU,emStrongRDelimAst:LU,emStrongRDelimUnd:jU,escape:wU,link:PU,nolink:bN,punctuation:kU,reflink:yN,reflinkSearch:$U,tag:BU,text:CU,url:ad},zU={...r1,link:Wt(/^!?\[(label)\]\((.*?)\)/).replace("label",bp).getRegex(),reflink:Wt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bp).getRegex()},hb={...r1,emStrongRDelimAst:MU,emStrongLDelim:NU,url:Wt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Z2).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Wt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Z2).getRegex()},HU={...hb,br:Wt(pN).replace("{2,}","*").getRegex(),text:Wt(hb.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},df={normal:i1,gfm:bU,pedantic:SU},Iu={normal:r1,gfm:hb,breaks:HU,pedantic:zU},FU={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},J2=e=>FU[e];function lr(e,t){if(t){if(Pi.escapeTest.test(e))return e.replace(Pi.escapeReplace,J2)}else if(Pi.escapeTestNoEncode.test(e))return e.replace(Pi.escapeReplaceNoEncode,J2);return e}function Q2(e){try{e=encodeURI(e).replace(Pi.percentDecode,"%")}catch{return null}return e}function eE(e,t){let n=e.replace(Pi.findPipe,(o,u,h)=>{let p=!1,f=u;for(;--f>=0&&h[f]==="\\";)p=!p;return p?"|":" |"}),i=n.split(Pi.splitPipe),r=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(Pi.slashPipe,"|");return i}function Bu(e,t,n){let i=e.length;if(i===0)return"";let r=0;for(;r<i&&e.charAt(i-r-1)===t;)r++;return e.slice(0,i-r)}function UU(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let i=0;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}function tE(e,t,n,i,r){let o=t.href,u=t.title||null,h=e[1].replace(r.other.outputLinkReplace,"$1");i.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:u,text:h,tokens:i.inlineTokens(h)};return i.state.inLink=!1,p}function WU(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let r=i[1];return t.split(`
101
+ `).map(o=>{let u=o.match(n.other.beginningSpace);if(u===null)return o;let[h]=u;return h.length>=r.length?o.slice(r.length):o}).join(`
102
+ `)}var Sp=class{options;rules;lexer;constructor(e){this.options=e||Vo}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Bu(n,`
103
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=WU(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let i=Bu(n,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Bu(t[0],`
104
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Bu(t[0],`
105
+ `).split(`
106
+ `),i="",r="",o=[];for(;n.length>0;){let u=!1,h=[],p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))h.push(n[p]),u=!0;else if(!u)h.push(n[p]);else break;n=n.slice(p);let f=h.join(`
107
+ `),g=f.replace(this.rules.other.blockquoteSetextReplace,`
108
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
109
+ ${f}`:f,r=r?`${r}
110
+ ${g}`:g;let _=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,o,!0),this.lexer.state.top=_,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let S=b,w=S.raw+`
111
+ `+n.join(`
112
+ `),C=this.blockquote(w);o[o.length-1]=C,i=i.substring(0,i.length-S.raw.length)+C.raw,r=r.substring(0,r.length-S.text.length)+C.text;break}else if(b?.type==="list"){let S=b,w=S.raw+`
113
+ `+n.join(`
114
+ `),C=this.list(w);o[o.length-1]=C,i=i.substring(0,i.length-b.raw.length)+C.raw,r=r.substring(0,r.length-S.raw.length)+C.raw,n=w.substring(o.at(-1).raw.length).split(`
115
+ `);continue}}return{type:"blockquote",raw:i,tokens:o,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let o=this.rules.other.listItemRegex(n),u=!1;for(;e;){let p=!1,f="",g="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let _=t[2].split(`
116
+ `,1)[0].replace(this.rules.other.listReplaceTabs,I=>" ".repeat(3*I.length)),b=e.split(`
117
+ `,1)[0],S=!_.trim(),w=0;if(this.options.pedantic?(w=2,g=_.trimStart()):S?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,g=_.slice(w),w+=t[1].length),S&&this.rules.other.blankLine.test(b)&&(f+=b+`
118
+ `,e=e.substring(b.length+1),p=!0),!p){let I=this.rules.other.nextBulletRegex(w),z=this.rules.other.hrRegex(w),U=this.rules.other.fencesBeginRegex(w),A=this.rules.other.headingBeginRegex(w),O=this.rules.other.htmlBeginRegex(w);for(;e;){let R=e.split(`
119
+ `,1)[0],$;if(b=R,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),$=b):$=b.replace(this.rules.other.tabCharGlobal," "),U.test(b)||A.test(b)||O.test(b)||I.test(b)||z.test(b))break;if($.search(this.rules.other.nonSpaceChar)>=w||!b.trim())g+=`
120
+ `+$.slice(w);else{if(S||_.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||U.test(_)||A.test(_)||z.test(_))break;g+=`
121
+ `+b}!S&&!b.trim()&&(S=!0),f+=R+`
122
+ `,e=e.substring(R.length+1),_=$.slice(w)}}r.loose||(u?r.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(u=!0));let C=null,x;this.options.gfm&&(C=this.rules.other.listIsTask.exec(g),C&&(x=C[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:f,task:!!C,checked:x,loose:!1,text:g,tokens:[]}),r.raw+=f}let h=r.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let p=0;p<r.items.length;p++)if(this.lexer.state.top=!1,r.items[p].tokens=this.lexer.blockTokens(r.items[p].text,[]),!r.loose){let f=r.items[p].tokens.filter(_=>_.type==="space"),g=f.length>0&&f.some(_=>this.rules.other.anyLine.test(_.raw));r.loose=g}if(r.loose)for(let p=0;p<r.items.length;p++)r.items[p].loose=!0;return r}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=eE(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
123
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let u of i)this.rules.other.tableAlignRight.test(u)?o.align.push("right"):this.rules.other.tableAlignCenter.test(u)?o.align.push("center"):this.rules.other.tableAlignLeft.test(u)?o.align.push("left"):o.align.push(null);for(let u=0;u<n.length;u++)o.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:o.align[u]});for(let u of r)o.rows.push(eE(u,o.header.length).map((h,p)=>({text:h,tokens:this.lexer.inline(h),header:!1,align:o.align[p]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
124
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Bu(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=UU(t[2],"()");if(o===-2)return;if(o>-1){let u=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let i=t[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],r=o[3])}else r=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),tE(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=t[i.toLowerCase()];if(!r){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return tE(n,r,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!n||this.rules.inline.punctuation.exec(n))){let r=[...i[0]].length-1,o,u,h=r,p=0,f=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+r);(i=f.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(u=[...o].length,i[3]||i[4]){h+=u;continue}else if((i[5]||i[6])&&r%3&&!((r+u)%3)){p+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+p);let g=[...i[0]][0].length,_=e.slice(0,r+i.index+g+u);if(Math.min(r,u)%2){let S=_.slice(1,-1);return{type:"em",raw:_,text:S,tokens:this.lexer.inlineTokens(S)}}let b=_.slice(2,-2);return{type:"strong",raw:_,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(n),r=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&r&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,i;return t[2]==="@"?(n=t[1],i="mailto:"+n):(n=t[1],i=n),{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},qs=class fb{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Vo,this.options.tokenizer=this.options.tokenizer||new Sp,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Pi,block:df.normal,inline:Iu.normal};this.options.pedantic?(n.block=df.pedantic,n.inline=Iu.pedantic):this.options.gfm&&(n.block=df.gfm,this.options.breaks?n.inline=Iu.breaks:n.inline=Iu.gfm),this.tokenizer.rules=n}static get rules(){return{block:df,inline:Iu}}static lex(t,n){return new fb(n).lex(t)}static lexInline(t,n){return new fb(n).inlineTokens(t)}lex(t){t=t.replace(Pi.carriageReturn,`
125
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let i=this.inlineQueue[n];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],i=!1){for(this.options.pedantic&&(t=t.replace(Pi.tabCharGlobal," ").replace(Pi.spaceLine,""));t;){let r;if(this.options.extensions?.block?.some(u=>(r=u.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let u=n.at(-1);r.raw.length===1&&u!==void 0?u.raw+=`
126
+ `:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
127
+ `)?"":`
128
+ `)+r.raw,u.text+=`
129
+ `+r.text,this.inlineQueue.at(-1).src=u.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="paragraph"||u?.type==="text"?(u.raw+=(u.raw.endsWith(`
130
+ `)?"":`
131
+ `)+r.raw,u.text+=`
132
+ `+r.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let o=t;if(this.options.extensions?.startBlock){let u=1/0,h=t.slice(1),p;this.options.extensions.startBlock.forEach(f=>{p=f.call({lexer:this},h),typeof p=="number"&&p>=0&&(u=Math.min(u,p))}),u<1/0&&u>=0&&(o=t.substring(0,u+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let u=n.at(-1);i&&u?.type==="paragraph"?(u.raw+=(u.raw.endsWith(`
133
+ `)?"":`
134
+ `)+r.raw,u.text+=`
135
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(r),i=o.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);let u=n.at(-1);u?.type==="text"?(u.raw+=(u.raw.endsWith(`
136
+ `)?"":`
137
+ `)+r.raw,u.text+=`
138
+ `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(r);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,r=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)p.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,r.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=r[2]?r[2].length:0,i=i.slice(0,r.index+o)+"["+"a".repeat(r[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let u=!1,h="";for(;t;){u||(h=""),u=!1;let p;if(this.options.extensions?.inline?.some(g=>(p=g.call({lexer:this},t,n))?(t=t.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let g=n.at(-1);p.type==="text"&&g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(t,i,h)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(t)){t=t.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),n.push(p);continue}let f=t;if(this.options.extensions?.startInline){let g=1/0,_=t.slice(1),b;this.options.extensions.startInline.forEach(S=>{b=S.call({lexer:this},_),typeof b=="number"&&b>=0&&(g=Math.min(g,b))}),g<1/0&&g>=0&&(f=t.substring(0,g+1))}if(p=this.tokenizer.inlineText(f)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(h=p.raw.slice(-1)),u=!0;let g=n.at(-1);g?.type==="text"?(g.raw+=p.raw,g.text+=p.text):n.push(p);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return n}},wp=class{options;parser;constructor(e){this.options=e||Vo}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Pi.notSpaceStart)?.[0],r=e.replace(Pi.endingNewline,"")+`
139
+ `;return i?'<pre><code class="language-'+lr(i)+'">'+(n?r:lr(r,!0))+`</code></pre>
140
+ `:"<pre><code>"+(n?r:lr(r,!0))+`</code></pre>
141
+ `}blockquote({tokens:e}){return`<blockquote>
142
+ ${this.parser.parse(e)}</blockquote>
143
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
144
+ `}hr(e){return`<hr>
145
+ `}list(e){let t=e.ordered,n=e.start,i="";for(let u=0;u<e.items.length;u++){let h=e.items[u];i+=this.listitem(h)}let r=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+r+o+`>
146
+ `+i+"</"+r+`>
147
+ `}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+lr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
148
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
149
+ `}table(e){let t="",n="";for(let r=0;r<e.header.length;r++)n+=this.tablecell(e.header[r]);t+=this.tablerow({text:n});let i="";for(let r=0;r<e.rows.length;r++){let o=e.rows[r];n="";for(let u=0;u<o.length;u++)n+=this.tablecell(o[u]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
150
+ <thead>
151
+ `+t+`</thead>
152
+ `+i+`</table>
153
+ `}tablerow({text:e}){return`<tr>
154
+ ${e}</tr>
155
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
156
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${lr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),r=Q2(e);if(r===null)return i;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+lr(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let r=Q2(e);if(r===null)return lr(n);e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${lr(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:lr(e.text)}},a1=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Gs=class pb{options;renderer;textRenderer;constructor(t){this.options=t||Vo,this.options.renderer=this.options.renderer||new wp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new a1}static parse(t,n){return new pb(n).parse(t)}static parseInline(t,n){return new pb(n).parseInline(t)}parse(t,n=!0){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let h=o,p=this.options.extensions.renderers[h.type].call({parser:this},h);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){i+=p||"";continue}}let u=o;switch(u.type){case"space":{i+=this.renderer.space(u);continue}case"hr":{i+=this.renderer.hr(u);continue}case"heading":{i+=this.renderer.heading(u);continue}case"code":{i+=this.renderer.code(u);continue}case"table":{i+=this.renderer.table(u);continue}case"blockquote":{i+=this.renderer.blockquote(u);continue}case"list":{i+=this.renderer.list(u);continue}case"html":{i+=this.renderer.html(u);continue}case"def":{i+=this.renderer.def(u);continue}case"paragraph":{i+=this.renderer.paragraph(u);continue}case"text":{let h=u,p=this.renderer.text(h);for(;r+1<t.length&&t[r+1].type==="text";)h=t[++r],p+=`
157
+ `+this.renderer.text(h);n?i+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):i+=p;continue}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(t,n=this.renderer){let i="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){i+=h||"";continue}}let u=o;switch(u.type){case"escape":{i+=n.text(u);break}case"html":{i+=n.html(u);break}case"link":{i+=n.link(u);break}case"image":{i+=n.image(u);break}case"strong":{i+=n.strong(u);break}case"em":{i+=n.em(u);break}case"codespan":{i+=n.codespan(u);break}case"br":{i+=n.br(u);break}case"del":{i+=n.del(u);break}case"text":{i+=n.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}},Zu=class{options;block;constructor(e){this.options=e||Vo}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?qs.lex:qs.lexInline}provideParser(){return this.block?Gs.parse:Gs.parseInline}},SN=class{defaults=J0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Gs;Renderer=wp;TextRenderer=a1;Lexer=qs;Tokenizer=Sp;Hooks=Zu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let r=i;for(let o of r.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let u of o)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let r=i;n=n.concat(this.walkTokens(r.items,t));break}default:{let r=i;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let u=r[o].flat(1/0);n=n.concat(this.walkTokens(u,t))}):r.tokens&&(n=n.concat(this.walkTokens(r.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...u){let h=r.renderer.apply(this,u);return h===!1&&(h=o.apply(this,u)),h}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),i.extensions=t),n.renderer){let r=this.defaults.renderer||new wp(this.defaults);for(let o in n.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let u=o,h=n.renderer[u],p=r[u];r[u]=(...f)=>{let g=h.apply(r,f);return g===!1&&(g=p.apply(r,f)),g||""}}i.renderer=r}if(n.tokenizer){let r=this.defaults.tokenizer||new Sp(this.defaults);for(let o in n.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let u=o,h=n.tokenizer[u],p=r[u];r[u]=(...f)=>{let g=h.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}i.tokenizer=r}if(n.hooks){let r=this.defaults.hooks||new Zu;for(let o in n.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let u=o,h=n.hooks[u],p=r[u];Zu.passThroughHooks.has(o)?r[u]=f=>{if(this.defaults.async&&Zu.passThroughHooksRespectAsync.has(o))return(async()=>{let _=await h.call(r,f);return p.call(r,_)})();let g=h.call(r,f);return p.call(r,g)}:r[u]=(...f)=>{if(this.defaults.async)return(async()=>{let _=await h.apply(r,f);return _===!1&&(_=await p.apply(r,f)),_})();let g=h.apply(r,f);return g===!1&&(g=p.apply(r,f)),g}}i.hooks=r}if(n.walkTokens){let r=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(u){let h=[];return h.push(o.call(this,u)),r&&(h=h.concat(r.call(this,u))),h}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return qs.lex(e,t??this.defaults)}parser(e,t){return Gs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},r={...this.defaults,...i},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let u=r.hooks?await r.hooks.preprocess(t):t,h=await(r.hooks?await r.hooks.provideLexer():e?qs.lex:qs.lexInline)(u,r),p=r.hooks?await r.hooks.processAllTokens(h):h;r.walkTokens&&await Promise.all(this.walkTokens(p,r.walkTokens));let f=await(r.hooks?await r.hooks.provideParser():e?Gs.parse:Gs.parseInline)(p,r);return r.hooks?await r.hooks.postprocess(f):f})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let u=(r.hooks?r.hooks.provideLexer():e?qs.lex:qs.lexInline)(t,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let h=(r.hooks?r.hooks.provideParser():e?Gs.parse:Gs.parseInline)(u,r);return r.hooks&&(h=r.hooks.postprocess(h)),h}catch(u){return o(u)}}}onError(e,t){return n=>{if(n.message+=`
158
+ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+lr(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Go=new SN;function an(e,t){return Go.parse(e,t)}an.options=an.setOptions=function(e){return Go.setOptions(e),an.defaults=Go.defaults,uN(an.defaults),an};an.getDefaults=J0;an.defaults=Vo;an.use=function(...e){return Go.use(...e),an.defaults=Go.defaults,uN(an.defaults),an};an.walkTokens=function(e,t){return Go.walkTokens(e,t)};an.parseInline=Go.parseInline;an.Parser=Gs;an.parser=Gs.parse;an.Renderer=wp;an.TextRenderer=a1;an.Lexer=qs;an.lexer=qs.lex;an.Tokenizer=Sp;an.Hooks=Zu;an.parse=an;an.options;an.setOptions;an.use;an.walkTokens;an.parseInline;Gs.parse;qs.lex;var lv,nE;function qU(){if(nE)return lv;nE=1;function e(V){return V instanceof Map?V.clear=V.delete=V.set=function(){throw new Error("map is read-only")}:V instanceof Set&&(V.add=V.clear=V.delete=function(){throw new Error("set is read-only")}),Object.freeze(V),Object.getOwnPropertyNames(V).forEach(ue=>{const be=V[ue],Ze=typeof be;(Ze==="object"||Ze==="function")&&!Object.isFrozen(be)&&e(be)}),V}class t{constructor(ue){ue.data===void 0&&(ue.data={}),this.data=ue.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(V){return V.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(V,...ue){const be=Object.create(null);for(const Ze in V)be[Ze]=V[Ze];return ue.forEach(function(Ze){for(const Pt in Ze)be[Pt]=Ze[Pt]}),be}const r="</span>",o=V=>!!V.scope,u=(V,{prefix:ue})=>{if(V.startsWith("language:"))return V.replace("language:","language-");if(V.includes(".")){const be=V.split(".");return[`${ue}${be.shift()}`,...be.map((Ze,Pt)=>`${Ze}${"_".repeat(Pt+1)}`)].join(" ")}return`${ue}${V}`};class h{constructor(ue,be){this.buffer="",this.classPrefix=be.classPrefix,ue.walk(this)}addText(ue){this.buffer+=n(ue)}openNode(ue){if(!o(ue))return;const be=u(ue.scope,{prefix:this.classPrefix});this.span(be)}closeNode(ue){o(ue)&&(this.buffer+=r)}value(){return this.buffer}span(ue){this.buffer+=`<span class="${ue}">`}}const p=(V={})=>{const ue={children:[]};return Object.assign(ue,V),ue};class f{constructor(){this.rootNode=p(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(ue){this.top.children.push(ue)}openNode(ue){const be=p({scope:ue});this.add(be),this.stack.push(be)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(ue){return this.constructor._walk(ue,this.rootNode)}static _walk(ue,be){return typeof be=="string"?ue.addText(be):be.children&&(ue.openNode(be),be.children.forEach(Ze=>this._walk(ue,Ze)),ue.closeNode(be)),ue}static _collapse(ue){typeof ue!="string"&&ue.children&&(ue.children.every(be=>typeof be=="string")?ue.children=[ue.children.join("")]:ue.children.forEach(be=>{f._collapse(be)}))}}class g extends f{constructor(ue){super(),this.options=ue}addText(ue){ue!==""&&this.add(ue)}startScope(ue){this.openNode(ue)}endScope(){this.closeNode()}__addSublanguage(ue,be){const Ze=ue.root;be&&(Ze.scope=`language:${be}`),this.add(Ze)}toHTML(){return new h(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function _(V){return V?typeof V=="string"?V:V.source:null}function b(V){return C("(?=",V,")")}function S(V){return C("(?:",V,")*")}function w(V){return C("(?:",V,")?")}function C(...V){return V.map(be=>_(be)).join("")}function x(V){const ue=V[V.length-1];return typeof ue=="object"&&ue.constructor===Object?(V.splice(V.length-1,1),ue):{}}function I(...V){return"("+(x(V).capture?"":"?:")+V.map(Ze=>_(Ze)).join("|")+")"}function z(V){return new RegExp(V.toString()+"|").exec("").length-1}function U(V,ue){const be=V&&V.exec(ue);return be&&be.index===0}const A=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function O(V,{joinWith:ue}){let be=0;return V.map(Ze=>{be+=1;const Pt=be;let gt=_(Ze),je="";for(;gt.length>0;){const Me=A.exec(gt);if(!Me){je+=gt;break}je+=gt.substring(0,Me.index),gt=gt.substring(Me.index+Me[0].length),Me[0][0]==="\\"&&Me[1]?je+="\\"+String(Number(Me[1])+Pt):(je+=Me[0],Me[0]==="("&&be++)}return je}).map(Ze=>`(${Ze})`).join(ue)}const R=/\b\B/,$="[a-zA-Z]\\w*",H="[a-zA-Z_]\\w*",J="\\b\\d+(\\.\\d+)?",Z="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",K="\\b(0b[01]+)",M="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",N=(V={})=>{const ue=/^#![ ]*\//;return V.binary&&(V.begin=C(ue,/.*\b/,V.binary,/\b.*/)),i({scope:"meta",begin:ue,end:/$/,relevance:0,"on:begin":(be,Ze)=>{be.index!==0&&Ze.ignoreMatch()}},V)},D={begin:"\\\\[\\s\\S]",relevance:0},j={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},T={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},B={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},L=function(V,ue,be={}){const Ze=i({scope:"comment",begin:V,end:ue,contains:[]},be);Ze.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Pt=I("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Ze.contains.push({begin:C(/[ ]+/,"(",Pt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ze},F=L("//","$"),W=L("/\\*","\\*/"),E=L("#","$"),G={scope:"number",begin:J,relevance:0},Y={scope:"number",begin:Z,relevance:0},re={scope:"number",begin:K,relevance:0},he={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},ae={scope:"title",begin:$,relevance:0},ke={scope:"title",begin:H,relevance:0},Re={begin:"\\.\\s*"+H,relevance:0};var Ue=Object.freeze({__proto__:null,APOS_STRING_MODE:j,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:re,BINARY_NUMBER_RE:K,COMMENT:L,C_BLOCK_COMMENT_MODE:W,C_LINE_COMMENT_MODE:F,C_NUMBER_MODE:Y,C_NUMBER_RE:Z,END_SAME_AS_BEGIN:function(V){return Object.assign(V,{"on:begin":(ue,be)=>{be.data._beginMatch=ue[1]},"on:end":(ue,be)=>{be.data._beginMatch!==ue[1]&&be.ignoreMatch()}})},HASH_COMMENT_MODE:E,IDENT_RE:$,MATCH_NOTHING_RE:R,METHOD_GUARD:Re,NUMBER_MODE:G,NUMBER_RE:J,PHRASAL_WORDS_MODE:B,QUOTE_STRING_MODE:T,REGEXP_MODE:he,RE_STARTERS_RE:M,SHEBANG:N,TITLE_MODE:ae,UNDERSCORE_IDENT_RE:H,UNDERSCORE_TITLE_MODE:ke});function Oe(V,ue){V.input[V.index-1]==="."&&ue.ignoreMatch()}function Le(V,ue){V.className!==void 0&&(V.scope=V.className,delete V.className)}function we(V,ue){ue&&V.beginKeywords&&(V.begin="\\b("+V.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",V.__beforeBegin=Oe,V.keywords=V.keywords||V.beginKeywords,delete V.beginKeywords,V.relevance===void 0&&(V.relevance=0))}function Ie(V,ue){Array.isArray(V.illegal)&&(V.illegal=I(...V.illegal))}function Qe(V,ue){if(V.match){if(V.begin||V.end)throw new Error("begin & end are not supported with match");V.begin=V.match,delete V.match}}function dt(V,ue){V.relevance===void 0&&(V.relevance=1)}const Je=(V,ue)=>{if(!V.beforeMatch)return;if(V.starts)throw new Error("beforeMatch cannot be used with starts");const be=Object.assign({},V);Object.keys(V).forEach(Ze=>{delete V[Ze]}),V.keywords=be.keywords,V.begin=C(be.beforeMatch,b(be.begin)),V.starts={relevance:0,contains:[Object.assign(be,{endsParent:!0})]},V.relevance=0,delete be.beforeMatch},le=["of","and","for","in","not","or","if","then","parent","list","value"],Ye="keyword";function Pe(V,ue,be=Ye){const Ze=Object.create(null);return typeof V=="string"?Pt(be,V.split(" ")):Array.isArray(V)?Pt(be,V):Object.keys(V).forEach(function(gt){Object.assign(Ze,Pe(V[gt],ue,gt))}),Ze;function Pt(gt,je){ue&&(je=je.map(Me=>Me.toLowerCase())),je.forEach(function(Me){const nt=Me.split("|");Ze[nt[0]]=[gt,At(nt[0],nt[1])]})}}function At(V,ue){return ue?Number(ue):Zt(V)?0:1}function Zt(V){return le.includes(V.toLowerCase())}const fn={},wt=V=>{console.error(V)},Kt=(V,...ue)=>{console.log(`WARN: ${V}`,...ue)},xt=(V,ue)=>{fn[`${V}/${ue}`]||(console.log(`Deprecated as of ${V}. ${ue}`),fn[`${V}/${ue}`]=!0)},Se=new Error;function We(V,ue,{key:be}){let Ze=0;const Pt=V[be],gt={},je={};for(let Me=1;Me<=ue.length;Me++)je[Me+Ze]=Pt[Me],gt[Me+Ze]=!0,Ze+=z(ue[Me-1]);V[be]=je,V[be]._emit=gt,V[be]._multi=!0}function xn(V){if(Array.isArray(V.begin)){if(V.skip||V.excludeBegin||V.returnBegin)throw wt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Se;if(typeof V.beginScope!="object"||V.beginScope===null)throw wt("beginScope must be object"),Se;We(V,V.begin,{key:"beginScope"}),V.begin=O(V.begin,{joinWith:""})}}function $e(V){if(Array.isArray(V.end)){if(V.skip||V.excludeEnd||V.returnEnd)throw wt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Se;if(typeof V.endScope!="object"||V.endScope===null)throw wt("endScope must be object"),Se;We(V,V.end,{key:"endScope"}),V.end=O(V.end,{joinWith:""})}}function xe(V){V.scope&&typeof V.scope=="object"&&V.scope!==null&&(V.beginScope=V.scope,delete V.scope)}function it(V){xe(V),typeof V.beginScope=="string"&&(V.beginScope={_wrap:V.beginScope}),typeof V.endScope=="string"&&(V.endScope={_wrap:V.endScope}),xn(V),$e(V)}function ht(V){function ue(je,Me){return new RegExp(_(je),"m"+(V.case_insensitive?"i":"")+(V.unicodeRegex?"u":"")+(Me?"g":""))}class be{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Me,nt){nt.position=this.position++,this.matchIndexes[this.matchAt]=nt,this.regexes.push([nt,Me]),this.matchAt+=z(Me)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Me=this.regexes.map(nt=>nt[1]);this.matcherRe=ue(O(Me,{joinWith:"|"}),!0),this.lastIndex=0}exec(Me){this.matcherRe.lastIndex=this.lastIndex;const nt=this.matcherRe.exec(Me);if(!nt)return null;const un=nt.findIndex((Yn,_s)=>_s>0&&Yn!==void 0),Tt=this.matchIndexes[un];return nt.splice(0,un),Object.assign(nt,Tt)}}class Ze{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Me){if(this.multiRegexes[Me])return this.multiRegexes[Me];const nt=new be;return this.rules.slice(Me).forEach(([un,Tt])=>nt.addRule(un,Tt)),nt.compile(),this.multiRegexes[Me]=nt,nt}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Me,nt){this.rules.push([Me,nt]),nt.type==="begin"&&this.count++}exec(Me){const nt=this.getMatcher(this.regexIndex);nt.lastIndex=this.lastIndex;let un=nt.exec(Me);if(this.resumingScanAtSamePosition()&&!(un&&un.index===this.lastIndex)){const Tt=this.getMatcher(0);Tt.lastIndex=this.lastIndex+1,un=Tt.exec(Me)}return un&&(this.regexIndex+=un.position+1,this.regexIndex===this.count&&this.considerAll()),un}}function Pt(je){const Me=new Ze;return je.contains.forEach(nt=>Me.addRule(nt.begin,{rule:nt,type:"begin"})),je.terminatorEnd&&Me.addRule(je.terminatorEnd,{type:"end"}),je.illegal&&Me.addRule(je.illegal,{type:"illegal"}),Me}function gt(je,Me){const nt=je;if(je.isCompiled)return nt;[Le,Qe,it,Je].forEach(Tt=>Tt(je,Me)),V.compilerExtensions.forEach(Tt=>Tt(je,Me)),je.__beforeBegin=null,[we,Ie,dt].forEach(Tt=>Tt(je,Me)),je.isCompiled=!0;let un=null;return typeof je.keywords=="object"&&je.keywords.$pattern&&(je.keywords=Object.assign({},je.keywords),un=je.keywords.$pattern,delete je.keywords.$pattern),un=un||/\w+/,je.keywords&&(je.keywords=Pe(je.keywords,V.case_insensitive)),nt.keywordPatternRe=ue(un,!0),Me&&(je.begin||(je.begin=/\B|\b/),nt.beginRe=ue(nt.begin),!je.end&&!je.endsWithParent&&(je.end=/\B|\b/),je.end&&(nt.endRe=ue(nt.end)),nt.terminatorEnd=_(nt.end)||"",je.endsWithParent&&Me.terminatorEnd&&(nt.terminatorEnd+=(je.end?"|":"")+Me.terminatorEnd)),je.illegal&&(nt.illegalRe=ue(je.illegal)),je.contains||(je.contains=[]),je.contains=[].concat(...je.contains.map(function(Tt){return Ct(Tt==="self"?je:Tt)})),je.contains.forEach(function(Tt){gt(Tt,nt)}),je.starts&&gt(je.starts,Me),nt.matcher=Pt(nt),nt}if(V.compilerExtensions||(V.compilerExtensions=[]),V.contains&&V.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return V.classNameAliases=i(V.classNameAliases||{}),gt(V)}function Dt(V){return V?V.endsWithParent||Dt(V.starts):!1}function Ct(V){return V.variants&&!V.cachedVariants&&(V.cachedVariants=V.variants.map(function(ue){return i(V,{variants:null},ue)})),V.cachedVariants?V.cachedVariants:Dt(V)?i(V,{starts:V.starts?i(V.starts):null}):Object.isFrozen(V)?i(V):V}var Bt="11.11.1";class Ni extends Error{constructor(ue,be){super(ue),this.name="HTMLInjectionError",this.html=be}}const se=n,me=i,et=Symbol("nomatch"),Ne=7,Ge=function(V){const ue=Object.create(null),be=Object.create(null),Ze=[];let Pt=!0;const gt="Could not find the language '{}', did you forget to load/include a language module?",je={disableAutodetect:!0,name:"Plain text",contains:[]};let Me={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function nt(ye){return Me.noHighlightRe.test(ye)}function un(ye){let ze=ye.className+" ";ze+=ye.parentNode?ye.parentNode.className:"";const qe=Me.languageDetectRe.exec(ze);if(qe){const pt=q(qe[1]);return pt||(Kt(gt.replace("{}",qe[1])),Kt("Falling back to no-highlight mode for this block.",ye)),pt?qe[1]:"no-highlight"}return ze.split(/\s+/).find(pt=>nt(pt)||q(pt))}function Tt(ye,ze,qe){let pt="",Qt="";typeof ze=="object"?(pt=ye,qe=ze.ignoreIllegals,Qt=ze.language):(xt("10.7.0","highlight(lang, code, ...args) has been deprecated."),xt("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Qt=ye,pt=ze),qe===void 0&&(qe=!0);const Pn={code:pt,language:Qt};$t("before:highlight",Pn);const dn=Pn.result?Pn.result:Yn(Pn.language,Pn.code,qe);return dn.code=Pn.code,$t("after:highlight",dn),dn}function Yn(ye,ze,qe,pt){const Qt=Object.create(null);function Pn(Ae,Ke){return Ae.keywords[Ke]}function dn(){if(!at.keywords){$n.addText(Vt);return}let Ae=0;at.keywordPatternRe.lastIndex=0;let Ke=at.keywordPatternRe.exec(Vt),_t="";for(;Ke;){_t+=Vt.substring(Ae,Ke.index);const Mt=pi.case_insensitive?Ke[0].toLowerCase():Ke[0],Cn=Pn(at,Mt);if(Cn){const[vs,Ec]=Cn;if($n.addText(_t),_t="",Qt[Mt]=(Qt[Mt]||0)+1,Qt[Mt]<=Ne&&(sa+=Ec),vs.startsWith("_"))_t+=Ke[0];else{const Id=pi.classNameAliases[vs]||vs;Ci(Ke[0],Id)}}else _t+=Ke[0];Ae=at.keywordPatternRe.lastIndex,Ke=at.keywordPatternRe.exec(Vt)}_t+=Vt.substring(Ae),$n.addText(_t)}function ti(){if(Vt==="")return;let Ae=null;if(typeof at.subLanguage=="string"){if(!ue[at.subLanguage]){$n.addText(Vt);return}Ae=Yn(at.subLanguage,Vt,!0,Dd[at.subLanguage]),Dd[at.subLanguage]=Ae._top}else Ae=$s(Vt,at.subLanguage.length?at.subLanguage:null);at.relevance>0&&(sa+=Ae.relevance),$n.__addSublanguage(Ae._emitter,Ae.language)}function en(){at.subLanguage!=null?ti():dn(),Vt=""}function Ci(Ae,Ke){Ae!==""&&($n.startScope(Ke),$n.addText(Ae),$n.endScope())}function Yo(Ae,Ke){let _t=1;const Mt=Ke.length-1;for(;_t<=Mt;){if(!Ae._emit[_t]){_t++;continue}const Cn=pi.classNameAliases[Ae[_t]]||Ae[_t],vs=Ke[_t];Cn?Ci(vs,Cn):(Vt=vs,dn(),Vt=""),_t++}}function ia(Ae,Ke){return Ae.scope&&typeof Ae.scope=="string"&&$n.openNode(pi.classNameAliases[Ae.scope]||Ae.scope),Ae.beginScope&&(Ae.beginScope._wrap?(Ci(Vt,pi.classNameAliases[Ae.beginScope._wrap]||Ae.beginScope._wrap),Vt=""):Ae.beginScope._multi&&(Yo(Ae.beginScope,Ke),Vt="")),at=Object.create(Ae,{parent:{value:at}}),at}function to(Ae,Ke,_t){let Mt=U(Ae.endRe,_t);if(Mt){if(Ae["on:end"]){const Cn=new t(Ae);Ae["on:end"](Ke,Cn),Cn.isMatchIgnored&&(Mt=!1)}if(Mt){for(;Ae.endsParent&&Ae.parent;)Ae=Ae.parent;return Ae}}if(Ae.endsWithParent)return to(Ae.parent,Ke,_t)}function Xo(Ae){return at.matcher.regexIndex===0?(Vt+=Ae[0],1):(ra=!0,0)}function lm(Ae){const Ke=Ae[0],_t=Ae.rule,Mt=new t(_t),Cn=[_t.__beforeBegin,_t["on:begin"]];for(const vs of Cn)if(vs&&(vs(Ae,Mt),Mt.isMatchIgnored))return Xo(Ke);return _t.skip?Vt+=Ke:(_t.excludeBegin&&(Vt+=Ke),en(),!_t.returnBegin&&!_t.excludeBegin&&(Vt=Ke)),ia(_t,Ae),_t.returnBegin?0:Ke.length}function Ui(Ae){const Ke=Ae[0],_t=ze.substring(Ae.index),Mt=to(at,Ae,_t);if(!Mt)return et;const Cn=at;at.endScope&&at.endScope._wrap?(en(),Ci(Ke,at.endScope._wrap)):at.endScope&&at.endScope._multi?(en(),Yo(at.endScope,Ae)):Cn.skip?Vt+=Ke:(Cn.returnEnd||Cn.excludeEnd||(Vt+=Ke),en(),Cn.excludeEnd&&(Vt=Ke));do at.scope&&$n.closeNode(),!at.skip&&!at.subLanguage&&(sa+=at.relevance),at=at.parent;while(at!==Mt.parent);return Mt.starts&&ia(Mt.starts,Ae),Cn.returnEnd?0:Ke.length}function Cc(){const Ae=[];for(let Ke=at;Ke!==pi;Ke=Ke.parent)Ke.scope&&Ae.unshift(Ke.scope);Ae.forEach(Ke=>$n.openNode(Ke))}let no={};function Zo(Ae,Ke){const _t=Ke&&Ke[0];if(Vt+=Ae,_t==null)return en(),0;if(no.type==="begin"&&Ke.type==="end"&&no.index===Ke.index&&_t===""){if(Vt+=ze.slice(Ke.index,Ke.index+1),!Pt){const Mt=new Error(`0 width match regex (${ye})`);throw Mt.languageName=ye,Mt.badRule=no.rule,Mt}return 1}if(no=Ke,Ke.type==="begin")return lm(Ke);if(Ke.type==="illegal"&&!qe){const Mt=new Error('Illegal lexeme "'+_t+'" for mode "'+(at.scope||"<unnamed>")+'"');throw Mt.mode=at,Mt}else if(Ke.type==="end"){const Mt=Ui(Ke);if(Mt!==et)return Mt}if(Ke.type==="illegal"&&_t==="")return Vt+=`
160
+ `,1;if(kc>1e5&&kc>Ke.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Vt+=_t,_t.length}const pi=q(ye);if(!pi)throw wt(gt.replace("{}",ye)),new Error('Unknown language: "'+ye+'"');const Od=ht(pi);let Jo="",at=pt||Od;const Dd={},$n=new Me.__emitter(Me);Cc();let Vt="",sa=0,wr=0,kc=0,ra=!1;try{if(pi.__emitTokens)pi.__emitTokens(ze,$n);else{for(at.matcher.considerAll();;){kc++,ra?ra=!1:at.matcher.considerAll(),at.matcher.lastIndex=wr;const Ae=at.matcher.exec(ze);if(!Ae)break;const Ke=ze.substring(wr,Ae.index),_t=Zo(Ke,Ae);wr=Ae.index+_t}Zo(ze.substring(wr))}return $n.finalize(),Jo=$n.toHTML(),{language:ye,value:Jo,relevance:sa,illegal:!1,_emitter:$n,_top:at}}catch(Ae){if(Ae.message&&Ae.message.includes("Illegal"))return{language:ye,value:se(ze),illegal:!0,relevance:0,_illegalBy:{message:Ae.message,index:wr,context:ze.slice(wr-100,wr+100),mode:Ae.mode,resultSoFar:Jo},_emitter:$n};if(Pt)return{language:ye,value:se(ze),illegal:!1,relevance:0,errorRaised:Ae,_emitter:$n,_top:at};throw Ae}}function _s(ye){const ze={value:se(ye),illegal:!1,relevance:0,_top:je,_emitter:new Me.__emitter(Me)};return ze._emitter.addText(ye),ze}function $s(ye,ze){ze=ze||Me.languages||Object.keys(ue);const qe=_s(ye),pt=ze.filter(q).filter(Ee).map(en=>Yn(en,ye,!1));pt.unshift(qe);const Qt=pt.sort((en,Ci)=>{if(en.relevance!==Ci.relevance)return Ci.relevance-en.relevance;if(en.language&&Ci.language){if(q(en.language).supersetOf===Ci.language)return 1;if(q(Ci.language).supersetOf===en.language)return-1}return 0}),[Pn,dn]=Qt,ti=Pn;return ti.secondBest=dn,ti}function xi(ye,ze,qe){const pt=ze&&be[ze]||qe;ye.classList.add("hljs"),ye.classList.add(`language-${pt}`)}function on(ye){let ze=null;const qe=un(ye);if(nt(qe))return;if($t("before:highlightElement",{el:ye,language:qe}),ye.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",ye);return}if(ye.children.length>0&&(Me.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(ye)),Me.throwUnescapedHTML))throw new Ni("One of your code blocks includes unescaped HTML.",ye.innerHTML);ze=ye;const pt=ze.textContent,Qt=qe?Tt(pt,{language:qe,ignoreIllegals:!0}):$s(pt);ye.innerHTML=Qt.value,ye.dataset.highlighted="yes",xi(ye,qe,Qt.language),ye.result={language:Qt.language,re:Qt.relevance,relevance:Qt.relevance},Qt.secondBest&&(ye.secondBest={language:Qt.secondBest.language,relevance:Qt.secondBest.relevance}),$t("after:highlightElement",{el:ye,result:Qt,text:pt})}function Gt(ye){Me=me(Me,ye)}const Fi=()=>{ce(),xt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function zs(){ce(),xt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Sr=!1;function ce(){function ye(){ce()}if(document.readyState==="loading"){Sr||window.addEventListener("DOMContentLoaded",ye,!1),Sr=!0;return}document.querySelectorAll(Me.cssSelector).forEach(on)}function ot(ye,ze){let qe=null;try{qe=ze(V)}catch(pt){if(wt("Language definition for '{}' could not be registered.".replace("{}",ye)),Pt)wt(pt);else throw pt;qe=je}qe.name||(qe.name=ye),ue[ye]=qe,qe.rawDefinition=ze.bind(null,V),qe.aliases&&fe(qe.aliases,{languageName:ye})}function Jt(ye){delete ue[ye];for(const ze of Object.keys(be))be[ze]===ye&&delete be[ze]}function Ce(){return Object.keys(ue)}function q(ye){return ye=(ye||"").toLowerCase(),ue[ye]||ue[be[ye]]}function fe(ye,{languageName:ze}){typeof ye=="string"&&(ye=[ye]),ye.forEach(qe=>{be[qe.toLowerCase()]=ze})}function Ee(ye){const ze=q(ye);return ze&&!ze.disableAutodetect}function lt(ye){ye["before:highlightBlock"]&&!ye["before:highlightElement"]&&(ye["before:highlightElement"]=ze=>{ye["before:highlightBlock"](Object.assign({block:ze.el},ze))}),ye["after:highlightBlock"]&&!ye["after:highlightElement"]&&(ye["after:highlightElement"]=ze=>{ye["after:highlightBlock"](Object.assign({block:ze.el},ze))})}function ft(ye){lt(ye),Ze.push(ye)}function He(ye){const ze=Ze.indexOf(ye);ze!==-1&&Ze.splice(ze,1)}function $t(ye,ze){const qe=ye;Ze.forEach(function(pt){pt[qe]&&pt[qe](ze)})}function zt(ye){return xt("10.7.0","highlightBlock will be removed entirely in v12.0"),xt("10.7.0","Please use highlightElement now."),on(ye)}Object.assign(V,{highlight:Tt,highlightAuto:$s,highlightAll:ce,highlightElement:on,highlightBlock:zt,configure:Gt,initHighlighting:Fi,initHighlightingOnLoad:zs,registerLanguage:ot,unregisterLanguage:Jt,listLanguages:Ce,getLanguage:q,registerAliases:fe,autoDetection:Ee,inherit:me,addPlugin:ft,removePlugin:He}),V.debugMode=function(){Pt=!1},V.safeMode=function(){Pt=!0},V.versionString=Bt,V.regex={concat:C,lookahead:b,either:I,optional:w,anyNumberOfTimes:S};for(const ye in Ue)typeof Ue[ye]=="object"&&e(Ue[ye]);return Object.assign(V,Ue),V},vt=Ge({});return vt.newInstance=()=>Ge({}),lv=vt,vt.HighlightJS=vt,vt.default=vt,lv}var GU=qU();const As=Kb(GU);function iE(e){const t=e.regex,n={},i={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},i]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),u={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},h={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(h);const p={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},_={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],S=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),w={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},C=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],x=["true","false"],I={match:/(\/[a-z._-]+)+/},z=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],U=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],A=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],O=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:C,literal:x,built_in:[...z,...U,"set","shopt",...A,...O]},contains:[S,e.SHEBANG(),w,_,o,u,I,h,p,f,g,n]}}const sE="[A-Za-z$_][0-9A-Za-z$_]*",KU=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],VU=["true","false","null","undefined","NaN","Infinity"],wN=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],xN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],CN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],YU=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],XU=[].concat(CN,wN,xN);function rE(e){const t=e.regex,n=(L,{after:F})=>{const W="</"+L[0].slice(1);return L.input.indexOf(W,F)!==-1},i=sE,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,F)=>{const W=L[0].length+L.index,E=L.input[W];if(E==="<"||E===","){F.ignoreMatch();return}E===">"&&(n(L,{after:W})||F.ignoreMatch());let G;const Y=L.input.substring(W);if(G=Y.match(/^\s*=/)){F.ignoreMatch();return}if((G=Y.match(/^\s+extends\s+/))&&G.index===0){F.ignoreMatch();return}}},h={$pattern:sE,keyword:KU,literal:VU,built_in:XU,"variable.language":YU},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},U=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,C,x,{match:/\$\d+/},_];b.contains=U.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(U)});const A=[].concat(z,b.contains),O=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(A)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},$={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},H={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...wN,...xN]}},J={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,M([...CN,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:H},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),J,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,C,x,z,{match:/\$\d+/},_,H,{scope:"attr",match:i+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[z,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},N,K,$,j,{match:/\$[(.]/}]}}function ZU(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],r={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function aE(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},o={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},u={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},h=/[A-Za-z][A-Za-z0-9+.-]*/,p={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,h,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},_=e.inherit(f,{contains:[]}),b=e.inherit(g,{contains:[]});f.contains.push(b),g.contains.push(_);let S=[n,p];return[f,g,_,b].forEach(I=>{I.contains=I.contains.concat(S)}),S=S.concat(f,g),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:S},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:S}]}]},n,o,f,g,{className:"quote",begin:"^>\\s+",contains:S,end:"$"},r,i,p,u,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function oE(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],h={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},p={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:h,illegal:/#/},g={begin:/\{\{/,relevance:0},_={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,p,g,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b="[0-9](_?[0-9])*",S=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,w=`\\b|${i.join("|")}`,C={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${S}))[eE][+-]?(${b})[jJ]?(?=${w})`},{begin:`(${S})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${w})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${w})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${w})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${w})`},{begin:`\\b(${b})[jJ](?=${w})`}]},x={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:h,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},I={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:["self",p,C,_,e.HASH_COMMENT_MODE]}]};return f.contains=[_,C,p],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:h,illegal:/(<\/|\?)|=>/,contains:[p,C,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},_,x,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[I]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[C,I,_]}]}}const xp="[A-Za-z$_][0-9A-Za-z$_]*",kN=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],EN=["true","false","null","undefined","NaN","Infinity"],TN=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],AN=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],RN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],NN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LN=[].concat(RN,TN,AN);function JU(e){const t=e.regex,n=(L,{after:F})=>{const W="</"+L[0].slice(1);return L.input.indexOf(W,F)!==-1},i=xp,r={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,u={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,F)=>{const W=L[0].length+L.index,E=L.input[W];if(E==="<"||E===","){F.ignoreMatch();return}E===">"&&(n(L,{after:W})||F.ignoreMatch());let G;const Y=L.input.substring(W);if(G=Y.match(/^\s*=/)){F.ignoreMatch();return}if((G=Y.match(/^\s+extends\s+/))&&G.index===0){F.ignoreMatch();return}}},h={$pattern:xp,keyword:kN,literal:EN,built_in:LN,"variable.language":NN},p="[0-9](_?[0-9])*",f=`\\.(${p})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",_={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${p})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},b={className:"subst",begin:"\\$\\{",end:"\\}",keywords:h,contains:[]},S={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},w={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"css"}},C={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"graphql"}},x={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,b]},z={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},U=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,C,x,{match:/\$\d+/},_];b.contains=U.concat({begin:/\{/,end:/\}/,keywords:h,contains:["self"].concat(U)});const A=[].concat(z,b.contains),O=A.concat([{begin:/(\s*)\(/,end:/\)/,keywords:h,contains:["self"].concat(A)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O},$={variants:[{match:[/class/,/\s+/,i,/\s+/,/extends/,/\s+/,t.concat(i,"(",t.concat(/\./,i),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,i],scope:{1:"keyword",3:"title.class"}}]},H={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...TN,...AN]}},J={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Z={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},K={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function M(L){return t.concat("(?!",L.join("|"),")")}const N={match:t.concat(/\b/,M([...RN,"super","import"].map(L=>`${L}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:h,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:H},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),J,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,S,w,C,x,z,{match:/\$\d+/},_,H,{scope:"attr",match:i+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[z,e.REGEXP_MODE,{className:"function",begin:T,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:h,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:o},{begin:u.begin,"on:begin":u.isTrulyOpeningTag,end:u.end}],subLanguage:"xml",contains:[{begin:u.begin,end:u.end,skip:!0,contains:["self"]}]}]},Z,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[R,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},N,K,$,j,{match:/\$[(.]/}]}}function lE(e){const t=e.regex,n=JU(e),i=xp,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},u={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},h={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},p=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:xp,keyword:kN.concat(p),literal:EN,built_in:LN.concat(r),"variable.language":NN},g={className:"meta",begin:"@"+i},_=(C,x,I)=>{const z=C.contains.findIndex(U=>U.label===x);if(z===-1)throw new Error("can not find mode to replace");C.contains.splice(z,1,I)};Object.assign(n.keywords,f),n.exports.PARAMS_CONTAINS.push(g);const b=n.contains.find(C=>C.scope==="attr"),S=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,S]),n.contains=n.contains.concat([g,o,u,S]),_(n,"shebang",e.SHEBANG()),_(n,"use_strict",h);const w=n.contains.find(C=>C.label==="func.def");return w.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const QU=/\[\[wiki:([^\]]+)\]\]/g,eW=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,tW=/^(\S[^:]*?):[ \t]*(.*)$/,nW=new SN({gfm:!0,breaks:!1}),cE={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},cv=gW();function Bs(e,t={}){const{entries:n,content:i}=rW(e),r=lW(i,t.resolveWikiLink),o=nW.parse(r,{async:!1}),u=oW(n),h=rd.sanitize(u+o,cE),p=new DOMParser().parseFromString(h,"text/html");return uW(p,t.omitDuplicateTitle),cW(p),dW(p),fW(p),{html:rd.sanitize(p.body.innerHTML,cE),toc:pW(p)}}function iW(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function sW(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new TextDecoder().decode(n)}function rW(e){const t=eW.exec(e);return t?{entries:aW(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function aW(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const r=tW.exec(i);if(r){const[,h="",p=""]=r;t.push({key:h.trim(),value:p.trim()});continue}const o=t[t.length-1];if(!o)continue;const u=i.trim();o.value=o.value?`${o.value} ${u}`:u}return t}function oW(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${od(n.key)}</dt><dd>${od(n.value)}</dd>`).join("")}</dl>`}function lW(e,t){return e.replace(QU,(n,i)=>{const r=i.trim();if(!r)return"";if(!t)return od(`[[wiki:${r}]]`);const o=t(r);if(o===null)return od(`[[wiki:${r}]]`);const u=od(r),h=encodeURIComponent(r);return`<a href="${o}" data-entry-id="${h}">${u}</a>`})}function cW(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",r=yW(i||"section"),o=t.get(r)??0;t.set(r,o+1),n.id=o===0?r:`${r}-${o+1}`}}function uW(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||uE(n.textContent??"")===uE(t)&&n.remove()}function dW(e){for(const t of e.querySelectorAll("pre > code")){const n=_W(t.className),i=t.textContent??"",r=t.parentElement;if(!r)continue;if(n==="mermaid"){const u=e.createElement("div");u.className="diagram-block",u.setAttribute("data-mermaid-source",iW(i)),u.setAttribute("data-diagram-state","pending"),r.replaceWith(u);continue}const o=mW(i,n);t.innerHTML=o,t.classList.add("hljs"),r.classList.add("code-block"),r.dataset.code=i,r.insertBefore(hW(e,n||"text"),r.firstChild)}}function hW(e,t){const n=e.createElement("div");n.className="code-block-toolbar";const i=e.createElement("span");i.className="code-block-dots",i.setAttribute("aria-hidden","true");for(let u=0;u<3;u++)i.append(e.createElement("span"));const r=e.createElement("span");r.className="code-block-language",r.textContent=t;const o=e.createElement("button");return o.className="copy-code",o.type="button",o.dataset.action="copy-code",o.setAttribute("aria-label",`Copy ${t} code`),o.textContent="Copy",n.append(i,r,o),n}function fW(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";vW(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function pW(e){return[...e.querySelectorAll("h2, h3")].map(t=>({id:t.id,text:t.textContent?.trim()??t.id,level:t.tagName.toLowerCase()==="h2"?2:3}))}function mW(e,t){return t&&cv.getLanguage(t)?cv.highlight(e,{language:t}).value:cv.highlightAuto(e).value}function gW(){return As.registerLanguage("bash",iE),As.registerLanguage("sh",iE),As.registerLanguage("javascript",rE),As.registerLanguage("js",rE),As.registerLanguage("json",ZU),As.registerLanguage("markdown",aE),As.registerLanguage("md",aE),As.registerLanguage("python",oE),As.registerLanguage("py",oE),As.registerLanguage("typescript",lE),As.registerLanguage("ts",lE),As}function _W(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function vW(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function yW(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function uE(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function od(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const bW=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",SW=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),wW=/^on/i,xW={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},dE="diagramInteractionBound",CW=/^oklch\s*\(\s*([^)]+)\s*\)$/i,kW=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Ms=[25,50,75,100,125,150,200],EW=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let uv=null;const hE=new WeakSet;let TW=0,AW=0,Sd=null;function $a(e){const t=e.trim();if(!t)return t;const n=XW(t);return n?ZW(n):t}function nm(e){if(hE.has(e))return;hE.add(e),fE(e);const t=e instanceof Node?e:document.body;new MutationObserver(i=>{let r=!1;for(const o of i)if(o.type==="childList"){Sd&&!Sd.trigger.isConnected&&Ju(!1);for(const u of o.addedNodes)if(u instanceof Element&&(u.matches?.(".diagram-block[data-mermaid-source]")||u.querySelector?.(".diagram-block[data-mermaid-source]"))){r=!0;break}if(r)break}r&&fE(e)}).observe(t,{childList:!0,subtree:!0})}function fE(e){const t=e.querySelectorAll(bW);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",RW(n))}async function RW(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=sW(t)}catch{dv(e,"Invalid diagram source");return}if(!n.trim()){dv(e,"Empty diagram source");return}try{const i=await LW(),r=`mermaid-diagram-${++TW}`,{svg:o}=await i.render(r,n);e.innerHTML=NW(o),OW(e,o),DW(e),IW(e),e.dataset.diagramState="rendered"}catch(i){const r=i instanceof Error?i.message:String(i);dv(e,r)}}function dv(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function NW(e){const t=(n,i)=>{wW.test(i.attrName)&&(i.keepAttr=!1)};rd.addHook("uponSanitizeAttribute",t);try{return rd.sanitize(e,xW)}finally{rd.removeHook("uponSanitizeAttribute",t)}}async function LW(){return uv||(uv=(async()=>{const e=await PF(()=>import("./mermaid.core-DA-WJY50.js").then(n=>n.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:MW(),themeCSS:jW(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),uv}function MW(){const e=getComputedStyle(document.documentElement),t=(C,x)=>{const I=e.getPropertyValue(C).trim();return $a(I||x)},n=(C,x)=>e.getPropertyValue(C).trim()||x,i=t("--brass","#c69a4a"),r=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),u=t("--aurora","#8bd7e6"),h=t("--aurora-deep","#1f8aa8"),p=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),_=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),S=[r,i,u,p,$a("oklch(70% 0.11 68)"),h,$a("oklch(76% 0.09 205)"),o,$a("oklch(68% 0.14 30)"),g,$a("oklch(62% 0.08 228)"),$a("oklch(52% 0.05 248)")],w=Object.fromEntries(EW.map((C,x)=>[C,S[x]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:_,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:_,secondaryBorderColor:r,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:h,edgeLabelBackground:"transparent",titleColor:r,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:r,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:_,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:_,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:r,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...w}}function jW(){const e=getComputedStyle(document.documentElement),t=(f,g)=>{const _=e.getPropertyValue(f).trim();return $a(_||g)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),r=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),u=$a("oklch(15% 0.04 250 / 34%)"),h=t("--surface-glass","#1d2734"),p=t("--ink-pearl","#e6e9ef");return`
161
+ .node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
162
+ stroke: ${n};
163
+ fill: ${h};
164
+ }
165
+ .edgePath path, .messageLine0, .messageLine1, .relation {
166
+ stroke: ${r};
167
+ }
168
+ .nodeLabel, .edgeLabel, .actor text, .messageText {
169
+ fill: ${p};
170
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
171
+ }
172
+ .pieCircle {
173
+ stroke: ${n};
174
+ stroke-width: 1.35px;
175
+ opacity: 0.96;
176
+ filter: drop-shadow(0 0 1.5px ${u});
177
+ }
178
+ .pieOuterCircle {
179
+ stroke: ${i};
180
+ opacity: 0.7;
181
+ }
182
+ .slice, .legend text, .pieTitleText {
183
+ fill: ${p};
184
+ paint-order: stroke;
185
+ stroke: ${o};
186
+ stroke-width: 3px;
187
+ stroke-linejoin: round;
188
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
189
+ }
190
+ .slice {
191
+ font-weight: 600;
192
+ letter-spacing: 0.04em;
193
+ font-style: italic;
194
+ }
195
+ .pieTitleText {
196
+ font-weight: 600;
197
+ letter-spacing: 0.12em;
198
+ font-style: italic;
199
+ }
200
+ .legend text {
201
+ font-weight: 500;
202
+ letter-spacing: 0.03em;
203
+ }
204
+ .legend rect {
205
+ rx: 999px;
206
+ ry: 999px;
207
+ opacity: 0.9;
208
+ stroke: ${o};
209
+ stroke-width: 1.5px;
210
+ paint-order: stroke;
211
+ filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${i});
212
+ }
213
+ `}function OW(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),r=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,r.length);for(let u=0;u<o;u++){const h=i[u],p=r[u];if(!h||!p)continue;const f=h.getAttribute("href")??h.getAttribute("xlink:href")??"",g=jN(f);g&&p.setAttribute("href",g)}}function DW(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:r,width:o,height:u}=n;!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(u)||i<0||r<0||o<=0||u<=0||t.setAttribute("viewBox",`${Kl(i)} ${Kl(r)} ${Kl(o)} ${Kl(u)}`)}function IW(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),KW(e),e.dataset[dE]!=="true"&&(e.dataset[dE]="true",e.addEventListener("click",BW),e.addEventListener("keydown",PW))}function BW(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Cp(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),MN(t))}function PW(e){if(e.key!=="Enter"&&e.key!==" "||Cp(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),MN(t))}function MN(e){const t=e.querySelector("svg");if(!t)return;Ju(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),r=++AW,o=`diagram-lightbox-title-${r}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const u=document.createElement("div");u.className="diagram-lightbox__frame";const h=document.createElement("div");h.className="diagram-lightbox__header";const p=document.createElement("h2");p.id=o,p.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const _=hf("−","Zoom out","out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const S=hf("+","Zoom in","in"),w=hf("Fit","Fit diagram to viewport","fit"),C=hf("Reset","Reset diagram zoom","reset");g.append(_,b,S,w,C);const x=document.createElement("div");x.className="diagram-lightbox__viewport";const I=HW(t),z=t.cloneNode(!0);z.removeAttribute("style"),UW(z,`diagram-lightbox-svg-${r}`),x.append(z),h.append(p,g,f),u.append(h,x),i.append(u),document.body.append(i);const U=new $W(x,z,b,I);_.addEventListener("click",()=>U.zoomOut()),S.addEventListener("click",()=>U.zoomIn()),w.addEventListener("click",()=>U.fit()),C.addEventListener("click",()=>U.reset());const A=WW(i),O=H=>{(H.target===i||H.target===f)&&Ju(!0)},R=H=>{if(H.key==="Escape"){H.preventDefault(),Ju(!0);return}U.handleKeyboard(H)||H.key==="Tab"&&GW(H,i)},$={dialog:i,trigger:e,inertStates:A,onClick:O,onKeyDown:R,cleanupPanZoom:()=>U.destroy()};n&&($.onCancel=H=>{H.preventDefault(),Ju(!0)},i.addEventListener("cancel",$.onCancel),i.showModal()),i.addEventListener("click",O),document.addEventListener("keydown",R,!0),Sd=$,U.fit(),f.focus()}function hf(e,t,n){const i=document.createElement("button");return i.className="diagram-lightbox__zoom-button",i.type="button",i.dataset.zoomAction=n,i.setAttribute("aria-label",t),i.textContent=e,i}class $W{constructor(t,n,i,r){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=r,this.applyZoom(this.zoomIndex),t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerEnd),t.addEventListener("pointercancel",this.onPointerEnd),t.addEventListener("wheel",this.onWheel,{passive:!1}),t.addEventListener("dblclick",this.onDoubleClick),window.addEventListener("resize",this.onResize)}viewport;svg;readout;baseSize;zoomIndex=Ms.indexOf(100);dragStart=null;pinchStart=null;pointers=new Map;destroy(){this.viewport.removeEventListener("pointerdown",this.onPointerDown),this.viewport.removeEventListener("pointermove",this.onPointerMove),this.viewport.removeEventListener("pointerup",this.onPointerEnd),this.viewport.removeEventListener("pointercancel",this.onPointerEnd),this.viewport.removeEventListener("wheel",this.onWheel),this.viewport.removeEventListener("dblclick",this.onDoubleClick),window.removeEventListener("resize",this.onResize),this.pointers.clear()}zoomIn(){this.zoomAroundViewportCenter(Math.min(this.zoomIndex+1,Ms.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Ms.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,n=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,i=Math.min(t/this.baseSize.width,n/this.baseSize.height),r=Math.floor(i*100),o=Ms.findIndex(h=>h>r),u=o===-1?Ms.length-1:Math.max(0,o-1);this.applyZoom(u),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-n)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(ff(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(ff(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=ff(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Kl(this.baseSize.width*i)),this.svg.setAttribute("height",Kl(this.baseSize.height*i)),this.readout.textContent=`${n}%`}zoomAroundViewportCenter(t){const n=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,n.left+n.width/2,n.top+n.height/2)}zoomAroundPoint(t,n,i){if(t===this.zoomIndex)return;const r=this.svgWidth,o=this.svgHeight,u=this.viewport.getBoundingClientRect(),h=this.viewport.scrollLeft+n-u.left,p=this.viewport.scrollTop+i-u.top;this.applyZoom(t),this.viewport.scrollLeft=h/r*this.svgWidth-(n-u.left),this.viewport.scrollTop=p/o*this.svgHeight-(i-u.top)}onPointerDown=t=>{if(t.button!==0||Cp(t.target))return;const n=t.pointerId??1;if(this.pointers.set(n,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:n},this.viewport.setPointerCapture?.(n)};onPointerMove=t=>{const n=t.pointerId??1;if(this.pointers.has(n)&&this.pointers.set(n,t),this.pinchStart&&this.pointers.size>=2){const i=this.pointerDistance()/this.pinchStart.distance,r=ff(this.pinchStart.zoomIndex)*i;this.applyZoom(FW(r));return}!this.dragStart||this.dragStart.pointerId!==n||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const n=t.pointerId??1;this.pointers.delete(n),this.viewport.releasePointerCapture?.(n),this.dragStart?.pointerId===n&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const n=t.deltaY<0?Math.min(this.zoomIndex+1,Ms.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{Cp(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Ms.indexOf(200)?Ms.indexOf(100):Ms.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,n]=Array.from(this.pointers.values());return!t||!n?1:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)}}function zW(e){const t=pE(e.getAttribute("width")),n=pE(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],r=i[2],o=i[3],u=r!==void 0&&Number.isFinite(r)&&r>0?r:null,h=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??u??800,height:n??h??600}}function HW(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:zW(e)}function pE(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)&&n>0?n:null}function Kl(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function FW(e){let t=0,n=Number.POSITIVE_INFINITY;return Ms.forEach((i,r)=>{const o=Math.abs(i-e);o<n&&(n=o,t=r)}),t}function ff(e){return Ms[e]??Ms[0]}function UW(e,t){const n=e.getAttribute("id")??"";e.setAttribute("id",t);const i=e.querySelector("style");!n||!i?.textContent||(i.textContent=i.textContent.split(`#${n}`).join(`#${t}`))}function Ju(e){const t=Sd;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),qW(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),Sd=null,e&&t.trigger.isConnected&&t.trigger.focus())}function WW(e){const t=[];for(const n of Array.from(document.body.children))!(n instanceof HTMLElement)||n===e||(t.push({element:n,ariaHidden:n.getAttribute("aria-hidden"),inert:n.inert}),n.inert=!0,n.setAttribute("aria-hidden","true"));return t}function qW(e){for(const t of e)t.element.inert=t.inert,t.ariaHidden===null?t.element.removeAttribute("aria-hidden"):t.element.setAttribute("aria-hidden",t.ariaHidden)}function GW(e,t){const n=Array.from(t.querySelectorAll(SW)).filter(YW);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function KW(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Cp(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!VW(t)}function VW(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function YW(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function jN(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let i;try{i=new URL(t)}catch{return null}return i.origin!==window.location.origin?null:jN(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let r;try{r=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(r)?`/entry/${encodeURIComponent(r)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function XW(e){const t=CW.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",u=r.trim().split(/[\s,]+/).filter(Boolean);if(u.length!==3)return null;const[h,p,f]=u;if(!h||!p||!f)return null;const g=hv(h,1),_=hv(p,.4),b=JW(f);if(g===null||_===null||b===null)return null;let S=1;if(i>=0){const w=hv(o,1);if(w===null)return null;S=w}return{L:g,C:_,h:b,alpha:S}}function ZW(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),r=e.L,o=r+.3963377774*n+.2158037573*i,u=r-.1055613458*n-.0638541728*i,h=r-.0894841775*n-1.291485548*i,p=o**3,f=u**3,g=h**3,_=4.0767416621*p-3.3077115913*f+.2309699292*g,b=-1.2684380046*p+2.6097574011*f-.3413193965*g,S=-.0041960863*p-.7034186147*f+1.707614701*g,w=pf(fv(_)),C=pf(fv(b)),x=pf(fv(S));if(e.alpha<1){const I=pf(e.alpha);return`#${xo(w)}${xo(C)}${xo(x)}${xo(I)}`}return`#${xo(w)}${xo(C)}${xo(x)}`}function hv(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function JW(e){const t=kW.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function fv(e){const t=Math.max(0,Math.min(1,e));return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function pf(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function xo(e){return e.toString(16).padStart(2,"0")}const QW=32,ON=v.memo(function({text:t,streaming:n,className:i}){const r=v.useRef(t),o=v.useRef(n?t:""),u=v.useRef(null),[h,p]=v.useState(()=>n?Bs(t).html:"");r.current=t;const f=v.useMemo(()=>n?null:Bs(t).html,[n,t]);return v.useEffect(()=>{if(!n){u.current!==null&&window.clearTimeout(u.current),u.current=null;return}o.current===t||u.current!==null||(u.current=window.setTimeout(()=>{u.current=null;const g=r.current;g!==o.current&&(o.current=g,p(Bs(g).html))},QW))},[n,t]),v.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),c.jsx("div",{className:i,dangerouslySetInnerHTML:{__html:f??h}})}),eq=[{icon:"◈",tone:"aurora",text:"Walk me through how this session unfolded"},{icon:"●",tone:"aurora",text:"What is the agent doing right now?"},{icon:"▲",tone:"coral",text:"Flag anything I should review"},{icon:"≡",tone:"brass",text:"Draft a handoff brief"}],tq=[{icon:"◈",tone:"aurora",label:"Go deeper on the last answer",text:"Go deeper on your previous answer with more evidence citations."},{icon:"▲",tone:"coral",label:"Check for intent drift",text:"Review this session for intent drift against my stated goals."},{icon:"≡",tone:"brass",label:"Turn this into an artifact",text:"Turn your previous answer into a published artifact."},{icon:"●",tone:"aurora",label:"What is the agent doing now?",text:"What is the agent doing right now?"}],nq=[{command:"/now",description:"Current state — what the agent is doing right now",template:"What is the agent doing right now?"},{command:"/drift",description:"Intent drift review against settled goals",template:"Review this session for intent drift against my stated goals."},{command:"/brief",description:"Handoff brief as an artifact",template:"Draft a handoff brief and publish it as an artifact."},{command:"/risks",description:"Flag anything that needs review",template:"Flag anything I should review before this work continues."},{command:"/timeline",description:"How the session unfolded, end to end",template:"Walk me through how this session unfolded."}],$l="session-analyst-artifacts";function iq({context:e}){const{state:t,dispatch:n,send:i,stop:r,reset:o}=sN(e),[u,h]=v.useState(0),[p,f]=v.useState(!1),g=t.catalog?.clis.find(E=>E.cliId===t.cliId),_=g?.models.find(E=>E.id===t.model),b=t.entries.length>0,S=t.artifacts.length,w=e.hiddenCompanionPanelIds,C=e.onSetCompanionPanelVisible,x=w!==void 0&&C!==void 0,I=w?.includes($l)??!1,z=S>0&&!I,U=t.artifactAuthoring!==null&&S===0,A=v.useRef(0),[O,R]=v.useState(0),$=v.useRef(null),H=v.useRef(null),J=v.useRef(null),Z=t.entries.at(-1),K=t.draft.startsWith("/")?nq.filter(E=>E.command.toLowerCase().startsWith(t.draft.toLowerCase())):[],M=!p&&K.length>0,N=`analysis-${e.operationId}-slash-listbox`,D=E=>`analysis-${e.operationId}-slash-${E.slice(1)}`,j=M?K[Math.min(u,K.length-1)]:void 0,T=v.useRef(b).current,B=b&&!T;v.useLayoutEffect(()=>{const E=H.current;!E||!b||(E.scrollTop=E.scrollHeight)},[b,Z?.text,t.entries.length,t.latestActivity,t.phase,t.artifactAuthoring,t.artifactPublished]),v.useLayoutEffect(()=>{const E=J.current;E&&mE(E)},[t.draft]),v.useLayoutEffect(()=>{const E=J.current;if(!E||typeof ResizeObserver>"u")return;const G=new ResizeObserver(()=>mE(E));return G.observe(E),()=>G.disconnect()},[]),v.useEffect(()=>{const E=H.current;E&&nm(E)},[]),v.useEffect(()=>{const E=A.current;if(A.current=S,!(!x||!C)){if(S===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!I){const G=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;C($l,!1),G&&window.requestAnimationFrame(()=>$.current?.focus())}return}if(E===0&&I&&t.artifactsAutoOpenArmed){C($l,!0);return}S>E&&I&&R(G=>G+1)}},[S,I,n,C,t.artifactsAutoOpenArmed,x]);const L=async(E,G)=>{const Y=E.trim();if(Y){if(t.busy){n({type:"queue-push",text:Y}),G&&n({type:"set-draft",draft:""});return}G&&n({type:"set-draft",draft:""}),await i(Y)}},F=E=>{const G=K[E];G&&(n({type:"set-draft",draft:G.template}),f(!0),h(0),window.requestAnimationFrame(()=>J.current?.focus()))},W=v.useCallback(E=>{const G=E.target.closest('[data-action="copy-code"]');if(!G)return;const Y=G.closest("pre")?.getAttribute("data-code");Y&&sq(G,Y)},[]);return c.jsxs("section",{className:`session-analyst__chat-pane ${b?"has-interacted":"is-initial"}`,"aria-label":"Session Analyst chat","data-phase":t.phase,children:[x?c.jsxs("button",{ref:$,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${S===0?" is-waiting":""}${U?" is-authoring":""}`,"aria-label":z?"Hide Artifacts":"Open Artifacts","aria-pressed":z,"aria-disabled":S===0,tabIndex:S===0?-1:void 0,title:U?"The analyst is authoring an artifact…":S===0?"Artifacts the analyst publishes appear here":void 0,onClick:()=>{!C||S===0||(z&&n({type:"artifacts-chip-disarm"}),C($l,!z))},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:z?"«":"»"}),S>0?c.jsx("span",{className:`session-analyst-handle__count${O>0?" is-pulsing":""}`,children:S},O):null,U?c.jsx("span",{className:"session-analyst-handle__count",children:"…"}):null,c.jsx("span",{className:"session-analyst-handle__label",children:"ARTIFACTS"})]}):null,c.jsx(rq,{state:t,onReset:()=>{o().catch(()=>{})}}),c.jsxs("div",{className:"session-analyst__workspace",children:[c.jsxs("section",{ref:H,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[b?c.jsx("ol",{className:"session-analyst__transcript",onClick:W,children:t.entries.map((E,G)=>c.jsx("li",{className:`session-analyst__message session-analyst__message--${E.role}`,children:E.role==="analyst"?c.jsx(ON,{className:"session-analyst__response markdown-body",text:E.text,streaming:t.busy&&G===t.entries.length-1}):E.text},`${E.role}-${G}`))}):c.jsxs("div",{className:"session-analyst__hero-wrap",children:[c.jsxs("header",{className:"session-analyst__hero",children:[c.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),c.jsx("h2",{children:"Ask about this session"}),c.jsx("p",{children:"Review, explain, and summarize this session — without affecting the host agent."})]}),c.jsx("div",{className:"session-analyst__suggestions",children:eq.map(E=>c.jsxs("button",{type:"button",onClick:()=>{L(E.text,!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":E.tone,"aria-hidden":"true",children:E.icon}),E.text]},E.text))})]}),t.artifactAuthoring||t.artifactPublished?c.jsx(aq,{state:t,onOpen:x&&C?()=>C($l,!0):void 0}):null,t.phase!=="idle"?c.jsx(oq,{state:t}):null]}),t.queue.length>0?c.jsx("div",{className:"session-analyst__queue","aria-live":"polite",children:t.queue.map((E,G)=>c.jsxs("div",{className:"session-analyst__queue-item",children:[c.jsx("span",{className:"session-analyst__queue-tag",children:"QUEUED"}),c.jsx("span",{className:"session-analyst__queue-text",children:E}),c.jsx("button",{type:"button","aria-label":`Cancel queued question ${G+1}`,onClick:()=>n({type:"queue-cancel",index:G}),children:"✕"})]},`${E}-${G}`))}):null,t.phase==="complete"&&!t.busy&&b?c.jsxs("div",{className:"session-analyst__followups",children:[c.jsx("span",{className:"session-analyst__followups-label",children:"FOLLOW UP"}),c.jsx("div",{className:"session-analyst__followups-row",children:tq.map(E=>c.jsxs("button",{type:"button",onClick:()=>{L(E.text,!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":E.tone,"aria-hidden":"true",children:E.icon}),E.label]},E.label))})]}):null,c.jsxs("form",{className:`session-analyst__composer ${b?"is-docked":"is-initial"}${B?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:E=>{E.preventDefault(),L(t.draft,!0)},children:[M?c.jsxs("div",{id:N,className:"session-analyst__slash",role:"listbox","aria-label":"Analysis commands",children:[c.jsx("span",{className:"session-analyst__slash-heading",children:"Analysis commands"}),K.map((E,G)=>c.jsxs("button",{type:"button",id:D(E.command),role:"option","aria-selected":G===u,className:G===u?"is-selected":void 0,onMouseDown:Y=>Y.preventDefault(),onClick:()=>F(G),children:[c.jsx("span",{children:E.command}),c.jsx("small",{children:E.description})]},E.command))]}):null,b?null:c.jsxs("div",{className:"session-analyst__selector-strip","aria-label":"Initial analysis settings",children:[c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ri,{compact:!0,label:"Analysis CLI",value:t.cliId,disabled:t.started||!t.catalog,options:t.catalog?.clis.map(E=>({value:E.cliId,label:E.label,disabled:!E.available}))??[],onChange:E=>n({type:"select-cli",cliId:E})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ri,{compact:!0,label:"Analysis model",value:t.model,disabled:t.started||!_,options:g?.models.map(E=>({value:E.id,label:E.label}))??[],onChange:E=>n({type:"select-model",model:E})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(Ri,{compact:!0,label:"Analysis effort",value:t.effort,disabled:t.started||!_||!_.effortLevels.length,options:_?.effortLevels.length?_.effortLevels.map(E=>({value:E,label:E})):[{value:"",label:"n/a"}],onChange:E=>n({type:"select-effort",effort:E})})})]}),c.jsxs("div",{className:"session-analyst__composer-surface",children:[c.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:"Ask about this session"}),c.jsx("textarea",{ref:J,id:`analysis-${e.operationId}`,role:"combobox","aria-expanded":M,"aria-controls":N,"aria-activedescendant":j?D(j.command):void 0,rows:1,placeholder:"Ask about the session… (/ for commands)",value:t.draft,onChange:E=>{n({type:"set-draft",draft:E.target.value}),h(0),f(!1)},onKeyDown:E=>{if(M&&!E.nativeEvent.isComposing){if(E.key==="ArrowDown"){E.preventDefault(),h(G=>(G+1)%K.length);return}if(E.key==="ArrowUp"){E.preventDefault(),h(G=>(G-1+K.length)%K.length);return}if(E.key==="Enter"){E.preventDefault(),F(Math.min(u,K.length-1));return}if(E.key==="Escape"){E.preventDefault(),f(!0);return}}E.key!=="Enter"||E.shiftKey||E.nativeEvent.isComposing||(E.preventDefault(),L(t.draft,!0))}}),t.busy?c.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":"Stop",onClick:()=>{r()},children:c.jsx("span",{"aria-hidden":"true"})}):null,c.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":t.busy?"Queue question":"Send",disabled:!t.draft.trim(),children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:c.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]}),t.busy?c.jsx("div",{className:"session-analyst__composer-hint",children:"Enter queues the question — it fires when the analyst is ready"}):null]})]})]})}function mE(e){e.style.height="auto";const t=window.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||18.75,i=(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0),r=n*6+i,o=Math.max(36,Math.min(e.scrollHeight,r));e.style.height=`${o}px`,e.style.overflowY=e.scrollHeight>r?"auto":"hidden"}function sq(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function rq({state:e,onReset:t}){const n=e.started||e.phase!=="idle"||e.draft.length>0||e.queue.length>0||e.entries.length>0||e.artifacts.length>0;return c.jsxs("header",{className:"session-analyst__panel-head",children:[c.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:"Session Analyst"}),c.jsx("small",{children:"Read-only intelligence for this operation"})]}),c.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":"Reset Session Analyst",onClick:t,disabled:!n,children:"Reset"}),c.jsxs("span",{className:"session-analyst__panel-state",children:[c.jsx("i",{"aria-hidden":"true"}),uq(e)]})]})}function aq({state:e,onOpen:t}){const n=hq(e.artifactAuthoring?.startedAt??null);if(e.artifactAuthoring)return c.jsxs("div",{className:"session-analyst__author-card is-authoring",children:[c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"✳"}),c.jsx("strong",{className:"session-analyst__author-title",children:"Publishing an artifact"}),c.jsx("time",{className:"session-analyst__author-time",children:mb(n)})]}),c.jsx("p",{className:"session-analyst__author-sub",children:"The analyst is authoring artifact content. It opens in Artifacts when it lands."}),c.jsx("div",{className:"session-analyst__author-track","aria-hidden":"true",children:c.jsx("span",{})})]});const i=e.artifactPublished;return i?c.jsx("div",{className:"session-analyst__author-card is-done",children:c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"◆"}),c.jsxs("strong",{className:"session-analyst__author-title",children:["Artifact published — ",i.artifact.title]}),i.durationMs===null?null:c.jsx("time",{className:"session-analyst__author-time",children:mb(i.durationMs)}),t?c.jsx("button",{type:"button",className:"session-analyst__author-open",onClick:t,children:"Open in Artifacts"}):null]})}):null}function oq({state:e}){const t=dq(e),n=mb(t),i=cq(e.latestActivity);if(e.phase==="complete")return null;if(e.phase==="stopped")return c.jsxs("div",{className:"session-analyst__receipt is-stopped",role:"status",children:["Stopped · last confirmed: ",i," · ",n]});const r=e.phase==="error",o=lq(e.latestActivity);return c.jsxs("div",{className:`session-analyst__pulse${r?" is-error":""}`,role:r?"alert":"status","aria-live":r?void 0:"polite",children:[r?null:c.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),c.jsxs("div",{className:"session-analyst__pulse-main",children:[c.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),c.jsxs("span",{className:"session-analyst__pulse-copy",children:[c.jsx("strong",{children:r?e.error:o.label},`${e.phase}-${o.label}`),c.jsx("small",{children:r?`Last confirmed activity: ${i}`:o.note})]}),c.jsx("time",{children:n})]}),c.jsx("span",{className:"session-analyst__truth-mark",children:"Last confirmed activity only"})]})}function lq(e){return!e||e.kind==="starting"?{label:"Starting analyst",note:e?.connected?"Analyst connection confirmed":"Starting a new analysis session"}:e.kind==="reasoning"?{label:"Reasoning over session",note:"Thought event received · content hidden"}:e.kind==="tool"?{label:`Using ${e.title}`,note:`Tool status: ${e.status}`}:{label:"Writing answer",note:"Answer chunk received"}}function cq(e){return!e||e.kind==="starting"?"Starting analyst":e.kind==="reasoning"?"Reasoning over session":e.kind==="tool"?`Using ${e.title} (${e.status})`:"Writing answer"}function uq(e){return e.phase==="error"?"Needs attention":e.busy?"Analyzing":e.phase==="complete"?"Complete":e.phase==="stopped"?"Stopped":"Ready"}function dq(e){const[t,n]=v.useState(()=>Date.now());return v.useEffect(()=>{if(!e.busy)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e.busy,e.runStartedAt]),e.runStartedAt===null?0:Math.max(0,(e.runEndedAt??t)-e.runStartedAt)}function hq(e){const[t,n]=v.useState(()=>Date.now());return v.useEffect(()=>{if(e===null)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e]),e===null?0:Math.max(0,t-e)}function mb(e){return`${Math.floor(e/1e3)}s`}class gr extends Error{constructor(t,n){super(n),this.status=t}status}const fq=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function pq(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await l1(t),IN(await t.json(),t.status)}async function DN(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await l1(t),vq(await t.json(),t.status)}async function mq(e,t,n){return o1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function gq(e,t,n,i){return o1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function _q(e,t,n){return o1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function o1(e,t,n,i){const r=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await l1(r);const o=await r.json();if(!o||typeof o!="object"||!("state"in o))throw new gr(r.status,"Invalid carrier settings mutation response");return{state:IN(o.state,r.status)}}async function l1(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new gr(e.status,t)}function IN(e,t){BN(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new gr(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>yq(i,t))}}function vq(e,t){BN(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new gr(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>bq(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function yq(e,t){const n=e;if(!n||typeof n.carrierId!="string"||typeof n.displayName!="string"||typeof n.sourceDisplayName!="string"||typeof n.role!="string"||typeof n.roleDescription!="string"||typeof n.slot!="number"||typeof n.cliType!="string"||typeof n.defaultCliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string"||typeof n.taskForceCapable!="boolean"||!n.taskforce||!Array.isArray(n.taskforce.backends))throw new gr(t,"Invalid carrier settings carrier response");return{carrierId:n.carrierId,displayName:n.displayName,sourceDisplayName:n.sourceDisplayName,role:n.role,roleDescription:n.roleDescription,...n.category?{category:n.category}:{},slot:n.slot,cliType:n.cliType,defaultCliType:n.defaultCliType,model:n.model,...n.effort?{effort:n.effort}:{},taskForceCapable:n.taskForceCapable,taskforce:{backends:n.taskforce.backends.map(i=>wq(i,t))}}}function bq(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.displayName!="string"||!Array.isArray(n.models)||typeof n.defaultModel!="string")throw new gr(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>Sq(i,t)),defaultModel:n.defaultModel}}function Sq(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new gr(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new gr(t,"Invalid carrier settings effort option");return{modelId:n.modelId,name:n.name,...n.effort?{effort:{levels:n.effort.levels.filter(i=>typeof i=="string"),default:n.effort.default}}:{}}}function wq(e,t){const n=e;if(!n||typeof n.cliType!="string"||typeof n.model!="string"||n.effort!==void 0&&typeof n.effort!="string")throw new gr(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function BN(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[r,o]of Object.entries(i)){if(fq.has(r))throw new gr(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const xq=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class Qs extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function PN(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new Qs(t.status,"Invalid agent state response");return n.agentClis.map(i=>Mq(i,t.status))}async function Cq(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.clis))throw new Qs(t.status,"Invalid Agent CLI state response");return n}async function kq(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Qs(t.status,"Invalid tenants response");return n.tenants.map(i=>jq(i,t.status))}async function Eq(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Qs(t.status,"Invalid jobs response");return n.tenants}async function Tq(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new Qs(t.status,"Invalid agent sessions response");return n.sessions.map(i=>im(i,t.status))}async function Aq(e){const t=await fetch("/api/v1/operations",{signal:e});await na(t);const n=await t.json();if(!Array.isArray(n.operations))throw new Qs(t.status,"Invalid operations response");return{operations:n.operations.map(i=>Oq(i,t.status))}}async function Rq(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await na(i),im(await i.json(),i.status)}async function Nq(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await na(n),im(await n.json(),n.status)}async function Lq(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await na(n)}function im(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||gb(n))throw new Qs(t,"Invalid agent session response");return{sessionId:n.sessionId,terminalSessionId:typeof n.terminalSessionId=="string"?n.terminalSessionId:n.sessionId,cwdLabel:n.cwdLabel,label:typeof n.label=="string"?n.label:void 0,cliId:typeof n.cliId=="string"?n.cliId:void 0,cliLabel:typeof n.cliLabel=="string"?n.cliLabel:void 0,status:n.status,turnState:n.turnState==="running"||n.turnState==="ended"?n.turnState:"none",createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function na(e){if(!e.ok)throw new Qs(e.status,`Agent plugin request failed: ${e.status}`)}function Mq(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new Qs(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function jq(e,t){const n=e;if(!n||typeof n.tenantId!="string"||typeof n.tenantLabel!="string"||typeof n.createdAt!="number"||typeof n.sessions!="number")throw new Qs(t,"Invalid tenant response");return n}function Oq(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.theaterId!="string"||typeof n.type!="string"||typeof n.pluginId!="string"||typeof n.title!="string"||!n.payload||typeof n.payload!="object"||Array.isArray(n.payload)||!n.ts||typeof n.ts.createdAt!="number"||typeof n.ts.updatedAt!="number"||gb(n)||gb(n.payload))throw new Qs(t,"Invalid operation response");return{id:n.id,theaterId:n.theaterId,type:n.type,pluginId:n.pluginId,title:n.title,payload:n.payload,geometry:n.geometry??null,ts:n.ts}}function gb(e){return _b(e,new Set(xq))}function _b(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>_b(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||_b(i,t))}const Dq="active",vb=new Set(["done","error","aborted"]);function Iq(e,t){let n=zN(yb(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=$N(n,i);return vb.has(t.status)&&!vb.has(n.status)&&(n={...n,status:t.status}),n}function $N(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:zq(e.recentEvents,t)};switch(t.type){case"job:registered":return Pq(i,n);case"job:finalized":return{...i,status:Ln(n.status)??"done",finishedAt:Ba(n.finishedAt)??t.at,summary:Ln(n.summary),error:Ln(n.error)};case"track:begin":return jl(zN(i,n.request),n,t.id,r=>({...r,startedAt:Ba(n.startedAt)??t.at,requestPreview:Ln(n.requestPreview)}));case"track:status":return jl(i,n,t.id,r=>({...r,status:Ln(n.status)??r.status}));case"track:text":return jl(i,n,t.id,r=>{const o=r.text+(Ln(n.text)??"");return{...r,status:"stream",text:o,sentTextLength:r.sentTextLength+(Ba(n.textLength)??Ln(n.text)?.length??0),latestLine:Hq(o)||r.latestLine}});case"track:thought":return jl(i,n,t.id,r=>{const o=r.thought+(Ln(n.text)??"");return{...r,thought:o,sentThoughtLength:r.sentThoughtLength+(Ba(n.textLength)??Ln(n.text)?.length??0)}});case"track:tool":return jl(i,n,t.id,r=>({...r,status:"stream",tools:$q(r.tools,n)}));case"track:finalized":return jl(i,n,t.id,r=>{const o=gE(r.text,r.sentTextLength,Ln(n.fallbackText),Ba(n.fallbackTextLength)),u=gE(r.thought,r.sentThoughtLength,Ln(n.fallbackThought),Ba(n.fallbackThoughtLength));return{...r,status:Ln(n.status)??"done",finishedAt:Ba(n.finishedAt)??t.at,error:Ln(n.error),text:o.text,sentTextLength:o.sentLength,thought:u.text,sentThoughtLength:u.sentLength}});default:return i}}function zN(e,t){if(e.request)return e;const n=Bq(t);return n?{...e,request:n}:e}function Bq(e){if(typeof e!="object"||e===null)return;const t=e;if(!Array.isArray(t.blocks)||typeof t.additional!="string")return;const n=[];for(const i of t.blocks){if(typeof i!="object"||i===null)return;const r=i;if(typeof r.tag!="string"||typeof r.hint!="string"||typeof r.required!="boolean"||typeof r.present!="boolean"||typeof r.body!="string")return;n.push({tag:r.tag,hint:r.hint,required:r.required,present:r.present,body:r.body})}return{blocks:n,additional:t.additional}}function yb(e,t,n){return{jobId:t,tenantId:e,status:Dq,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function dc(e){return vb.has(e)}function Pq(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,r=e.tracks;for(const o of n){if(!o.trackId)continue;const u=r[o.trackId],h={...u??HN(o.trackId),displayName:o.displayName??u?.displayName??o.trackId,displayCli:o.displayCli??u?.displayCli,model:o.model??u?.model,effort:o.effort??u?.effort,subtitle:o.subtitle??u?.subtitle,kind:o.kind??u?.kind,startedAt:o.startedAt??u?.startedAt};u||(i=[...i,o.trackId]),r={...r,[o.trackId]:h}}return{...e,label:Ln(t.label)??e.label,ownerCarrierId:Ln(t.ownerCarrierId)??e.ownerCarrierId,kind:Ln(t.kind)??e.kind,signatureCli:Ln(t.signatureCli)??e.signatureCli,startedAt:Ba(t.startedAt)??e.startedAt,trackOrder:i,tracks:r}}function jl(e,t,n,i){const r=Ln(t.trackId);if(!r)return e;const o=e.tracks[r],u={...i(o??HN(r)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,r],tracks:{...e.tracks,[r]:u}}}function HN(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function $q(e,t){const n=Ln(t.toolId)??Ln(t.id);if(!n)return e;const i={id:n,name:Ln(t.name),input:t.input,output:t.output,status:Ln(t.status)},r=e.findIndex(o=>o.id===n);return r>=0?[...e.slice(0,r),{...e[r],...i},...e.slice(r+1)]:[...e,i]}function gE(e,t,n,i){return n?t>=(i??n.length)?{text:e,sentLength:t}:{text:n,sentLength:i??n.length}:{text:e,sentLength:t}}function zq(e,t){return[...e,t].slice(-120)}function Hq(e){const t=e.trim();if(!t)return"";const n=t.split(`
214
+ `);return n[n.length-1]?.trim()??""}function Ln(e){return typeof e=="string"?e:void 0}function Ba(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const Fq=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function Uq(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
215
+
216
+ `);for(;i>=0;){const r=e.slice(0,i);e=e.slice(i+2);const o=qq(r);o&&n.push(o),i=e.indexOf(`
217
+
218
+ `)}return n}}function Wq(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const i=t.tenant?.tenantId;return!i||!t.truncation?null:{kind:"truncation",tenantId:i,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const i=vE(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=vE(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:Gq(t.reason)}:null}const n=_E(t.event)??_E(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function qq(e){const t=e.split(`
219
+ `),n=t.find(r=>r.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(r=>r.startsWith("data:")).map(r=>r.slice(5).trim()).join(`
220
+ `);return!i&&n==="message"?null:{event:n,data:i}}function _E(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.id!="number"||typeof t.tenantId!="string"||typeof t.type!="string"||typeof t.at!="number"?null:{...t,event:typeof t.event=="object"&&t.event!==null?t.event:{}}}function vE(e){try{return im(e,200)}catch{return null}}function Gq(e){return typeof e=="string"&&Fq.has(e)?e:void 0}const c1={droppedCount:0},bb=new Set;let yn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function Kq(){return j5(Vq,FN)}function FN(){return yn}function Vq(e){return bb.add(e),()=>{bb.delete(e)}}function ps(e){yn={...yn,...e},eG()}function UN(e){ps({agentClis:e})}function Yq(e){const t={};for(const n of e)t[n.sessionId]=n;ps({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function kp(e){const t=!!yn.sessions[e.sessionId];ps({sessions:{...yn.sessions,[e.sessionId]:e},sessionOrder:t?yn.sessionOrder:[e.sessionId,...yn.sessionOrder],turnState:{...yn.turnState,[e.sessionId]:e.turnState}})}function WN(e){const{[e]:t,...n}=yn.sessions,{[e]:i,...r}=yn.turnState;ps({sessions:n,sessionOrder:yn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:yn.activeTerminalSessionId===e?null:yn.activeTerminalSessionId,turnState:r})}function qN(e){ps({activeTerminalSessionId:e})}function Xq(e){ps({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...yn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&yn.tenantJobs[t])]})}function Zq(e){const t={};for(const n of e){const i={};for(const r of n.jobs)i[r.jobId]=Iq(n.tenantId,r);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(r=>r.jobId),jobs:i,truncation:n.truncation??c1}}ps({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...yn.tenantOrder.filter(n=>t[n])]})}function Jq(e,t){const n=e.tenantId,i=e.jobId??tG(e),r=yn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:c1},o=i?r.jobs[i]??yb(n,i,e.at):yb(n,"__unknown__",e.at),u=$N(o,e),h=i&&r.jobOrder.includes(i)?r.jobOrder:i?[i,...r.jobOrder]:r.jobOrder,p={...r,tenantLabel:t??r.tenantLabel,jobOrder:h,jobs:i?{...r.jobs,[i]:u}:r.jobs};return ps({tenantJobs:{...yn.tenantJobs,[n]:p},tenantOrder:yn.tenantOrder.includes(n)?yn.tenantOrder:[n,...yn.tenantOrder]}),{job:u,unknownTenant:!yn.tenantJobs[n]}}function Qq(e,t,n){const i=yn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:c1};ps({tenantJobs:{...yn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function GN(e){const t=e.tenantId;if(!t)return[];const n=yn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function eG(){for(const e of bb)e()}function tG(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const yE=250,nG=5e3,Sb=new Map;function iG(e){const t=new AbortController;return sG(t.signal,e),()=>t.abort()}async function sG(e,t){let n=yE;for(;!e.aborted;){ps({connection:"connecting"});try{await lG(e,t);const i=await fetch("/plugins/terminal/agent/events",{signal:e});if(!i.ok||!i.body)throw new Error(`Agent stream failed: ${i.status}`);ps({connection:"live",connectionError:null}),n=yE,await rG(i.body.getReader(),e,t),e.aborted||ps({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;ps({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await uG(n,e),n=Math.min(n*2,nG)}}async function rG(e,t,n){const i=new TextDecoder,r=Uq();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const u of r(i.decode(o.value,{stream:!0}))){const h=Wq(u);if(h){if(h.kind==="truncation"&&h.truncation){Qq(h.tenantId,h.tenantLabel,h.truncation);continue}if(h.kind==="session"&&h.session){kp(h.session),Ep(n,h.session.sessionId,u1(h.session));continue}if(h.kind==="attention"&&h.session){kp(h.session),h.reason!=="idle_prompt"&&Ep(n,h.session.sessionId,"awaiting");continue}h.event&&(Jq(h.event,h.tenantLabel),oG(n,h.event.tenantId))}}}}function u1(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&aG(e)?"running":"idle"}function aG(e){return GN(e).some(t=>!dc(t.status))}function Ep(e,t,n){const i=Sb.get(t);e.status.set(t,n),Sb.set(t,n),i!==n&&(n==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):n==="idle"&&(i==="running"||i==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function oG(e,t){const{sessions:n}=FN();for(const i of Object.values(n))i.tenantId===t&&Sb.get(i.sessionId)!=="awaiting"&&Ep(e,i.sessionId,u1(i))}async function lG(e,t){const[n,i,r,o,u]=await Promise.all([PN(e),Tq(e),kq(e),Eq(e),Aq(e)]);UN(n),Yq(i),Xq(r),Zq(o);for(const h of i)Ep(t,h.sessionId,u1(h));cG(u.operations,t)}function cG(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function uG(e,t){await new Promise(n=>{const i=()=>{clearTimeout(r),t.removeEventListener("abort",i),n()},r=setTimeout(i,e);t.addEventListener("abort",i)})}const dG=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function hG(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),i=t%60;return`${n}m ${i}s`}function fG(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function pG(e){return e.trackOrder.reduce((t,n)=>{const i=e.tracks[n];return i?t+Math.round((i.sentTextLength+i.sentThoughtLength)/4):t},0)}function KN(e){if(e)return dG.has(e)?e:void 0}function mG(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function jd(e){return e==="err"||e==="error"}function hc(e,t){return!dc(e)&&mG(t)}function VN(e,t){if(jd(e.status))return{label:"Error",tone:"error"};if(e.status==="aborted")return{label:"Aborted",tone:"error"};if(e.status==="done")return{label:"Done",tone:"done"};if(t==="error")return{label:"Error",tone:"error"};if(t==="aborted")return{label:"Aborted",tone:"error"};if(t==="done")return{label:"Done",tone:"done"};const n=e.tools.at(-1);return n&&YN(n.status)==="live"?{label:`Using ${n.name??"tool"}`,tone:"live"}:e.text.length>0?{label:"Writing",tone:"live"}:e.thought.length>0?{label:"Reasoning",tone:"live"}:{label:"Working",tone:"live"}}function YN(e){return e==="done"||e==="completed"?"done":e==="error"||e==="failed"?"error":"live"}function gG(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e;for(const n of["file_path","path","file","command","query","url","pattern"]){const i=t[n];if(typeof i=="string")return i.slice(0,60)}return null}function d1(e,t){return jd(e)?"error":e==="done"||e==="aborted"?e:dc(t)?t:e}function _G(e,t){const n=new Set(e),i=t.filter(r=>n.has(r)?!1:(n.add(r),!0));return i.length===0?e:[...e,...i]}function vG(e,t,n){const i=new Map(e.map(o=>[o.jobId,o]));let r=!1;for(const o of t)i.get(o)?.expiresAt!==n&&(i.set(o,{jobId:o,expiresAt:n}),r=!0);return r?[...i.values()]:e}function yG(e,t,n){const i=new Set(t.map(o=>o.jobId)),r=e.filter(o=>o.expiresAt>n&&i.has(o.jobId));return r.length===e.length?e:r}function XN(e,t){const n=new Map(e.map(i=>[i.jobId,i]));return t.flatMap(i=>{const r=n.get(i);return r?[r]:[]})}function bG(e){const t=e.flatMap(r=>r.trackOrder.map(o=>({job:r,track:r.tracks[o]}))).filter(r=>!!r.track).sort((r,o)=>o.track.lastEventId-r.track.lastEventId),n=t.filter(({job:r,track:o})=>hc(r.status,o.status)),i=n.length>0?n:t;for(const{job:r,track:o}of i){if(o.latestLine)return{text:o.latestLine,thinking:!1};if(hc(r.status,o.status)&&o.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function SG(e,t,n){const i=new Set(e.map(o=>o.jobId)),r=XN(t,n.map(o=>o.jobId)).filter(o=>!i.has(o.jobId));return r.length===0?e:[...e,...r]}class sm extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function wG(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await h1(t),JN(await t.json(),t.status)}async function xG(e,t,n){const i=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t}),signal:n});return await h1(i),ZN(await i.json(),i.status)}async function CG(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await h1(n),ZN(await n.json(),n.status)}async function h1(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new sm(e.status,t)}function ZN(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new sm(t,"Invalid model auth mutation response");return{state:JN(n.state,t)}}function JN(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new sm(t,"Invalid model auth state response");return{providers:n.providers.map(i=>kG(i,t))}}function kG(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new sm(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const wb=new Set;let xb={loading:!1,state:null,busyCli:null,error:null},Yr=0;function EG(){return v.useSyncExternalStore(TG,bE,bE)}function bE(){return xb}function TG(e){return wb.add(e),()=>wb.delete(e)}async function AG(e){const t=++Yr;Xr({loading:!0,error:null});try{const n=await wG(e);if(t!==Yr)return;Xr({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Yr)return;Xr({loading:!1,error:f1(n)})}}async function RG(e,t){const n=++Yr;Xr({busyCli:e,error:null});try{const i=await xG(e,t);return n!==Yr||(Xr({state:i.state,busyCli:null,error:null}),await QN()),!0}catch(i){return n!==Yr||Xr({busyCli:null,error:f1(i)}),!1}}async function NG(e){const t=++Yr;Xr({busyCli:e,error:null});try{const n=await CG(e);return t!==Yr||(Xr({state:n.state,busyCli:null,error:null}),await QN()),!0}catch(n){return t!==Yr||Xr({busyCli:null,error:f1(n)}),!1}}async function QN(){try{UN(await PN())}catch{}}function Xr(e){xb={...xb,...e};for(const t of wb)t()}function f1(e){return e instanceof Error?e.message:String(e)}class eL extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function LG(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await tL(t),nL(await t.json(),t.status)}async function MG(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await tL(n),nL(await n.json(),n.status)}async function tL(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new eL(e.status,t)}function nL(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||n.codexLaunchMode!=="acp"&&n.codexLaunchMode!=="app-server")throw new eL(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,codexLaunchMode:n.codexLaunchMode,kimiModel:jG(n.kimiModel)}}function jG(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return typeof t.model!="string"||t.model.length===0?null:{model:t.model,...typeof t.effort=="string"?{effort:t.effort}:{}}}const Cb=new Set;let Tp={loading:!1,state:null,savingField:null,error:null},Ff=0;function p1(){return v.useSyncExternalStore(OG,SE,SE)}function SE(){return Tp}function OG(e){return Cb.add(e),()=>{Cb.delete(e)}}async function m1(e){const t=++Ff;ec({loading:!0,error:null});try{const n=await LG(e);if(t!==Ff)return;ec({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==Ff)return;ec({loading:!1,error:iL(n)})}}async function g1(e,t){const n=Tp.state;if(!n||e==="kimiModel"&&t===null)return!1;Ff+=1;const i={...n,[e]:t},r=e==="enableMetaphor"?{enableMetaphor:i.enableMetaphor}:e==="codexLaunchMode"?{codexLaunchMode:i.codexLaunchMode}:{kimiModel:i.kimiModel};ec({state:i,savingField:e,error:null});try{const o=await MG(r);return ec({state:o,savingField:null,error:null}),!0}catch(o){return ec({state:n,savingField:null,error:iL(o)}),!1}}function ec(e){Tp={...Tp,...e};for(const t of Cb)t()}function iL(e){return e instanceof Error?e.message:String(e)}function DG({job:e}){const t=e.request;return c.jsxs("section",{className:"request-details","aria-label":`Request for ${e.label??e.jobId}`,children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),t?c.jsxs("div",{className:"request-details-blocks",children:[t.blocks.map((n,i)=>c.jsx(IG,{block:n},`${n.tag}-${i}`)),t.additional.trim().length>0?c.jsxs("section",{className:"request-details-block request-details-additional","aria-label":"Additional request",children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:"Additional"}),c.jsx("span",{className:"request-details-presence",children:"residual"})]}),c.jsx("pre",{children:t.additional})]}):null]}):c.jsx("p",{className:"request-details-unavailable",children:"Request unavailable for this legacy job."})]})}function IG({block:e}){const t=e.present?e.body.length===0?"present · empty":"present":e.required?"missing · required":"missing · optional";return c.jsxs("section",{className:"request-details-block","aria-label":`${e.tag} ${t}`,children:[c.jsxs("header",{className:"request-details-block-head",children:[c.jsx("span",{className:"request-details-tag",children:e.tag}),c.jsx("span",{className:"request-details-hint",children:e.hint}),c.jsx("span",{className:"request-details-required",children:e.required?"required":"optional"}),c.jsx("span",{className:`request-details-presence ${e.present?"is-present":"is-missing"}`,children:t})]}),e.present?c.jsx("pre",{children:e.body}):null]})}const BG=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],PG="/plugins/terminal/agent/ticket",$G="/plugins/terminal/ws",pv="fleet-plugin.terminal.stream-dock-expanded",zG="fleet-plugin.terminal.stream-dock-collapsed",HG=56,FG=4e3,UG={...CH,step:1,defaultValue:14},WG="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",qG=5e3,sL={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Qu(e.payload,"cliLabel")??void 0,render:e=>c.jsx(ZG,{context:e}),canOpenCompanions:({api:e,operation:t})=>nN(e,t.id),companions:[{id:"session-analyst-chat",title:"Session Analyst",hideCaption:!0,render:e=>c.jsx(iq,{context:e})},{id:$l,title:"Artifacts",hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(OF,{context:e})}]},rL={id:"general",title:"General",render:()=>c.jsx(eK,{})},aL={id:"agent-cli",title:"Agent CLI",render:()=>c.jsx(tK,{})},oL={id:"agent.attention",title:"Agent input waiting"},GG={id:"agent.ended",title:"Agent turn ended"},mf={id:"terminal",operationKinds:[sL],settingsSections:[rL,aL],notificationKinds:[oL,GG],install:e=>KG(e),closeOperation:async e=>{try{await Lq(e)}finally{RF(e),WN(e)}},launch:async({theaterId:e,kind:t})=>{const n=await Rq(e,t.id);return kp(n),qN(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?c.jsx(bK,{}):e.id==="claude"?c.jsx(vK,{}):e.id==="codex"?c.jsx(yK,{}):c.jsx(_K,{})};function KG(e){return iG({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function lL(e,t){const n=v.useRef(null),i=v.useRef(null),r=v.useRef(!0),[o,u]=v.useState(!0),h=v.useCallback(f=>{r.current!==f&&(r.current=f,u(f))},[]);v.useEffect(()=>{const f=n.current;if(!f)return;const g=()=>{const _=f.scrollHeight-f.scrollTop-f.clientHeight;h(_<=HG)};return f.addEventListener("scroll",g,{passive:!0}),()=>f.removeEventListener("scroll",g)},[e,h]),v.useLayoutEffect(()=>{h(!0);const f=n.current;f&&(f.scrollTop=f.scrollHeight)},[e,h]),v.useLayoutEffect(()=>{const f=n.current;!f||!r.current||(f.scrollTop=f.scrollHeight)},[t]),v.useEffect(()=>{if(typeof ResizeObserver>"u")return;const f=n.current,g=i.current;if(!f||!g)return;const _=new ResizeObserver(()=>{r.current&&(f.scrollTop=f.scrollHeight)});return _.observe(g),()=>_.disconnect()},[e]);const p=v.useCallback(()=>{const f=n.current;f&&(f.scrollTop=f.scrollHeight,f.focus({preventScroll:!0}),h(!0))},[h]);return{containerRef:n,contentRef:i,pinned:o,jumpToLatest:p}}function VG(e){return Array.from(e.querySelectorAll("button, summary, [href], input, select, textarea, [tabindex]")).filter(t=>{if(t.tabIndex<0||t.hidden||t.closest("[hidden]")||t.matches(":disabled"))return!1;const n=window.getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"&&t.getClientRects().length>0})}function YG(){const[e,t]=v.useState(()=>{try{return localStorage.removeItem(zG),localStorage.getItem(pv)==="true"}catch{return!1}}),n=v.useCallback(i=>{try{i?localStorage.setItem(pv,"true"):localStorage.removeItem(pv)}catch{}t(i)},[]);return[e,n]}function cL(e,t){const[n,i]=v.useState(Date.now);return v.useEffect(()=>{if(e===void 0||t!==void 0)return;const r=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(r)},[e,t]),e===void 0?"":hG((t??n)-e)}function XG(e){const t=e.companionsOpen??!1,[n,i]=v.useState(!1);return v.useEffect(()=>{if(t||n)return;let r=!1,o=!1;const u=async()=>{if(o)return;o=!0;const p=await nN(e.api,e.operationId);o=!1,!r&&p&&i(!0)};u();const h=window.setInterval(()=>{u()},qG);return()=>{r=!0,window.clearInterval(h)}},[t,e.api,e.operationId,n]),t||n}function wE({context:e,ready:t}){const n=e.companionsOpen??!1;return c.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}`,"aria-label":n?"Exit Session Analyst":"Open Session Analyst","aria-pressed":n,"aria-disabled":!t,disabled:!t,title:t?void 0:"Send a message in this session first",onClick:()=>{t&&e.onRequestCompanions?.(!e.companionsOpen)},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),c.jsx("span",{className:"session-analyst-handle__label",children:n?"EXIT":"ANALYZE"})]})}function ZG({context:e}){const n=Kq().sessions[e.operationId]??uK(e),[i,r]=v.useState(!1),[o,u]=v.useState("request"),[h,p]=v.useState([]),[f,g]=v.useState([]),_=v.useId(),b=v.useRef(null),S=v.useRef(null),w=v.useRef(null),C=v.useRef(new Set),x=v.useRef(!0),I=XG(e);v.useEffect(()=>{const N=e.companionsOpen??!1,D=x.current;x.current=N,D&&!N&&NF(e.operationId)},[e.companionsOpen,e.operationId]);const z=GN(n),U=z.filter(N=>!dc(N.status)),A=SG(U,z,f),O=XN(z,h),R=`${i}:${o}`,$=O.map(N=>`${N.jobId}:${N.lastEventId}`).join(","),H=lL(R,$);v.useLayoutEffect(()=>{const N=C.current,D=z.filter(j=>N.has(j.jobId)&&dc(j.status)).map(j=>j.jobId);C.current=new Set(U.map(j=>j.jobId)),D.length!==0&&g(j=>vG(j,D,Date.now()+FG))},[U,z]),v.useEffect(()=>{if(f.length===0)return;const N=Math.min(...f.map(j=>j.expiresAt)),D=window.setTimeout(()=>{g(j=>yG(j,z,Date.now()))},Math.max(0,N-Date.now()));return()=>window.clearTimeout(D)},[z,f]),v.useEffect(()=>{i&&p(N=>_G(N,U.map(D=>D.jobId)))},[U,i]);const J=v.useCallback(()=>{r(!1),p([]),w.current?.focus()},[]),Z=v.useCallback(()=>{p(A.map(N=>N.jobId)),u("request"),r(!0)},[A]),K=v.useCallback(N=>{u(N)},[]),M=v.useCallback(N=>{const D=["request","activity"],j=D.indexOf(o);let T;if(N.key==="ArrowLeft"&&(T=(j+D.length-1)%D.length),N.key==="ArrowRight"&&(T=(j+1)%D.length),N.key==="Home"&&(T=0),N.key==="End"&&(T=D.length-1),T===void 0)return;N.preventDefault();const B=D[T];u(B),document.getElementById(`${_}-${B}`)?.focus()},[o,_]);return v.useLayoutEffect(()=>{if(!i)return;const N=window.requestAnimationFrame(()=>b.current?.focus());return()=>window.cancelAnimationFrame(N)},[i]),v.useEffect(()=>{if(!i)return;const N=D=>{if(D.key==="Escape"){D.stopPropagation(),J();return}if(D.key==="Tab"){const j=S.current;if(!j)return;const T=VG(j),B=T[0],L=T[T.length-1];D.shiftKey&&document.activeElement===B?(D.preventDefault(),L?.focus()):!D.shiftKey&&document.activeElement===L&&(D.preventDefault(),B?.focus())}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[i,J]),n.status==="dormant"?c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(wE,{context:e,ready:I}),c.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{cK(n.sessionId)},children:[c.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),c.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]})]}):c.jsxs("div",{className:"agent-stream-host",children:[c.jsx(wE,{context:e,ready:I}),c.jsx(X0,{operationId:n.sessionId,ticketPath:PG,wsPath:$G,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>WN(n.sessionId)}),A.length>0?c.jsx(JG,{activeJobs:A,onOpenDetail:Z,detailBtnRef:w}):null,i?c.jsxs("div",{ref:S,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[c.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:J}),c.jsxs("div",{className:"job-overlay-card",children:[c.jsx("button",{ref:b,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:J,children:"×"}),c.jsxs("div",{className:"job-overlay-tabs",role:"tablist","aria-label":"Carrier stream details",children:[c.jsx("button",{id:`${_}-request`,type:"button",role:"tab","aria-selected":o==="request","aria-controls":`${_}-request-panel`,tabIndex:o==="request"?0:-1,onClick:()=>K("request"),onKeyDown:M,children:"Request"}),c.jsx("button",{id:`${_}-activity`,type:"button",role:"tab","aria-selected":o==="activity","aria-controls":`${_}-activity-panel`,tabIndex:o==="activity"?0:-1,onClick:()=>K("activity"),onKeyDown:M,children:"Activity"})]}),c.jsx("div",{id:`${_}-request-panel`,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-request`,hidden:o!=="request",tabIndex:o==="request"?0:-1,children:O.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):O.map(N=>c.jsx(DG,{job:N},N.jobId))}),c.jsx("div",{id:`${_}-activity-panel`,ref:o==="activity"?H.containerRef:void 0,className:"job-overlay-body job-overlay-panel",role:"tabpanel","aria-labelledby":`${_}-activity`,hidden:o!=="activity",tabIndex:o==="activity"?0:-1,children:c.jsx("div",{className:"job-overlay-panel-content",ref:H.contentRef,children:O.length===0?c.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):O.map(N=>c.jsx(oK,{job:N},N.jobId))})}),o==="activity"&&!H.pinned?c.jsx("button",{type:"button",className:"follow-button",onClick:H.jumpToLatest,children:"↓ Follow"}):null]})]}):null]})}function JG({activeJobs:e,onOpenDetail:t,detailBtnRef:n}){const[i,r]=YG(),o=e[0],u=cL(o?.startedAt,o?.finishedAt),h=e.reduce((M,N)=>M+pG(N),0),p=fG(h),f=e.length===1&&o?o.label:void 0,g=e.length>1?`${e.length} carriers`:o?.ownerCarrierId??"Carrier",_=bG(e),b=e.map(M=>`${M.jobId}:${M.lastEventId}`).join(","),S=`${i}:${e.map(M=>M.jobId).join(",")}`,{containerRef:w,pinned:C,jumpToLatest:x}=lL(S,b),I=e.some(M=>M.trackOrder.some(N=>{const D=M.tracks[N];return D?hc(M.status,D.status):!1})),z=e.some(M=>!dc(M.status)),U=e.some(M=>M.status==="error"||M.trackOrder.some(N=>jd(M.tracks[N]?.status??""))),A=z?"job-dock-dot":U?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle",O=U?"is-error":z?"is-live":"is-complete",R=[...new Set(e.map(M=>KN(M.ownerCarrierId)).filter(M=>!!M))],$=R.slice(0,4),H=Math.max(0,R.length-$.length),J=e.flatMap(M=>M.trackOrder.flatMap(N=>{const D=M.tracks[N];return D?[{job:M,track:D}]:[]})),Z=J.slice(0,6),K=Math.max(0,J.length-Z.length);return c.jsxs("div",{className:"job-dock",children:[c.jsxs("div",{className:`job-dock-strip ${O}`,children:[c.jsx("span",{className:A,"aria-hidden":"true"}),c.jsxs("span",{className:"job-dock-carrier",title:f,children:[$.length>0?c.jsx("span",{className:"job-dock-captain-stack","aria-hidden":"true",children:$.map(M=>c.jsx("span",{className:"job-dock-captain-dot","data-captain":M},M))}):null,c.jsx("span",{className:"job-dock-captain-tag",children:g}),H>0?c.jsxs("span",{className:"job-dock-captain-tag",children:["+",H]}):null]}),c.jsxs("span",{className:"job-dock-seg","aria-hidden":"true",children:[Z.map(({job:M,track:N})=>c.jsx("i",{"data-tone":hK(N,M.status)},`${M.jobId}:${N.trackId}`)),K>0?c.jsxs("span",{children:["+",K]}):null]}),c.jsxs("span",{className:"job-dock-strip-line",style:i?{display:"none"}:void 0,"aria-hidden":"true",children:[_.thinking?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):_.text,!i&&I&&_.text?c.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),c.jsxs("span",{className:"job-dock-meta",children:[u?c.jsx("span",{children:u}):null,p?c.jsx("span",{children:p}):null]}),c.jsx("button",{type:"button",className:"job-dock-grip","aria-label":i?"Collapse stream dock":"Expand stream dock","aria-expanded":i,onClick:()=>r(!i),children:i?"▼":"▲"}),c.jsx("button",{ref:n,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),c.jsxs("div",{className:`job-dock-body-wrap${i?"":" is-collapsed"}`,children:[c.jsx("div",{ref:w,className:"job-dock-body",tabIndex:-1,children:e.map(M=>M.trackOrder.map(N=>{const D=M.tracks[N];return D?c.jsx(QG,{track:D,job:M},`${M.jobId}:${N}`):null}))}),C?null:c.jsx("button",{type:"button",className:"follow-button",onClick:x,children:"↓ Follow"})]})]})}function QG({track:e,job:t}){const n=hc(t.status,e.status),r=dK(e.text),o=!r&&n&&!!e.thought,u=KN(t.ownerCarrierId),h=VN(e,t.status),p=cL(e.startedAt??t.startedAt,e.finishedAt??t.finishedAt);return c.jsxs("div",{className:"job-dock-card","data-captain":u,"data-tone":h.tone,children:[c.jsxs("span",{className:"job-dock-card-who",children:[u?c.jsx("span",{className:"job-dock-captain-dot","data-captain":u,"aria-hidden":"true"}):null,c.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}),c.jsxs("span",{className:"job-dock-card-copy",children:[c.jsx("span",{className:"job-dock-card-phase",children:h.label}),r?c.jsx("span",{className:"job-dock-card-line",children:r}):null,o?c.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]}),c.jsx("span",{className:"job-dock-card-meta",children:p}),c.jsx("span",{className:"job-dock-card-bar","aria-hidden":"true",children:c.jsx("i",{})})]})}function eK(){const{renderer:e,font:t}=QR();return c.jsxs(c.Fragment,{children:[c.jsx(sK,{}),c.jsx(fK,{terminalFont:t}),c.jsx(pK,{terminalRenderer:e})]})}function tK(){const[e,t]=v.useState([]),[n,i]=v.useState(null),r=p1();return v.useEffect(()=>{const o=new AbortController;return Cq(o.signal).then(u=>t(u.clis)).catch(u=>{o.signal.aborted||i(u instanceof Error?u.message:String(u))}),()=>o.abort()},[]),v.useEffect(()=>{const o=new AbortController;return m1(o.signal),()=>o.abort()},[]),c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[c.jsx("div",{className:"agent-cli-head",children:c.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),c.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),n?c.jsx("p",{className:"settings-error",children:n}):null,c.jsx("div",{className:"agent-cli-list",children:e.map(o=>c.jsx(aK,{cli:o,codexLaunchMode:r.state?.codexLaunchMode,disabled:r.savingField!==null,onCodexLaunchModeChange:u=>{g1("codexLaunchMode",u)}},o.id))}),r.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:r.error}):null,c.jsx("p",{className:"global-settings-help",children:"Codex launch mode controls the unified-agent carrier protocol for new Codex sessions; it does not affect the interactive Codex TUI in terminal panels."}),c.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),c.jsx(nK,{})]})}function nK(){const e=EG(),t=p1(),[n,i]=v.useState(null);v.useEffect(()=>{const g=new AbortController;return AG(g.signal),()=>g.abort()},[]),v.useEffect(()=>{const g=new AbortController;return DN(g.signal).then(_=>i(_.cliTypes.find(b=>b.id==="claude-kimi")??null)).catch(()=>{}),()=>g.abort()},[]),v.useEffect(()=>{const g=new AbortController;return m1(g.signal),()=>g.abort()},[]);const r=t.state?.kimiModel??null,o=r?.model??n?.defaultModel,u=n?.models.find(g=>g.modelId===o),h=r?.effort??u?.effort?.default,p=t.savingField!==null,f=(g,_)=>{g1("kimiModel",_?{model:g,effort:_}:{model:g})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Model sign-in",children:[c.jsxs("div",{className:"model-auth-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Settings for Kimi"}),c.jsx("p",{className:"global-settings-help",children:"Register a Kimi API key to run carriers and terminal sessions through Claude Code against the Kimi endpoint. The key is validated and stored locally, and is never returned to the browser."})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading sign-in state."}):null,e.state?.providers.map(g=>c.jsx(iK,{provider:g,busy:e.busyCli===g.cli},g.cli)),n&&o?c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"terminal-carriers-runtime-row",children:[c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-model-label",children:"Default model"}),c.jsx(Ri,{"aria-labelledby":"kimi-default-model-label",value:o,disabled:p||!t.state,options:n.models.map(g=>({value:g.modelId,label:g.name})),onChange:g=>{const _=n.models.find(b=>b.modelId===g);_&&f(_.modelId,_.effort?r?.effort??_.effort.default:void 0)}})]}),u?.effort?c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-effort-label",children:"Default effort"}),c.jsx(Ri,{"aria-labelledby":"kimi-default-effort-label",value:h??u.effort.default,disabled:p||!t.state,options:u.effort.levels.map(g=>({value:g,label:g})),onChange:g=>f(u.modelId,g)})]}):null]}),c.jsx("p",{className:"global-settings-help",children:"Used for Kimi sessions without an explicit carrier model. Applies to newly launched sessions."})]}):null,c.jsx("p",{className:"global-settings-foot",children:"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched."})]})}function iK({provider:e,busy:t}){const[n,i]=v.useState(""),r=async()=>{await RG(e.cli,n)&&i("")};return c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"model-auth-row-head",children:[c.jsx("span",{className:"model-auth-name",children:e.displayName}),c.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?"Signed in":"Not signed in"})]}),e.signedIn?c.jsx("div",{className:"model-auth-actions",children:c.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{NG(e.cli)},children:t?"Working…":"Sign out"})}):c.jsxs("form",{className:"model-auth-form",onSubmit:o=>{o.preventDefault(),r()},children:[c.jsx("input",{type:"password",className:"model-auth-input",placeholder:"API key",value:n,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":`${e.displayName} API key`,onChange:o=>i(o.target.value)}),c.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||n.trim().length===0,children:t?"Verifying…":"Sign in"})]})]})}function sK(){const e=p1(),t=e.state,n=e.savingField!==null;return v.useEffect(()=>{const i=new AbortController;return m1(i.signal),()=>i.abort()},[]),c.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?c.jsx(c.Fragment,{children:c.jsx(rK,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:n,onToggle:()=>{g1("enableMetaphor",!t.enableMetaphor)}})}):c.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function rK({title:e,help:t,onLabel:n,offLabel:i,value:r,disabled:o,onToggle:u}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:e}),c.jsx("p",{className:"global-settings-help",children:t})]}),c.jsx("button",{type:"button",className:`global-settings-toggle ${r?"is-on":""}`,disabled:o,"aria-pressed":r,onClick:u,children:c.jsx("span",{children:r?n:i})})]})}function aK({cli:e,codexLaunchMode:t,disabled:n,onCodexLaunchModeChange:i}){return c.jsxs("div",{className:"agent-cli-row",children:[c.jsx("span",{className:"agent-cli-name",children:e.displayName}),c.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?c.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[c.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:n,onClick:()=>i("acp"),children:"ACP"}),c.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:n,onClick:()=>i("app-server"),children:"App Server"})]}):null,e.available&&e.version?c.jsx("span",{className:"agent-cli-version",children:e.version}):null,c.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function oK({job:e}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"job-overlay-head",children:[c.jsx("span",{className:"job-overlay-kicker",children:e.status}),c.jsx("strong",{children:e.label??e.jobId})]}),c.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const n=e.tracks[t];return n?c.jsx(lK,{track:n,jobStatus:e.status},n.trackId):null})})]})}function lK({track:e,jobStatus:t}){const n=gK(e.status,t),i=VN(e,t),r=d1(e.status,t);return c.jsxs("article",{className:n?`track-card ${n}`:"track-card",children:[c.jsxs("header",{className:"track-card-head",children:[c.jsx("span",{className:"track-card-title",children:e.displayName}),c.jsx("span",{className:"track-card-status",children:r})]}),e.thought?c.jsxs("details",{className:"track-card-thinking",children:[c.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),c.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:c.jsx("pre",{children:e.thought})})]}):null,e.text?c.jsx(ON,{className:"track-card-output markdown-body",text:e.text,streaming:i.tone==="live"}):null,e.error?c.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?c.jsx("div",{className:"track-card-tools",role:"list","aria-label":"Tools",children:e.tools.map(o=>{const u=gG(o.input),h=`is-${YN(o.status)}`;return c.jsxs("span",{className:`track-card-tool-chip ${h}`,role:"listitem",children:[c.jsx("i",{"aria-hidden":"true"}),c.jsx("strong",{children:o.name??o.id}),u?c.jsx("span",{children:u}):null]},o.id)})}):null]})}async function cK(e){kp(await Nq(e)),qN(e)}function uK(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Qu(e.operation.payload,"cliId")??void 0,cliLabel:Qu(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Qu(e.operation.payload,"tenantId")??void 0,registrationId:Qu(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Qu(e,t){const n=e[t];return typeof n=="string"?n:null}function dK(e){const t=e.trim();if(!t)return"";const n=t.split(`
221
+ `);return n[n.length-1]?.trim()??""}function hK(e,t){const n=d1(e.status,t);return jd(n)||n==="aborted"?"error":n==="done"?"done":hc(t,e.status)?"live":void 0}function fK({terminalFont:e}){const[t,n]=v.useState([]),[i,r]=v.useState(!0),[o,u]=v.useState(null),h=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Jl.id:Jl.id}:{source:"system",familyName:e.customName};v.useEffect(()=>{const f=new AbortController;return r(!0),u(null),xA({signal:f.signal}).then(g=>{f.signal.aborted||n(g.fonts.filter(_=>_.monospace).map(_=>({family:_.family,monospace:_.monospace})))}).catch(g=>{f.signal.aborted||mK(g)||(n([]),u("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||r(!1)}),()=>f.abort()},[]);const p=f=>{if(f.source==="system"){OH(f.familyName);return}const g=gd.find(_=>_.id===f.id);g&&jH(g.id)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[c.jsx("div",{className:"global-settings-row",children:c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),c.jsx("div",{"aria-describedby":"terminal-font-help",children:c.jsx(SA,{builtIns:gd.map(f=>({id:f.id,label:f.name,family:f.family,aliases:[f.familyName],description:f.meta})),installedFonts:t,selected:h,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Jl.family,previewText:WG,size:e.size,sizeRange:UG,loading:i,error:o,onSelectionChange:p,onSizeCommit:DH})}),c.jsx("p",{className:"global-settings-foot",children:"Font preferences apply immediately and are stored on the Console server, separate from session settings and shared across browsers after restart."})]})}function pK({terminalRenderer:e}){return c.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),c.jsx("p",{className:"global-settings-help",children:"WebGL paints the terminal on the GPU for sharper, faster output; DOM is a compatibility fallback. Switching applies to the live terminal instantly without dropping the session."})]}),c.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:BG.map(t=>{const n=t.id===e;return c.jsx("button",{type:"button","aria-pressed":n,className:`segmented-option ${n?"is-active":""}`,onClick:()=>MH(t.id),children:t.label},t.id)})})]})})}function mK(e){return e instanceof DOMException&&e.name==="AbortError"}function gK(e,t){if(hc(t,e))return"track-card--live";const n=d1(e,t);return jd(n)?"track-card--bad":n==="done"||n==="aborted"?"track-card--idle":""}function _K(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),c.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function vK(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function yK(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function bK(){return c.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const kb=new Set;let _r={loading:!1,state:null,options:null,activeCarrierId:null,savingActionId:null,error:null};function SK(){return v.useSyncExternalStore(wK,fc,fc)}function fc(){return _r}function wK(e){return kb.add(e),()=>{kb.delete(e)}}async function Uf(e){Ua({loading:!0,error:null});try{const[t,n]=await Promise.all([pq(e),DN(e)]);uL(t,n)}catch(t){if(e?.aborted)return;Ua({loading:!1,error:dL(t)})}}function xK(e){Ua({activeCarrierId:e,error:null})}async function gf(e){const t=v1();return!t||_r.savingActionId!==null?!1:_1("carrier-patch",()=>mq(t.carrierId,e))}async function CK(e,t){const n=v1();return!n||_r.savingActionId!==null?!1:_1(`taskforce-save:${e}`,()=>gq(n.carrierId,e,t))}async function kK(e){const t=v1();return!t||_r.savingActionId!==null?!1:_1(`taskforce-remove:${e}`,()=>_q(t.carrierId,e))}function uL(e,t){const n=EK(e,_r.activeCarrierId);Ua({loading:!1,state:e,options:t,activeCarrierId:n,error:null})}async function _1(e,t){Ua({savingActionId:e,error:null});try{const n=await t();return uL(n.state,_r.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),Ua({savingActionId:null}),!0}catch(n){const i=dL(n);return Ua({error:i}),await Uf(),Ua({savingActionId:null,error:i}),!1}}function v1(){return _r.state?.carriers.find(e=>e.carrierId===_r.activeCarrierId)??null}function EK(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function Ua(e){_r={..._r,...e};for(const t of kb)t()}function dL(e){return e instanceof Error?e.message:String(e)}const TK=50,hL=2400,AK={nimitz:"var(--captain-nimitz)",kirov:"var(--captain-kirov)",genesis:"var(--captain-genesis)",ohio:"var(--captain-ohio)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)",tempest:"var(--captain-tempest)",chronicle:"var(--captain-chronicle)"},RK={id:"carriers",title:"Carriers",render:()=>c.jsx(NK,{})};function NK(){const e=SK(),t=e.state?.carriers.find(R=>R.carrierId===e.activeCarrierId)??null,[n,i]=v.useState(!1),[r,o]=v.useState(""),[u,h]=v.useState("idle"),[p,f]=v.useState({}),g=p.carrierId===t?.carrierId?p:{},_=g.cli??t?.cliType,b=e.options?.cliTypes.find(R=>R.id===_)??null,S=g.model??t?.model,w=b?.models.find(R=>R.modelId===S)??null,C=e.savingActionId!==null;v.useEffect(()=>{const R=new AbortController;return Uf(R.signal),()=>R.abort()},[]),v.useEffect(()=>{i(!1),o(t?.displayName??""),h("idle"),f({})},[t?.carrierId]),v.useEffect(()=>{if(u!=="saved")return;const R=window.setTimeout(()=>h("idle"),hL);return()=>window.clearTimeout(R)},[u]);async function x(R){const $=fc().activeCarrierId;h("saving");const H=await R();return fc().activeCarrierId===$&&(f({}),h(H?"saved":"idle")),H}async function I(){!t||C||(i(!1),r!==t.displayName&&await x(()=>gf({displayName:r})))}function z(){o(t?.displayName??""),i(!1)}async function U(R){const $=e.options?.cliTypes.find(J=>J.id===R),H=$?.models.find(J=>J.modelId===$.defaultModel)??$?.models[0]??null;!t||!$||!H||(f({carrierId:t.carrierId,cli:R,model:H.modelId,effort:H.effort?.default??""}),await x(()=>gf({cli:R,model:{model:H.modelId,...H.effort?.default?{effort:H.effort.default}:{}}})))}async function A(R){if(!t)return;const $=b?.models.find(H=>H.modelId===R)??null;f({carrierId:t.carrierId,model:R,effort:$?.effort?.default??""}),await x(()=>gf({model:{model:R,...$?.effort?.default?{effort:$.effort.default}:{}}}))}async function O(R){t&&(f({carrierId:t.carrierId,effort:R}),await x(()=>gf({model:{model:t.model,effort:R}})))}return c.jsxs(c.Fragment,{children:[e.error?c.jsx("p",{className:"terminal-carriers-error",role:"alert",children:e.error}):null,c.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":"Carrier list",children:[e.loading&&!e.state?c.jsx("p",{className:"terminal-carriers-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?c.jsx("p",{className:"terminal-carriers-empty",children:"No carriers registered."}):null,e.state?.carriers.map(R=>c.jsx(LK,{carrier:R,active:R.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??null,onSelect:()=>xK(R.carrierId)},R.carrierId))]}),t&&e.options&&b?c.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:mL(t.carrierId),children:[c.jsxs("div",{className:"terminal-carriers-detail-head",children:[c.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[c.jsxs("div",{className:"terminal-carriers-captain-id",children:[c.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),c.jsx("div",{className:`terminal-carriers-name-line ${n?"is-editing":""}`,children:n?c.jsxs(c.Fragment,{children:[c.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":"Display name",value:r,maxLength:TK,disabled:C,onChange:R=>o(R.target.value),onBlur:R=>{const $=R.relatedTarget;$ instanceof HTMLElement&&$.closest("[data-display-name-action]")||I()},onKeyDown:R=>{R.key==="Enter"?(R.preventDefault(),I()):R.key==="Escape"&&(R.preventDefault(),z())}}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":"Save display name",disabled:C,onClick:()=>{I()},children:c.jsx(OK,{})}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":"Cancel display name edit",onClick:z,children:c.jsx(DK,{})})]}):c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"terminal-carriers-captain-name",children:t.displayName}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":"Edit display name",disabled:C,onClick:()=>{o(t.displayName),i(!0)},children:c.jsx(jK,{})})]})}),c.jsx("div",{className:"terminal-carriers-captain-role",children:t.role})]}),c.jsxs("div",{className:"terminal-carriers-detail-actions",children:[c.jsx("div",{className:`terminal-carriers-save-status ${u==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:u==="saving"?"Saving…":u==="saved"?"Saved ✓":""}),c.jsx("div",{className:"terminal-carriers-save-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:e.loading||C,onClick:()=>{Uf()},children:"Refresh"})})]})]}),c.jsxs("div",{className:"terminal-carriers-body",children:[c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Identity"}),c.jsx("div",{className:"terminal-carriers-mission",children:t.roleDescription})]}),c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:"Runtime"}),c.jsxs("div",{className:"terminal-carriers-runtime",children:[c.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:c.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[c.jsx("span",{className:"terminal-carriers-label",id:"carrier-cli-label",children:"CLI"}),c.jsx(Ri,{"aria-labelledby":"carrier-cli-label",value:g.cli??t.cliType,disabled:C,options:e.options.cliTypes.map(R=>({value:R.id,label:R.displayName})),onChange:R=>{U(R)}})]})}),c.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[c.jsx(fL,{id:"carrier-model",label:"Model",models:b.models,value:g.model??t.model,disabled:C,onChange:R=>{A(R)}}),c.jsx(pL,{id:"carrier-effort",model:w,value:g.effort??t.effort??"",disabled:C,onChange:R=>{O(R)}})]})]})]}),t.taskForceCapable?c.jsx(MK,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,stateGeneration:e.state?.generation??0}):null]})]},t.carrierId):c.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[c.jsx("p",{className:"terminal-carriers-empty",children:"Select a carrier."}),c.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:e.loading,onClick:()=>{Uf()},children:"Refresh"})]})]})}function LK({carrier:e,active:t,minBackends:n,onSelect:i}){const r=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return c.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:mL(e.carrierId),onClick:i,children:[c.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),c.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),r?c.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function fL({id:e,label:t,models:n,value:i,disabled:r=!1,onChange:o}){const u=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:u,children:t}),c.jsx(Ri,{"aria-labelledby":u,value:i,disabled:r,options:n.map(h=>({value:h.modelId,label:h.name})),onChange:o})]})}function pL({id:e,model:t,value:n,disabled:i=!1,onChange:r}){if(!t?.effort)return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",children:"Effort"}),c.jsx("p",{className:"terminal-carriers-help",children:"Not supported for this model."})]});const o=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:o,children:"Effort"}),c.jsx(Ri,{"aria-labelledby":o,value:n||t.effort.default,disabled:i,options:t.effort.levels.map(u=>({value:u,label:u})),onChange:r})]})}function MK({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,stateGeneration:r}){const o=e.taskforce.backends.length,[u,h]=v.useState(o>0),[p,f]=v.useState(!1),[g,_]=v.useState(""),[b,S]=v.useState(null),[w,C]=v.useState({}),[x,I]=v.useState({}),z=e.taskforce.backends.length>=n,U=t.filter(Z=>!e.taskforce.backends.some(K=>K.cliType===Z.id)),A=g||U[0]?.id||"",O=i!==null;v.useEffect(()=>{S(null)},[r]),v.useEffect(()=>{if(!b)return;const Z=K=>{const M=K.target;(!(M instanceof Element)||!M.closest(`[data-remove-cli="${b}"]`))&&S(null)};return document.addEventListener("click",Z,!0),()=>document.removeEventListener("click",Z,!0)},[b]),v.useEffect(()=>{const Z=Object.entries(w).filter(([,M])=>M==="saved").map(([M])=>M);if(Z.length===0)return;const K=window.setTimeout(()=>{C(M=>{const N={...M};for(const D of Z)N[D]="idle";return N})},hL);return()=>window.clearTimeout(K)},[w]);async function R(Z,K,M,N={}){const D=e.carrierId;I(T=>({...T,...N})),C(T=>({...T,[Z]:"saving"}));const j=await CK(Z,{model:K,...M?{effort:M}:{}});return fc().activeCarrierId===D&&(I({}),C(T=>({...T,[Z]:j?"saved":"idle"})),j&&S(null)),j}async function $(Z,K){if(!e.taskforce.backends.find(j=>j.cliType===Z.id))return;const D=(Z.models.find(j=>j.modelId===K)??null)?.effort?.default??"";await R(Z.id,K,D,{[`tf:${Z.id}:model`]:K,[`tf:${Z.id}:effort`]:D})}async function H(Z,K,M){await R(Z,K,M,{[`tf:${Z}:effort`]:M})}async function J(Z){if(b!==Z){S(Z);return}const K=e.carrierId;C(N=>({...N,[Z]:"saving"}));const M=await kK(Z);fc().activeCarrierId===K&&(I({}),C(N=>({...N,[Z]:M?"saved":"idle"})),M&&S(null))}return c.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${u?"is-expanded":""}`,children:[c.jsxs("div",{className:"terminal-carriers-section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"terminal-carriers-resp-title",children:"Task Force"}),c.jsx("p",{className:"terminal-carriers-help",children:o>0?`${o} backend${o===1?"":"s"} configured${z?" · active":` · needs ${n}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${n} to activate.`})]}),c.jsx("div",{className:"terminal-carriers-tf-head-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":u,onClick:()=>h(Z=>!Z),children:u?"Hide":"Configure"})})]}),u?c.jsxs("div",{className:"terminal-carriers-tf-list",children:[e.taskforce.backends.length===0?c.jsx("p",{className:"terminal-carriers-tf-empty",children:"No Task Force backend configured."}):null,e.taskforce.backends.map(Z=>{const K=t.find(L=>L.id===Z.cliType);if(!K)return null;const M=x[`tf:${K.id}:model`]??Z.model,N=x[`tf:${K.id}:effort`]??Z.effort??"",D=K.models.find(L=>L.modelId===M)??K.models[0]??null,j=w[K.id]??"idle",T=b===K.id,B=e.taskforce.backends.length-1<n?"Confirm — TF deactivates":"Confirm remove";return c.jsxs("div",{className:"terminal-carriers-tf-item is-active",children:[c.jsxs("div",{className:"terminal-carriers-tf-title",children:[c.jsx("span",{className:`terminal-carriers-live-dot ${z?"is-live":""}`,"aria-hidden":"true"}),c.jsx("strong",{children:K.displayName}),c.jsx("span",{className:`terminal-carriers-tf-status ${j==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:j==="saving"?"Saving…":j==="saved"?"Saved ✓":""})]}),c.jsx(fL,{id:`tf-${K.id}-model`,label:"Model",models:K.models,value:M,disabled:O,onChange:L=>{$(K,L)}}),c.jsx(pL,{id:`tf-${K.id}-effort`,model:D,value:N,disabled:O,onChange:L=>{H(K.id,M,L)}}),c.jsx("div",{className:"terminal-carriers-tf-actions",children:c.jsx("button",{type:"button",className:`terminal-carriers-ghost-button terminal-carriers-tf-remove ${T?"is-armed":""}`,"data-remove-cli":K.id,"aria-label":T?`Confirm removal of ${K.displayName} backend`:void 0,disabled:O,onClick:()=>{J(K.id)},children:T?B:"Remove"})})]},K.id)}),c.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[p&&U.length>0?c.jsx(Ri,{className:"terminal-carriers-tf-add-select",label:"Task Force CLI to add",value:A,disabled:O,options:U.map(Z=>({value:Z.id,label:Z.displayName})),onChange:Z=>_(Z)}):null,c.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:U.length===0||O,onClick:()=>{if(!p){f(!0);return}const Z=A,K=t.find(N=>N.id===Z),M=K?.models.find(N=>N.modelId===K.defaultModel)??K?.models[0]??null;!K||!M||R(K.id,M.modelId,M.effort?.default??"").then(N=>{N&&(_(""),f(!1))})},children:"Add"})]})]}):null]})}function mL(e){return{"--cap-color":AK[e]??"var(--brass)"}}function jK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),c.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function OK(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:c.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function DK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),c.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const IK="global-shell:theater:",BK="/plugins/terminal/global/ticket",PK="/plugins/terminal/ws",$K=168,zK={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},HK={id:"global-shell",title:"Shell",icon:FK,preferredExtraWidth:$K,render:e=>c.jsx("div",{style:zK,children:c.jsx(X0,{operationId:`${IK}${encodeURIComponent(e.theaterId??"")}`,ticketPath:BK,wsPath:PK,theme:"instrument",active:!0})})};function FK(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const UK="/plugins/terminal/shell/ticket",WK="/plugins/terminal/ws",gL={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>v.createElement(qK,{context:e})},mv={id:"terminal",operationKinds:[gL],install:()=>{},closeOperation:async e=>{await fetch(`/plugins/terminal/shell/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},launch:async({theaterId:e,operations:t})=>({id:(await t.create({theaterId:e,type:"shell",pluginId:"terminal",title:"Shell",payload:{theaterId:e}})).id}),renderLaunchIcon:()=>c.jsx(GK,{})};function qK({context:e}){return c.jsx(X0,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:UK,wsPath:WK,theme:e.theme,onExit:e.onClose})}function GK(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),c.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const KK=new Set(["agent"]),VK={id:"terminal",operationKinds:[gL,sL],settingsSections:[rL,aL,RK],notificationKinds:[oL],railPanels:[HK],install:e=>(eN(),LH(e.settings),mf.install?.(e)),closeOperation:async e=>{const t=await XK(e);if(t?.type==="shell"){await mv.closeOperation?.(e);return}t&&KK.has(t.type)&&await mf.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?mv.launch?.(e)??{id:""}:mf.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?mv.renderLaunchIcon?.(e):mf.renderLaunchIcon?.(e)},YK=[VK];async function XK(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const n=await t.json();return typeof n.operation?.type=="string"?{type:n.operation.type}:null}const te={ts:"ts",js:"js",json:"json",css:"css",html:"html",md:"md",py:"py",go:"go",rust:"rust",shell:"shell",config:"config",image:"image",data:"data",archive:"archive",binary:"binary",ruby:"ruby",folder:"folder",default:"default"},ZK={src:te.ts,lib:te.ts,app:te.ts,test:te.shell,tests:te.shell,__tests__:te.shell,spec:te.shell,specs:te.shell,node_modules:te.binary,vendor:te.binary,dist:te.config,build:te.config,out:te.config,target:te.config,docs:te.md,doc:te.md,public:te.data,assets:te.data,static:te.data,components:te.image,scripts:te.js,styles:te.css,".git":te.html,".github":te.config,".vscode":te.css},xE={ts:{shape:"angle",tone:te.ts},tsx:{shape:"angle",tone:te.ts},mts:{shape:"angle",tone:te.ts},cts:{shape:"angle",tone:te.ts},"d.ts":{shape:"angle",tone:te.ts},js:{shape:"angle",tone:te.js},jsx:{shape:"angle",tone:te.js},mjs:{shape:"angle",tone:te.js},cjs:{shape:"angle",tone:te.js},json:{shape:"braces",tone:te.json},jsonc:{shape:"braces",tone:te.json},json5:{shape:"braces",tone:te.json},jsonl:{shape:"braces",tone:te.json},graphql:{shape:"braces",tone:te.image},gql:{shape:"braces",tone:te.image},proto:{shape:"braces",tone:te.go},css:{shape:"hash",tone:te.css},scss:{shape:"hash",tone:te.css},sass:{shape:"hash",tone:te.css},less:{shape:"hash",tone:te.css},styl:{shape:"hash",tone:te.css},html:{shape:"markup",tone:te.html},htm:{shape:"markup",tone:te.html},xml:{shape:"markup",tone:te.html},xhtml:{shape:"markup",tone:te.html},vue:{shape:"markup",tone:te.shell},svelte:{shape:"markup",tone:te.rust},astro:{shape:"markup",tone:te.image},md:{shape:"doc",tone:te.md},mdx:{shape:"doc",tone:te.md},markdown:{shape:"doc",tone:te.md},rst:{shape:"doc",tone:te.md},txt:{shape:"doc",tone:te.default},text:{shape:"doc",tone:te.default},log:{shape:"doc",tone:te.default},adoc:{shape:"doc",tone:te.md},pdf:{shape:"doc",tone:te.ruby},py:{shape:"angle",tone:te.py},pyi:{shape:"angle",tone:te.py},pyw:{shape:"angle",tone:te.py},go:{shape:"angle",tone:te.go},rs:{shape:"angle",tone:te.rust},rb:{shape:"angle",tone:te.ruby},rake:{shape:"angle",tone:te.ruby},gemspec:{shape:"angle",tone:te.ruby},java:{shape:"angle",tone:te.html},kt:{shape:"angle",tone:te.config},kts:{shape:"angle",tone:te.config},scala:{shape:"angle",tone:te.ruby},c:{shape:"angle",tone:te.ts},h:{shape:"angle",tone:te.ts},cpp:{shape:"angle",tone:te.css},cc:{shape:"angle",tone:te.css},cxx:{shape:"angle",tone:te.css},hpp:{shape:"angle",tone:te.css},cs:{shape:"angle",tone:te.config},php:{shape:"angle",tone:te.config},swift:{shape:"angle",tone:te.html},lua:{shape:"angle",tone:te.ts},dart:{shape:"angle",tone:te.go},sh:{shape:"terminal",tone:te.shell},bash:{shape:"terminal",tone:te.shell},zsh:{shape:"terminal",tone:te.shell},fish:{shape:"terminal",tone:te.shell},ps1:{shape:"terminal",tone:te.css},bat:{shape:"terminal",tone:te.shell},cmd:{shape:"terminal",tone:te.shell},yaml:{shape:"gear",tone:te.config},yml:{shape:"gear",tone:te.config},toml:{shape:"gear",tone:te.config},ini:{shape:"gear",tone:te.config},conf:{shape:"gear",tone:te.config},cfg:{shape:"gear",tone:te.config},properties:{shape:"gear",tone:te.config},env:{shape:"gear",tone:te.config},editorconfig:{shape:"gear",tone:te.config},png:{shape:"image",tone:te.image},jpg:{shape:"image",tone:te.image},jpeg:{shape:"image",tone:te.image},gif:{shape:"image",tone:te.image},webp:{shape:"image",tone:te.image},svg:{shape:"image",tone:te.image},ico:{shape:"image",tone:te.image},bmp:{shape:"image",tone:te.image},avif:{shape:"image",tone:te.image},tiff:{shape:"image",tone:te.image},heic:{shape:"image",tone:te.image},mp4:{shape:"image",tone:te.data},mov:{shape:"image",tone:te.data},webm:{shape:"image",tone:te.data},mkv:{shape:"image",tone:te.data},mp3:{shape:"chip",tone:te.shell},wav:{shape:"chip",tone:te.shell},flac:{shape:"chip",tone:te.shell},ogg:{shape:"chip",tone:te.shell},sql:{shape:"database",tone:te.data},csv:{shape:"database",tone:te.data},tsv:{shape:"database",tone:te.data},db:{shape:"database",tone:te.data},sqlite:{shape:"database",tone:te.data},sqlite3:{shape:"database",tone:te.data},parquet:{shape:"database",tone:te.data},zip:{shape:"archive",tone:te.archive},tar:{shape:"archive",tone:te.archive},gz:{shape:"archive",tone:te.archive},tgz:{shape:"archive",tone:te.archive},bz2:{shape:"archive",tone:te.archive},xz:{shape:"archive",tone:te.archive},rar:{shape:"archive",tone:te.archive},"7z":{shape:"archive",tone:te.archive},zst:{shape:"archive",tone:te.archive},bin:{shape:"chip",tone:te.binary},exe:{shape:"chip",tone:te.binary},dll:{shape:"chip",tone:te.binary},so:{shape:"chip",tone:te.binary},dylib:{shape:"chip",tone:te.binary},wasm:{shape:"chip",tone:te.config},class:{shape:"chip",tone:te.binary},lock:{shape:"chip",tone:te.binary},woff:{shape:"chip",tone:te.config},woff2:{shape:"chip",tone:te.config},ttf:{shape:"chip",tone:te.config},otf:{shape:"chip",tone:te.config}},JK={dockerfile:{shape:"chip",tone:te.css},"docker-compose.yml":{shape:"gear",tone:te.css},"docker-compose.yaml":{shape:"gear",tone:te.css},makefile:{shape:"gear",tone:te.html},"cmakelists.txt":{shape:"gear",tone:te.html},".gitignore":{shape:"gear",tone:te.html},".gitattributes":{shape:"gear",tone:te.html},".dockerignore":{shape:"gear",tone:te.html},".npmignore":{shape:"gear",tone:te.html},".npmrc":{shape:"gear",tone:te.ruby},"package.json":{shape:"braces",tone:te.shell},"tsconfig.json":{shape:"braces",tone:te.ts},license:{shape:"doc",tone:te.json},"license.md":{shape:"doc",tone:te.json},licence:{shape:"doc",tone:te.json}},QK={shape:"default",tone:te.default},Eb={angle:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),c.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),c.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:c.jsxs(c.Fragment,{children:[c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),c.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),c.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function eV({name:e}){const t=nV(e);return c.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:Eb[t.shape]})}function tV({name:e,open:t}){const n=ZK[e.toLowerCase()]??te.folder;return c.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?Eb.folderOpen:Eb.folderClosed})}function nV(e){const t=e.toLowerCase(),n=JK[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:te.config};if(t.startsWith("readme"))return{shape:"doc",tone:te.md};if(t.endsWith(".d.ts"))return xE["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const r=t.slice(i+1),o=xE[r];if(o)return o}return QK}const iV=200,_f=30,CE=5,_L="fleet-console.fileExplorer.showHidden",kE=500;function Ws(e,t){return e===t}async function sV({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:r,onFolderResult:o}){const u=[],h=new Map(t),p=new Set,f=new Set;let g=0;const _=b=>{for(const S of b)if(!(!aV(S,i)||p.has(S.relativePath))){if(p.size>=kE)return;p.add(S.relativePath),u.push(S)}};for(_(e);u.length>0&&r();){const b=u.shift();if(!b)return;const S=h.get(b.relativePath);if(S){if(f.has(S.relativePath))continue;f.add(S.relativePath),_(S.entries);continue}if(g>=kE)return;g+=1;try{const w=await n.listFolder(b.relativePath);if(!r())return;if(h.set(b.relativePath,w),o(b.relativePath,w),f.has(w.relativePath))continue;f.add(w.relativePath),_(w.entries)}catch{}}}function vL(e,t,n,i,r,o,u,h,p=new Set){const f=[];for(const g of e){if(!h&&g.name.startsWith("."))continue;const _=o.get(g.relativePath),b=_?.entries,S=_?.relativePath??g.relativePath,w=g.kind==="dir"&&p.has(S),C=g.kind==="dir"&&!w&&yL(b??[],o,u,h);if(u&&!g.name.toLowerCase().includes(u)&&!C)continue;const x=i.has(g.relativePath)||!!(u&&C);if(f.push({entry:g,depth:t,isSelected:n===g.relativePath,isExpanded:x,isLoading:r.has(g.relativePath)}),g.kind==="dir"&&x&&!w&&b){const I=new Set(p);I.add(S),f.push(...vL(b,t+1,n,i,r,o,u,h,I))}}return f}function rV({contextKey:e,files:t,theaterId:n,selectedPath:i,onSelect:r}){const[o,u]=v.useState(null),[h,p]=v.useState(null),[f,g]=v.useState(""),[_,b]=v.useState(new Set),[S,w]=v.useState(new Set),[C,x]=v.useState(new Map),[I,z]=v.useState(""),[U,A]=v.useState(0),[O,R]=v.useState(600),[$,H]=v.useState(()=>oV()),J=v.useRef(null),Z=v.useRef(_);Z.current=_;const K=v.useRef(f);K.current=f;const M=v.useRef(t);M.current=t;const N=v.useRef(e);N.current=e;const D=v.useRef(C);D.current=C;const j=v.useRef(0),T=!!I;v.useEffect(()=>{n&&(u(null),p(null),g(""),b(new Set),x(new Map),z(""),A(0))},[e,n]),v.useEffect(()=>{if(!n)return;const Oe=e;t.listFolder(f||void 0).then(Le=>{Ws(Oe,N.current)&&(u(Le),p(null))}).catch(Le=>{Ws(Oe,N.current)&&p(Le instanceof Error?Le.message:"Unable to load folder")})},[e,n,f,t]),v.useEffect(()=>{const Oe=++j.current;if(!T||!o)return;let Le=!0;const we=e,Ie=()=>Le&&Oe===j.current&&Ws(we,N.current);return sV({entries:o.entries,cachedResults:D.current,files:t,showHidden:$,isCurrent:Ie,onFolderResult:(Qe,dt)=>{Ie()&&x(Je=>new Map(Je).set(Qe,dt))}}),()=>{Le=!1}},[e,t,T,o,$]),v.useEffect(()=>{const Oe=J.current;if(!Oe)return;const Le=new ResizeObserver(()=>R(Oe.clientHeight));return Le.observe(Oe),R(Oe.clientHeight),()=>Le.disconnect()},[]),v.useEffect(()=>{if(!n)return;let Oe=!0;const Le=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,we=new EventSource(Le),Ie=()=>{const dt=e;M.current.listFolder(K.current||void 0).then(Je=>{Ws(dt,N.current)&&(u(Je),p(null))}).catch(()=>{})},Qe=()=>{Ie();for(const dt of Z.current){const Je=e;M.current.listFolder(dt).then(le=>{Ws(Je,N.current)&&x(Ye=>new Map(Ye).set(dt,le))}).catch(()=>{})}};return we.addEventListener("change",dt=>{let Je;try{Je=JSON.parse(dt.data)}catch{return}if(typeof Je=="string"&&((Je===""||Je===K.current)&&Ie(),Je!==""&&Z.current.has(Je))){const le=e;M.current.listFolder(Je).then(Ye=>{Ws(le,N.current)&&x(Pe=>new Map(Pe).set(Je,Ye))}).catch(()=>{})}}),we.onopen=()=>{if(Oe){Oe=!1;return}Qe()},()=>{we.close()}},[e,n,t]);const B=v.useCallback(Oe=>{const Le=Oe.relativePath,we=!_.has(Le);if(b(Ie=>{const Qe=new Set(Ie);return Qe.has(Le)?(Qe.delete(Le),Qe):(Qe.add(Le),Qe)}),we){const Ie=e;w(Qe=>new Set(Qe).add(Le)),t.listFolder(Le).then(Qe=>{Ws(Ie,N.current)&&(x(dt=>new Map(dt).set(Le,Qe)),w(dt=>{const Je=new Set(dt);return Je.delete(Le),Je}))}).catch(()=>{Ws(Ie,N.current)&&w(Qe=>{const dt=new Set(Qe);return dt.delete(Le),dt})})}},[e,t,_]),L=v.useCallback(Oe=>{Oe.kind==="dir"?B(Oe):r(Oe)},[B,r]),F=v.useCallback(Oe=>{A(Oe.currentTarget.scrollTop)},[]),W=v.useCallback(()=>{H(Oe=>{const Le=!Oe;try{localStorage.setItem(_L,Le?"1":"0")}catch{}return Le})},[]),E=v.useCallback(()=>{if(!n)return;const Oe=e;t.listFolder(f||void 0).then(Le=>{Ws(Oe,N.current)&&(u(Le),p(null))}).catch(Le=>{Ws(Oe,N.current)&&p(Le instanceof Error?Le.message:"Unable to load folder")});for(const Le of _)t.listFolder(Le).then(we=>{Ws(Oe,N.current)&&x(Ie=>new Map(Ie).set(Le,we))}).catch(()=>{})},[e,t,f,_,n]),G=I.toLowerCase(),Y=v.useMemo(()=>o?vL(o.entries,0,i,_,S,C,G,$):[],[o,i,_,S,C,G,$]),re=!$&&o!==null&&o.entries.length>0&&Y.length===0&&!I,he=Y.length>iV,ae=he?Math.max(0,Math.floor(U/_f)-CE):0,ke=he?Math.min(Y.length,Math.ceil((U+O)/_f)+CE):Y.length,Re=Y.slice(ae,ke),De=Y.length*_f,Ue=ae*_f;return n?h&&!o?c.jsx("div",{className:"fexp-tree-error",children:h}):o?c.jsxs("div",{className:"fexp-tree-container",children:[c.jsxs("div",{className:"fexp-filter",children:[c.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:I,onChange:Oe=>z(Oe.target.value),"aria-label":"Filter files"}),I&&c.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>z(""),"aria-label":"Clear filter",children:"✕"}),c.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:E,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),c.jsx("button",{type:"button",className:`fexp-hidden-toggle${$?" is-active":""}`,onClick:W,"aria-pressed":$,"aria-label":$?"Hide hidden files":"Show hidden files",title:$?"Hide hidden files":"Show hidden files",children:$?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),c.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),c.jsxs("div",{ref:J,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:he?F:void 0,children:[!1,he?c.jsx("div",{style:{height:De,position:"relative"},children:c.jsx("div",{style:{transform:`translateY(${Ue}px)`},children:Re.map(Oe=>c.jsx(EE,{row:Oe,onEntryClick:L},Oe.entry.relativePath))})}):Re.map(Oe=>c.jsx(EE,{row:Oe,onEntryClick:L},Oe.entry.relativePath)),Y.length===0&&I&&c.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),Y.length===0&&!I&&o.entries.length===0&&c.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),re&&c.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):c.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):c.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function yL(e,t,n,i,r=new Set){for(const o of e)if(!(!i&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(n))return!0;if(o.kind==="dir"){const u=t.get(o.relativePath);if(u&&!r.has(u.relativePath)){const h=new Set(r);if(h.add(u.relativePath),yL(u.entries,t,n,i,h))return!0}}}return!1}function aV(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function EE({row:e,onEntryClick:t}){const{entry:n,depth:i,isSelected:r,isExpanded:o,isLoading:u}=e,h=n.kind==="dir",p=i*16,f=v.useCallback(()=>t(n),[n,t]);return c.jsxs("button",{className:`fexp-tree-row${r?" is-cur":""}${h?" is-dir":" is-file"}`,style:{paddingLeft:`${p+12}px`},type:"button",role:"treeitem","aria-selected":r,"aria-expanded":h?o:void 0,onClick:f,children:[c.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:h?c.jsx(tV,{name:n.name,open:o}):c.jsx(eV,{name:n.name})}),c.jsx("span",{className:"fexp-tree-name",children:n.name}),u&&c.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function oV(){try{return localStorage.getItem(_L)==="1"}catch{return!1}}function lV({name:e,sizeHint:t}){return c.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[c.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),c.jsx("p",{className:"fexp-bin-name",children:e}),t&&c.jsx("p",{className:"fexp-bin-meta",children:t}),c.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function cV(e,t){switch(t){case"typescript":case"javascript":return dV(e);case"json":return hV(e);case"python":return pV(e);case"css":case"scss":case"sass":case"less":return mV(e);case"html":case"xml":return gV(e);case"bash":case"shell":return _V(e);case"yaml":return vV(e);default:return[{kind:"text",value:e}]}}const uV=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","is","keyof","let","namespace","new","null","of","override","package","private","protected","public","readonly","return","satisfies","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]);function dV(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
222
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="`"){const{slice:i,length:r}=Za(e,n,"`","`");t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])||e[n]==="."&&/[0-9]/.test(e[n+1]??"")){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_$]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_$][\w$]*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);uV.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}function hV(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:r}=Za(e,n,'"','"'),u=e.slice(n+r).trimStart().startsWith(":");t.push({kind:u?"attr":"str",value:i}),n+=r;continue}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(e.startsWith("true",n)||e.startsWith("false",n)||e.startsWith("null",n)){const i=e.slice(n).match(/^(true|false|null)/);if(i){t.push({kind:"key",value:i[0]}),n+=i[0].length;continue}}if(/[{}[\]:,]/.test(e[n])){t.push({kind:"punct",value:e[n]}),n++;continue}t.push({kind:"text",value:e[n]}),n++}return t}const fV=new Set(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"]);function pV(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
223
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),r=e.indexOf(i,n+3),o=r===-1?e.slice(n):e.slice(n,r+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_]\w*/);if(i){const r=i[0],o=e.slice(n+r.length).match(/^\s*\(/);fV.has(r)?t.push({kind:"key",value:r}):o?t.push({kind:"fn",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function mV(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),r=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:r}),n+=r.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
224
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(e[n]==="."||e[n]==="#"||e[n]===":"){const i=e.slice(n).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(i){t.push({kind:"tag",value:i[0]}),n+=i[0].length;continue}}if(/[a-zA-Z-]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z-][\w-]*/);if(i){const r=i[0];e.slice(n+r.length).trimStart().startsWith(":")?t.push({kind:"attr",value:r}):t.push({kind:"text",value:r}),n+=r.length;continue}}if(/[0-9]/.test(e[n])){const i=e.slice(n).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function gV(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),r=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==="<"){t.push({kind:"punct",value:"<"}),n++,e[n]==="/"&&(t.push({kind:"punct",value:"/"}),n++);const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);i&&(t.push({kind:"tag",value:i[0]}),n+=i[0].length);continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const r=e.slice(n+i[0].length).trimStart();t.push({kind:r.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function _V(e){const t=[];let n=0;const i=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;n<e.length;){if(e[n]==="#"){const r=e.indexOf(`
225
+ `,n),o=r===-1?e.slice(n):e.slice(n,r);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:r,length:o}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:r}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const r=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(r){t.push({kind:i.has(r[0])?"key":"text",value:r[0]}),n+=r[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function vV(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
226
+ `,n),r=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:r}),n+=r.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:r}=Za(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=r;continue}if(/[a-zA-Z_]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z_][\w-]*/);if(i){e.slice(n+i[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:i[0]}):["true","false","null","yes","no","on","off"].includes(i[0])?t.push({kind:"key",value:i[0]}):t.push({kind:"text",value:i[0]}),n+=i[0].length;continue}}if(/[0-9\-]/.test(e[n])){const i=e.slice(n).match(/^-?[\d]*\.?[\d]+/);if(i){t.push({kind:"num",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function Za(e,t,n,i){let r=t+n.length;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e.startsWith(i,r)){r+=i.length;break}if(i!=="`"&&e[r]===`
227
+ `)break;r++}return{slice:e.slice(t,r),length:r-t}}function yV({content:e,lang:t,truncated:n}){const i=v.useMemo(()=>bV(e,t),[e,t]);return c.jsxs("div",{className:"fexp-code-wrap",children:[n&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{className:"fexp-code-scroll",children:c.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:c.jsx("tbody",{children:i.map((r,o)=>c.jsxs("tr",{className:"fexp-code-row",children:[c.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:o+1}),c.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:r}})]},o))})})})]})}function bV(e,t){return e.split(`
228
+ `).map(i=>SV(i,t))}function SV(e,t){return t==="plaintext"||t==="markdown"?TE(e)||" ":cV(e,t).map(i=>{const r=TE(i.value);return i.kind==="text"?r:`<span class="syn-${i.kind}">${r}</span>`}).join("")||" "}function TE(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function wV({src:e,name:t}){return c.jsxs("div",{className:"fexp-img-wrap",children:[c.jsx("div",{className:"fexp-img-stage",children:c.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),c.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const xV=new Set([".png",".jpg",".jpeg",".webp",".gif"]),CV=new Set(["img.shields.io"]),kV=/^[a-z][a-z0-9+.-]*:/i;function AE(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||kV.test(n))return null;const i=bL(n);if(!i)return null;const r=AV(i);return r===null?null:RV(r,t)}function EV(e){const t=bL(e).toLowerCase();return[...xV].some(n=>t.endsWith(n))}function RE(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function TV(e){try{const t=new URL(e);return t.protocol==="https:"&&CV.has(t.hostname)}catch{return!1}}function bL(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function AV(e){try{return decodeURI(e)}catch{return null}}function RV(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),r=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${r}/${n}`,u=[];for(const h of o.split("/"))if(!(!h||h===".")){if(h===".."){if(u.length===0)return null;u.pop();continue}u.push(h)}return u.length>0?u.join("/"):null}function NV({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:r}){const o=v.useMemo(()=>{const _=Bs(e).html,b=new DOMParser().parseFromString(_,"text/html");return gv(b.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i}),b.body.innerHTML},[e,n,i]),u=v.useRef(null);v.useEffect(()=>{const _=u.current;if(!_)return;nm(_),gv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i});const b=new MutationObserver(()=>gv(_,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i}));return b.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>b.disconnect()},[o,n,i]);const h=v.useCallback(_=>{const b=_.target.closest('[data-action="copy-code"]');if(!b)return;const S=b.closest("pre")?.getAttribute("data-code");if(!S)return;navigator.clipboard?.writeText(S);const w=b.textContent;b.textContent="Copied",window.setTimeout(()=>{b.textContent=w},1200)},[]),p=v.useCallback(_=>{const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),f=v.useCallback(_=>{if(_.key!=="Enter"&&_.key!==" ")return;const S=_.target.closest("[data-fexp-open-path]");if(!S)return;const w=S.dataset.fexpOpenPath;w&&(_.preventDefault(),t(w))},[t]),g=v.useCallback(_=>{h(_),p(_)},[h,p]);return c.jsxs("div",{className:"fexp-md-wrap",children:[r&&c.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),c.jsx("div",{ref:u,className:"markdown-body",onClick:g,onKeyDown:f,dangerouslySetInnerHTML:{__html:o}})]})}function gv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",r=AE(i,t.currentRelativePath);r?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",r),n.removeAttribute("aria-disabled")):i&&!/^(https?:|mailto:|#)/i.test(i)&&(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const i=n.getAttribute("src")??"",r=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&r&&i===RE(t.theaterId,r)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&TV(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=AE(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&EV(o)){n.setAttribute("src",RE(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&LV(n)}}function LV(e){const t=e.getAttribute("alt")?.trim(),n=e.ownerDocument.createElement("span");n.className="fexp-md-blocked-image",n.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(n)}const MV=360,y1=248,b1=200,Ap=160,Rp=4;function jV(e){return e-b1-Rp>=Ap}function OV(e,t,n){const i=n-b1-Rp;return i<Ap?e:Math.max(Ap,Math.min(i,e-t))}function DV(e){const t=b1+Rp;return`minmax(0, 1fr) ${Rp}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function IV(e){return e?MV:null}const SL="fleet-console.file-explorer.treePaneWidth",S1={selectedPath:null,viewState:{kind:"none"}},BV={...S1,treePaneWidth:y1},wL=new Map,NE=new Map,Tb=new Set;let Np=FV();function PV(e){return v.useSyncExternalStore(HV,()=>zV(e),()=>BV)}function LE(e,t){e&&kL(e,{selectedPath:t})}function ja(e,t){e&&kL(e,{viewState:t})}function $V(e){Np=EL(e);try{localStorage.setItem(SL,String(Np))}catch{}xL()}function xL(){for(const e of Tb)e()}function CL(e){return wL.get(e)??S1}function zV(e){const t=e??"__none__",n=e!=null?CL(e):S1,i=NE.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===Np)return i;const r={...n,treePaneWidth:Np};return NE.set(t,r),r}function kL(e,t){wL.set(e,{...CL(e),...t}),xL()}function HV(e){return Tb.add(e),()=>{Tb.delete(e)}}function FV(){try{return EL(Number(localStorage.getItem(SL)))}catch{return y1}}function EL(e){return!Number.isFinite(e)||e<=0?y1:Math.max(Ap,Math.round(e))}const UV=new Set([".png",".jpg",".jpeg",".webp",".gif"]),WV={id:"file-explorer",title:"Files",icon:KV,render:e=>c.jsx(GV,{...e})};function qV(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const n=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!n.ok){const i=await n.json();throw new Error(i.error??"list_failed")}return n.json()}}}function GV(e){const{theaterId:t}=e,n=t??"",{selectedPath:i,viewState:r,treePaneWidth:o}=PV(n),u=v.useRef(o);u.current=o;const h=v.useRef(null),[p,f]=v.useState(!1),g=v.useMemo(()=>qV(t),[t]),_=v.useCallback(async(x,I)=>{if(!t){ja(t,{kind:"error",message:"no_theater"});return}LE(n,x);const z=I??x.split("/").filter(Boolean).at(-1)??x,U=z.slice(z.lastIndexOf(".")).toLowerCase();if(UV.has(U)){const A=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(x)}`:"";ja(n,{kind:"image",relativePath:x,name:z,src:A});return}ja(n,{kind:"loading"});try{const A=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:x})});if(!A.ok){const R=await A.json();throw new Error(R.error??"read_failed")}const O=await A.json();if(O.binary){ja(n,{kind:"binary",name:z});return}ja(n,{kind:"code",relativePath:O.relativePath,content:O.content,lang:O.lang,truncated:O.truncated})}catch(A){const O=A instanceof Error?A.message:"Unable to load file";O==="binary_file"?ja(n,{kind:"binary",name:z}):ja(n,{kind:"error",message:O})}},[n,t]),b=v.useCallback(async x=>{x.kind==="file"&&await _(x.relativePath,x.name)},[_]),S=v.useCallback(()=>{ja(n,{kind:"none"}),LE(n,null)},[n]),w=v.useCallback(x=>{x.preventDefault();const I=h.current;if(!I)return;const z=I.getBoundingClientRect().width;if(!jV(z))return;const U=x.clientX,A=u.current;f(!0);const O=$=>{const H=$.clientX-U,J=OV(A,H,z);u.current=J,$V(J)},R=()=>{document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",R),f(!1)};document.addEventListener("pointermove",O),document.addEventListener("pointerup",R)},[]),C=r.kind!=="none";return v.useLayoutEffect(()=>{e.requestExtraWidth?.(IV(C))},[e,C]),c.jsxs("div",{ref:h,className:`fexp-root${C?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:C?{gridTemplateColumns:DV(o)}:void 0,children:[C&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fexp-viewer-pane",children:[c.jsxs("div",{className:"fexp-viewer-head",children:[c.jsx("span",{className:"fexp-viewer-filename",children:r.kind!=="loading"&&r.kind!=="error"?"relativePath"in r?r.relativePath:r.name:""}),c.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),c.jsxs("div",{className:"fexp-viewer-body",children:[r.kind==="loading"&&c.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),r.kind==="error"&&c.jsx("div",{className:"fexp-viewer-error",children:r.message}),r.kind==="code"&&r.lang==="markdown"&&c.jsx(NV,{content:r.content,onOpenPath:_,relativePath:r.relativePath,theaterId:t,truncated:r.truncated}),r.kind==="code"&&r.lang!=="markdown"&&c.jsx(yV,{content:r.content,lang:r.lang,truncated:r.truncated}),r.kind==="image"&&c.jsx(wV,{src:r.src,name:r.name}),r.kind==="binary"&&c.jsx(lV,{name:r.name})]})]}),c.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),c.jsx("div",{className:"fexp-tree-pane",children:c.jsx(rV,{files:g,theaterId:t,contextKey:n,selectedPath:i,onSelect:b},n)})]})}function KV(){return c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const VV={id:"file-explorer",railPanels:[WV]},YV=[VV],XV={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function ZV(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]={dirs:{},files:[]}),r=r.dirs[o];r.files.push(n)}return t}function TL({files:e,selectedPath:t,onSelect:n}){const i=ZV(e);return c.jsx(AL,{node:i,depth:0,selectedPath:t,onSelect:n})}function AL({node:e,depth:t,selectedPath:n,onSelect:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx(JV,{dirKey:r,node:o,depth:t,selectedPath:n,onSelect:i},r)),e.files.map(r=>c.jsx(QV,{entry:r,depth:t,selectedPath:n,onSelect:i},r.path))]})}function JV({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:r}){const[o,u]=v.useState(!1),h=v.useCallback(()=>u(_=>!_),[]);let p=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const _=Object.keys(f.dirs)[0];p+="/"+_,f=f.dirs[_]}const g=n*16+12;return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${g}px`},onClick:h,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-folder-name",children:p})]}),!o&&c.jsx(AL,{node:f,depth:n+1,selectedPath:i,onSelect:r})]})}function QV({entry:e,depth:t,selectedPath:n,onSelect:i}){const r=e.path===n,o=v.useCallback(()=>i(e),[e,i]),u=t*16+12,h=e.path.split("/").pop()??e.path;return c.jsxs("button",{type:"button",className:`repository-file-row${r?" is-cur":""}`,style:{paddingLeft:`${u}px`},title:e.path,onClick:o,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:XV[e.status]??e.status}),c.jsx("span",{className:"repository-file-name",children:c.jsx("span",{className:"repository-file-fn",children:h})}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const ME="fleet-console.diff.changesCollapsed",eY={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function tY(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function nY(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function RL({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:r,filterText:o}){const[u,h]=v.useState(()=>nY(ME)),p=v.useCallback(()=>{h(_=>{const b=!_;try{localStorage.setItem(ME,b?"1":"0")}catch{}return b})},[]),f=v.useMemo(()=>e.kind==="ok"?tY(e.files,o):[],[o,e]);if(e.kind==="loading")return c.jsx("div",{className:"repository-sections-loading",children:"Loading…"});if(e.kind==="notice"){const _=e.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=e.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return c.jsxs("div",{className:"repository-sections-notice",children:[c.jsx("strong",{className:"repository-notice-title",children:_}),c.jsx("span",{className:"repository-notice-body",children:b}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]})}if(e.kind==="error")return c.jsxs("div",{className:"repository-sections-error",children:[c.jsx("span",{children:e.message}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:"Retry"})]});const g=o?`${f.length}/${e.files.length}`:String(e.files.length);return c.jsx("div",{className:"repository-sections",children:c.jsxs("div",{className:`repository-section${u?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-section-head",onClick:p,children:[c.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-section-name",children:"Changes"}),c.jsx("span",{className:"repository-count-badge",children:g})]}),!u&&c.jsx("div",{className:"repository-section-rows",children:f.length===0?c.jsx("div",{className:"repository-empty-row",children:o?"No matching items":"No changes"}):n==="tree"?c.jsx(TL,{files:f,selectedPath:i,onSelect:r}):f.map(_=>c.jsx(NL,{entry:_,isSelected:_.path===i,onSelect:r},_.path))})]})})}function NL({entry:e,isSelected:t,onSelect:n}){const i=v.useCallback(()=>n(e),[e,n]),r=e.path.endsWith("/")?e.path.slice(0,-1):e.path,o=r.lastIndexOf("/"),u=o>=0?r.slice(0,o+1):"",h=(o>=0?r.slice(o+1):r)+(e.path.endsWith("/")?"/":"");return c.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:i,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":eY[e.status]??e.status,children:e.status}),c.jsxs("span",{className:"repository-file-name",children:[c.jsx("span",{className:"repository-file-fn",children:h}),u&&c.jsx("span",{className:"repository-file-dir",children:u})]}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const iY=new Set(["import","export","from","const","let","var","function","return","await","async","new","interface","type","extends","implements","class","if","else","for","while","switch","case","of","in","typeof","void","null","undefined","true","false","as","default","throw","try","catch","describe","it","expect","require","module","public","private","readonly"]);function sY(e){let t="",n=0;const i=(r,o)=>`<span class="repository-token-${r}">${o}</span>`;for(;n<e.length;){const r=e[n];if(r==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(r==="/"&&e[n+1]==="/"||r==="#"){t+=i("comment",e.slice(n));break}if(r==='"'||r==="'"||r==="`"){const o=r,u=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(u,n));continue}if(/[0-9]/.test(r)&&!/[A-Za-z0-9_$]/.test(e[n-1]??"")){const o=n;for(;n<e.length&&/[0-9.xXa-fA-F]/.test(e[n]);)n++;t+=i("number",e.slice(o,n));continue}if(/[A-Za-z_$]/.test(r)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const u=e.slice(o,n);t+=iY.has(u)?i("keyword",u):/^[A-Z]/.test(u)?i("type",u):u;continue}if("{}()[].,;:=<>+-*/&|?!".includes(r)){t+=i("punctuation",r),n++;continue}t+=r,n++}return t}const rY=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,aY=/^diff --git a\/(.+) b\/(.+)$/;function oY(e){if(!e)return[];const t=e.split(`
229
+ `);t[t.length-1]===""&&t.pop();const n=[];let i=0,r=0,o=!0;for(const u of t)if(!u.startsWith("\\")){if(u.startsWith("diff --git ")){const h=aY.exec(u),p=h?.[1],f=h?.[2]??u,g=p!==void 0&&p!==f?p:void 0;n.push({kind:"file-label",text:f,oldPath:g}),o=!0;continue}if(o){if(u.startsWith("new file mode")||u.startsWith("deleted file mode")||u.startsWith("old mode")||u.startsWith("new mode")||u.startsWith("rename from ")||u.startsWith("rename to ")||u.startsWith("similarity index")||u.startsWith("dissimilarity index")){n.push({kind:"meta",text:u});continue}if(u.startsWith("index ")||u.startsWith("--- ")||u.startsWith("+++ "))continue;if(!u.startsWith("@@")){u!==""&&n.push({kind:"ctx",text:` ${u}`});continue}}if(u.startsWith("@@")){o=!1;const h=rY.exec(u);if(h){i=parseInt(h[1]??"0",10),r=parseInt(h[2]??"0",10);const p=h[3]?.trimEnd()??"",f=`@@ -${h[1]??""} +${h[2]??""} @@${p?` ${p.trimStart()}`:""}`;n.push({kind:"hunk-label",text:f})}else n.push({kind:"hunk-label",text:u});continue}u.startsWith("+")?n.push({kind:"add",text:u,newLine:r++}):u.startsWith("-")?n.push({kind:"del",text:u,oldLine:i++}):n.push({kind:"ctx",text:u,oldLine:i++,newLine:r++})}return n}function vf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w1({ctx:e,repoRel:t,file:n,mode:i,commit:r,compare:o}){const[u,h]=v.useState({kind:"loading"});if(v.useEffect(()=>{if(!e.theaterId){h({kind:"error",message:"no_theater"});return}let _=!1;return h({kind:"loading"}),o?e.api.fetch("repository","compare-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:o.theaterId,repoRel:o.repoRel,base:o.base,head:o.head,filePath:n.path,...n.oldPath?{oldPath:n.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}):r?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:r.theaterId,repoRel:r.repoRel,ref:r.fullHash,filePath:n.path,...n.oldPath??r.oldPath?{oldPath:n.oldPath??r.oldPath}:{}})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}):e.api.fetch("repository","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,filePath:n.path,mode:i})}).then(async b=>{if(!b.ok)throw new Error((await b.json()).error??"git_failed");const S=await b.json();_||h({kind:"ok",result:S})}).catch(b=>{_||h({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,r,o,t]),u.kind==="loading")return c.jsx("div",{className:"repository-hunk-loading",children:"Loading…"});if(u.kind==="error")return c.jsx("div",{className:"repository-hunk-error",children:u.message});const{result:p}=u,g=oY(p.content).filter(_=>_.kind!=="file-label");return c.jsxs("div",{className:"repository-hunk-wrap",children:[p.truncated&&c.jsx("div",{className:"repository-truncated-badge",children:"Diff truncated"}),c.jsx("div",{className:"repository-hunk-scroll",children:c.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:c.jsx("tbody",{children:g.map((_,b)=>c.jsx("tr",{className:`repository-line repository-line-${_.kind}`,children:_.kind==="hunk-label"?c.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:vf(_.text)}}):_.kind==="meta"?c.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:vf(_.text)}}):_.kind==="file-label"?c.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:vf(_.text)}}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"repository-gutter repository-gutter-old",children:_.oldLine??""}),c.jsx("td",{className:"repository-gutter repository-gutter-new",children:_.newLine??""}),c.jsx("td",{className:"repository-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),c.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:sY(vf(_.text.length>0?_.text.slice(1):_.text))}})]})},b))})})})]})}const x1=140,LL=120,ML=160,vr=4,jL=null;function OL({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:r,dividerWidth:o}){const u=n-r-o;return u<i?jL:Math.max(i,Math.min(u,e-t))}function DL(e){const t=x1+vr;return`minmax(0, 1fr) ${vr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function lY(e){const t=ML+vr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${vr}px minmax(0, 1fr)`}function IL(e,t,n,i,r,o=vr){const u=n-r-o;return u<i?jL:Math.max(i,Math.min(u,e+t))}function cY(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${vr}px minmax(120px, 1fr)`}function uY(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${vr}px minmax(140px, 1fr)`}function C1({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let r=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",u),e.removeEventListener("pointercancel",u),t.removeEventListener("blur",u)},u=()=>{r&&(r=!1,o(),i())},h=()=>{r&&(r=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",u),e.addEventListener("pointercancel",u),t.addEventListener("blur",u),h}const dY="fleet-console.repository.compare.",hY=248,fY=220;function BL(e,t){return`${dY}${e}.${t}`}function pY(e,t){try{const n=localStorage.getItem(BL(e,t));if(!n)return null;const i=JSON.parse(n);return typeof i!="object"||i===null?null:{base:typeof i.base=="string"?i.base:"",head:typeof i.head=="string"?i.head:""}}catch{return null}}function mY(e,t,n,i){try{localStorage.setItem(BL(e,t),JSON.stringify({base:n,head:i}))}catch{}}function gY({ctx:e,repoRel:t,refs:n,refsError:i=!1,onRetryRefs:r,onFileOpenChange:o}){const[u,h]=v.useState(""),[p,f]=v.useState(""),[g,_]=v.useState({kind:"idle"}),[b,S]=v.useState(null),[w,C]=v.useState(hY),[x,I]=v.useState(!1),z=v.useRef(w),U=v.useRef(null),A=v.useRef(null),O=v.useRef(!1),R=v.useRef(0),$=v.useMemo(()=>n.remotes.filter(E=>!T1(E.ref)),[n.remotes]),H=n.branches.find(E=>E.current)??null,J=H===null,Z=v.useCallback(E=>E==="HEAD"?J:n.branches.some(G=>G.ref===E)||$.some(G=>G.ref===E)||n.tags.some(G=>G.ref===E),[n.branches,n.tags,$,J]);v.useEffect(()=>{const E=n.branches.length>0||$.length>0||n.tags.length>0,G=H?.ref??"HEAD";if(!O.current){if(!E||!e.theaterId)return;O.current=!0;const Y=pY(e.theaterId,t);h(Y&&Z(Y.base)?Y.base:""),f(Y&&Z(Y.head)?Y.head:G);return}h(Y=>Y&&!Z(Y)?"":Y),f(Y=>Y&&!Z(Y)?G:Y)},[e.theaterId,H,Z,n.branches.length,n.tags.length,$.length,t]),v.useEffect(()=>{o?.(b!==null)},[o,b]),v.useEffect(()=>()=>A.current?.(),[]);const K=v.useCallback((E,G)=>{const Y=E==="base"?G:u,re=E==="head"?G:p;E==="base"?h(G):f(G),e.theaterId&&mY(e.theaterId,t,Y,re)},[u,e.theaterId,p,t]),M=v.useCallback(()=>{if(!e.theaterId||!u||!p||u===p)return;const E=++R.current;S(null),_({kind:"loading"}),fetch("/plugins/repository/compare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,base:u,head:p})}).then(async G=>{if(E!==R.current)return;if(!G.ok){const re=await G.json();if(E!==R.current)return;const he=re.error??"git_failed";_(he==="no_git_repo"||he==="git_unavailable"?{kind:"notice",reason:he}:{kind:"error",message:he});return}const Y=await G.json();E===R.current&&_({kind:"ok",base:u,head:p,files:Y.files,...Y.mergeBase?{mergeBase:Y.mergeBase}:{},...Y.truncated?{truncated:!0}:{}})}).catch(G=>{E===R.current&&_({kind:"error",message:G instanceof Error?G.message:"unknown"})})},[u,e.theaterId,p,t]),N=v.useCallback(E=>{E.preventDefault();const G=U.current;if(!G)return;const Y=G.getBoundingClientRect().width,re=E.clientX,he=z.current;A.current?.(),I(!0),A.current=C1({documentTarget:document,windowTarget:window,onMove:ae=>{const Re=OL({startWidth:he,dx:ae.clientX-re,containerWidth:Y,listPaneMinWidth:fY,hunkPaneMinWidth:x1,dividerWidth:vr});Re!==null&&(z.current=Re,C(Re))},onFinish:()=>{I(!1),A.current=null}})},[]),D=v.useMemo(()=>{const E=[];J&&E.push({value:"HEAD",label:"HEAD"});for(const G of n.branches)E.push({value:G.ref,label:`LOCAL · ${G.label}`});for(const G of $)E.push({value:G.ref,label:`REMOTES · ${G.label}`});for(const G of n.tags)E.push({value:G.ref,label:`TAGS · ${G.label}`});return E},[n.branches,n.tags,$,J]),j=v.useMemo(()=>[{value:"",label:"Select base…",disabled:!0},...D],[D]),T=(E,G)=>c.jsx(Ri,{label:E==="base"?"Base ref":"Head ref",value:G,options:E==="base"?j:D,onChange:Y=>K(E,Y)}),B=u!==""&&p!==""&&u!==p,L=g.kind==="ok"?g.base:null,F=g.kind==="ok"?g.head:null,W=v.useMemo(()=>L&&F&&e.theaterId?{base:L,head:F,theaterId:e.theaterId,repoRel:t}:null,[L,F,e.theaterId,t]);return c.jsxs("div",{className:"repository-compare",children:[i?c.jsxs("div",{className:"history-error",children:["Unable to load refs",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:r,children:"Retry"})]}):c.jsxs("div",{className:"repository-compare-controls",children:[T("base",u),c.jsx("span",{className:"repository-compare-arrow","aria-hidden":"true",children:"…"}),T("head",p),c.jsx("button",{type:"button",className:"repository-refresh-btn repository-compare-run",disabled:!B,onClick:M,children:"Compare"})]}),c.jsxs("div",{ref:U,className:`repository-root${b?" has-hunk":""}${x?" is-dragging":""}`,style:b?{gridTemplateColumns:DL(w)}:void 0,children:[b&&W?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:b.path}),c.jsx("button",{type:"button",onClick:()=>S(null),children:"✕"})]}),c.jsx(w1,{ctx:e,repoRel:t,file:b,mode:"unified",compare:W})]}):null,b?c.jsx("div",{className:"repository-divider",onPointerDown:N,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane repository-compare-results",children:[g.kind==="idle"&&c.jsx("div",{className:"history-empty",children:"Select base and head refs, then run Compare."}),g.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Comparing…"}),g.kind==="ok"&&g.files.length===0&&c.jsx("div",{className:"history-empty",children:"No differences between the selected refs."}),g.kind==="error"&&g.message==="no_merge_base"&&c.jsx("div",{className:"history-empty",children:"The selected refs share no common history."}),(g.kind==="notice"||g.kind==="error"&&g.message!=="no_merge_base"||g.kind==="ok"&&g.files.length>0)&&c.jsxs(c.Fragment,{children:[g.kind==="ok"&&g.mergeBase&&c.jsxs("div",{className:"repository-compare-meta",children:["merge-base ",c.jsx("span",{children:g.mergeBase})]}),c.jsx(RL,{state:g.kind==="ok"?{kind:"ok",files:g.files}:g,onRetry:M,viewMode:"list",selectedPath:b?.path??null,onSelect:S,filterText:""}),g.kind==="ok"&&g.truncated&&c.jsx("div",{className:"history-truncated",children:"Comparison capped — file list truncated."})]})]})]})]})}function jE(e,t){const n=Array.from(e.toLowerCase()),i=Array.from(t),r=[];let o=0;for(const u of n){let h=-1;for(let p=o;p<i.length;p+=1)if(i[p].toLowerCase()===u){h=p;break}if(h<0)return null;r.push(h),o=h+1}return r}function PL(){return Object.create(null)}function OE(){return{dirs:PL(),repos:[]}}function _Y(e){const t=OE();for(const n of e){const i=n.relPath.replaceAll("\\","/").split("/").filter(o=>o.length>0);if(i.length===0)continue;i.pop();let r=t;for(const o of i)r.dirs[o]||(r.dirs[o]=OE()),r=r.dirs[o];r.repos.push(n)}return $L(t),t}function $L(e){e.repos.sort((n,i)=>n.name.localeCompare(i.name));const t=Object.entries(e.dirs).sort(([n],[i])=>n.localeCompare(i));e.dirs=PL();for(const[n,i]of t)$L(i),e.dirs[n]=i}function vY(e,t){let n=e,i=t;for(;Object.keys(i.dirs).length===1&&i.repos.length===0;){const r=Object.keys(i.dirs)[0];n+="/"+r,i=i.dirs[r]}return{label:n,node:i}}function zL(e){let t=e.repos.length;for(const n of Object.values(e.dirs))t+=zL(n);return t}const Ab=new Set;let k1={file:null};function HL(){for(const e of Ab)e()}function yY(e){return Ab.add(e),()=>{Ab.delete(e)}}function DE(){return k1}function bY(e,t){const n=v.useSyncExternalStore(yY,DE,DE);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function SY(e,t,n){k1={file:{entry:e,theaterId:t,repoRel:n}},HL()}function _v(){k1={file:null},HL()}const Rb=12,Ol=28,vv=3,wY=5,IE=["var(--id-cerulean)","var(--id-plum)","var(--id-amber)","var(--id-teal)","var(--id-moss)","var(--id-indigo)","var(--id-rose)","var(--id-crimson)"];function Pu(e){return e*Rb+6}function Co(e){return IE[e%IE.length]??"var(--ink-fog)"}function xY({node:e}){const t=Math.max(e.activeLaneCount,1),n=e.collapsed?10:0,i=t*Rb+n,r=Pu(e.lane),o=Ol/2;return c.jsxs("svg",{width:i,height:Ol,viewBox:`0 0 ${i} ${Ol}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(u=>c.jsx("line",{x1:Pu(u),y1:0,x2:Pu(u),y2:Ol,stroke:Co(u),strokeWidth:1.5},`pt-${u}`)),e.connectAbove&&c.jsx("line",{x1:r,y1:0,x2:r,y2:o-vv,stroke:Co(e.lane),strokeWidth:1.5}),e.connectBelow&&c.jsx("line",{x1:r,y1:o+vv,x2:r,y2:Ol,stroke:Co(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(u=>c.jsx("line",{x1:Pu(u),y1:0,x2:r,y2:o,stroke:Co(u),strokeWidth:1.5,strokeLinecap:"round"},`mf-${u}`)),e.branchToLanes.map(u=>c.jsx("line",{x1:r,y1:o,x2:Pu(u),y2:Ol,stroke:Co(u),strokeWidth:1.5,strokeLinecap:"round"},`bt-${u}`)),e.isHead&&c.jsx("circle",{cx:r,cy:o,r:wY,fill:"none",stroke:Co(e.lane),strokeWidth:1.5}),c.jsx("circle",{cx:r,cy:o,r:vv,fill:Co(e.lane)}),e.collapsed&&c.jsx("text",{x:t*Rb+2,y:o+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const yv=8;function CY(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,r=0;for(let o=0;o<e.length;o++){const u=e[o],h=u.fullHash,p=[...u.parents],f=[];for(let x=0;x<t.length;x++)t[x]===h&&f.push(x);let g,_=!1;const b=[];if(f.length===0){const x=t.indexOf(null);x>=0?g=x:t.length<yv?(g=t.length,t.push(null)):(i=!0,g=yv-1,t[g]=null,_=!0)}else{g=Math.min(...f);for(const x of f)x!==g&&(b.push(x),t[x]=null)}const S=[];if(p.length===0)t[g]=null;else{t[g]=_?null:p[0]??null;for(const x of p.slice(1))if(!(t.indexOf(x)>=0)){const z=t.indexOf(null);if(z>=0)t[z]=x,S.push(z);else if(t.length<yv){const U=t.length;t.push(x),S.push(U)}else i=!0}}const w=t.map((x,I)=>({h:x,i:I})).filter(({h:x,i:I})=>x!==null&&I!==g).map(({i:x})=>x),C=Math.max(g,...w,...b,...S);r=Math.max(r,C),n.push({lane:g,activeLaneCount:C+1,collapsed:i,isHead:u.refs.some(x=>x==="HEAD"||x.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:p.length>0&&t[g]===p[0],passThroughLanes:w,mergeFromLanes:b,branchToLanes:S})}return{nodes:n,activeLaneCount:r+1,collapsed:i}}function FL(e,t=new Date){const n=new Date(e*1e3);if(!Number.isFinite(n.getTime()))return"—";const i=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),o=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),u=Math.round((r-o)/864e5);return u===0?`Today ${i}`:u===1?`Yesterday ${i}`:`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function E1(e){const t=[];for(const n of e.refs)if(n==="HEAD")t.push({label:"HEAD",kind:"head"});else if(n.startsWith("HEAD -> refs/heads/"))t.push({label:n.slice(19),kind:"branch"});else if(n.startsWith("HEAD -> "))t.push({label:n.slice(8),kind:"branch"});else if(n.startsWith("tag: refs/tags/"))t.push({label:n.slice(15),kind:"tag"});else if(n.startsWith("tag: "))t.push({label:n.slice(5),kind:"tag"});else if(n.startsWith("refs/remotes/")){const i=n.slice(13);i.endsWith("/HEAD")||t.push({label:i,kind:"remote"})}else n.startsWith("refs/worktrees/")?t.push({label:n.slice(15),kind:"worktree"}):n.startsWith("refs/heads/")?t.push({label:n.slice(11),kind:"branch"}):t.push({label:n,kind:"branch"});return t}const UL="fleet-console.history.logHeight",BE="fleet-console.history.headerHeight",PE="fleet-console.history.fileListWidth",WL="fleet-console.history.filesView",kY=240,EY=214,TY=180;function AY(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function RY(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.subject.toLowerCase().includes(n)||i.authorName.toLowerCase().includes(n)||i.shortHash.toLowerCase().includes(n)||i.fullHash.toLowerCase().includes(n)||i.refs.some(r=>r.toLowerCase().includes(n))||E1(i).some(r=>r.label.toLowerCase().includes(n))):e}function NY(e){return e==="Escape"}function LY(e){return e.reduce((t,n)=>({files:t.files+1,additions:t.additions+n.additions,deletions:t.deletions+n.deletions}),{files:0,additions:0,deletions:0})}function MY(e,t,n){return e.files>0&&!t&&!n}function $E({current:e}){return e?c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2"})})}function jY({entry:e,checkouts:t,selected:n,graphNode:i,onSelect:r}){const o=E1(e),u=AY(e,t);return c.jsxs("button",{type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>r(e),children:[c.jsx("span",{className:"history-commit-subject",children:e.subject}),c.jsx("span",{className:"history-commit-sha",children:e.shortHash}),c.jsx("span",{className:"history-commit-time",children:FL(e.authorAt)}),c.jsxs("span",{className:"history-commit-badges",children:[o.map(h=>{const p=h.kind==="branch"?t.find(f=>f.branch===h.label):null;return c.jsxs("span",{className:`history-badge history-badge--${h.kind}`,children:[p&&c.jsx($E,{current:p.isCurrent}),h.label]},`${h.kind}:${h.label}`)}),u&&c.jsxs("span",{className:"history-badge history-badge--worktree",children:[c.jsx($E,{current:u.isCurrent}),"detached"]})]}),c.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:c.jsx(xY,{node:i})})]})}function OY({ctx:e,repoRel:t,target:n,onSelectCommit:i,onClose:r}){const[o,u]=v.useState({kind:"loading"}),[h,p]=v.useState("details"),[f,g]=v.useState(null),[_,b]=v.useState(!1),[S,w]=v.useState(()=>Nb(BE,EY)),[C,x]=v.useState(()=>Nb(PE,TY)),[I,z]=v.useState($Y),U=v.useRef(null),A=v.useRef(null),O=v.useRef(null),R=v.useRef(S),$=v.useRef(C),H=v.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);v.useEffect(()=>{let K=!1;return u({kind:"loading"}),e.api.fetch("repository","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,ref:n.fullHash})}).then(async M=>{if(!M.ok)throw new Error((await M.json()).error??"git_failed");return M.json()}).then(M=>{K||(u({kind:"ok",result:M}),g(M.files[0]?.path??null))}).catch(M=>{K||u({kind:"error",message:M instanceof Error?M.message:"unknown"})}),()=>{K=!0}},[e.api,e.theaterId,t,n.fullHash]),v.useEffect(()=>()=>O.current?.(),[]);const J=v.useCallback((K,M)=>{K.preventDefault();const N=M==="y"?U.current:A.current;if(!N)return;const D=M==="y"?R.current:$.current,j=M==="y"?K.clientY:K.clientX,T=M==="y"?N.getBoundingClientRect().height:N.getBoundingClientRect().width;O.current?.(),O.current=C1({documentTarget:document,windowTarget:window,onMove:B=>{const L=B,F=IL(D,(M==="y"?L.clientY:L.clientX)-j,T,120,120);F!==null&&(M==="y"?(R.current=F,w(F)):($.current=F,x(F)))},onFinish:()=>{const B=M==="y"?R.current:$.current;try{localStorage.setItem(M==="y"?BE:PE,String(B))}catch{}O.current=null}})},[]),Z=o.kind==="loading"?c.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):o.kind==="error"?c.jsx("div",{className:"history-inspector-empty history-inspector-error",children:o.message}):(()=>{const{meta:K,files:M}=o.result,N=M.find(W=>W.path===f)??M[0]??null,D=M.reduce((W,E)=>W+E.additions,0),j=M.reduce((W,E)=>W+E.deletions,0),T=n.entry,B=(W,E)=>{g(W.path),E&&p("changes")},L=W=>{z(W);try{localStorage.setItem(WL,W)}catch{}},F=()=>{const W=navigator.clipboard?.writeText(n.fullHash);W&&W.then(()=>{b(!0),window.setTimeout(()=>b(!1),1200)}).catch(()=>{})};return h==="details"?c.jsxs("div",{ref:U,className:"history-details-tab",style:{gridTemplateRows:cY(S)},children:[c.jsx(DY,{meta:K,entry:T,fullHash:n.fullHash,copied:_,onCopy:F,onParent:W=>i({fullHash:W})}),c.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:W=>J(W,"y")}),c.jsx(zE,{files:M,selectedPath:f,additions:D,deletions:j,viewMode:I,onViewMode:L,onSelect:W=>B(W,!0)})]}):c.jsx("div",{className:"history-changes-tab",children:c.jsxs("div",{ref:A,className:"history-changes-columns",style:{gridTemplateColumns:uY(C)},children:[c.jsx(zE,{files:M,selectedPath:f,additions:D,deletions:j,viewMode:I,onViewMode:L,onSelect:W=>B(W,!1)}),c.jsx("div",{className:"history-divider",onPointerDown:W=>J(W,"x")}),N?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:N.path,children:N.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":"Previous file",disabled:M.indexOf(N)===0,onClick:()=>B(M[M.indexOf(N)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":"Next file",disabled:M.indexOf(N)===M.length-1,onClick:()=>B(M[M.indexOf(N)+1],!1),children:"›"})]})]}),c.jsx(w1,{ctx:e,repoRel:t,file:N,mode:"unified",commit:H})]}):c.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return c.jsxs("div",{className:"history-inspector",onKeyDown:K=>{NY(K.key)&&(K.preventDefault(),r())},children:[c.jsxs("div",{className:"history-segmented",children:[c.jsx("button",{type:"button","aria-pressed":h==="details",onClick:()=>p("details"),children:"Details"}),c.jsxs("button",{type:"button","aria-pressed":h==="changes",onClick:()=>p("changes"),children:["Changes ",o.kind==="ok"&&c.jsx("span",{children:o.result.files.length})]}),c.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:r,children:"✕"})]}),Z]})}function DY({meta:e,entry:t,fullHash:n,copied:i,onCopy:r,onParent:o}){return c.jsxs("div",{className:"history-inspector-head",children:[c.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&c.jsx("pre",{className:"history-inspector-message",children:e.body}),c.jsxs("div",{className:"history-author",children:[c.jsx("span",{className:"history-avatar",children:zY(e.authorName)}),c.jsxs("span",{children:[c.jsx("b",{children:e.authorName}),c.jsx("small",{children:e.authorEmail})]}),c.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??FL(e.authorAt)})]}),c.jsxs("div",{className:"history-inspector-ids",children:[c.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:r,children:[n,c.jsx("span",{children:i?"copied":"copy"})]}),e.parents.map(u=>c.jsxs("button",{type:"button",className:"history-parent",onClick:()=>o(u.full),children:["parent ",u.short]},u.full))]}),t&&c.jsx("div",{className:"history-ref-chips",children:E1(t).map(u=>c.jsx("span",{className:`history-badge history-badge--${u.kind}`,children:u.label},`${u.kind}:${u.label}`))})]})}function zE({files:e,selectedPath:t,additions:n,deletions:i,viewMode:r,onViewMode:o,onSelect:u}){return c.jsxs("section",{className:"history-commit-files",children:[c.jsxs("div",{className:"history-files-title",children:[c.jsx("span",{className:"history-files-label",children:"Changed files"}),c.jsxs("span",{className:"history-files-stats",children:[e.length," ",c.jsxs("i",{children:["+",n]})," ",c.jsxs("em",{children:["−",i]})]}),c.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":r==="list",onClick:()=>o("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${r==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":r==="tree",onClick:()=>o("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx("div",{className:"history-files-scroll",children:r==="tree"?c.jsx(TL,{files:e,selectedPath:t,onSelect:u}):e.map(h=>c.jsx(NL,{entry:h,isSelected:h.path===t,onSelect:u},h.path))})]})}function IY({ctx:e,repoRel:t,active:n=!0,refFilter:i=null,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:h}){return c.jsx(BY,{ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:h},`${e.theaterId??""}:${t}`)}function BY({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:r,onInspectorOpenChange:o,onClearRef:u,onWip:h}){const[p,f]=v.useState({kind:"loading"}),[g,_]=v.useState(null),[b,S]=v.useState(""),[w,C]=v.useState(0),[x,I]=v.useState(PY),[z,U]=v.useState(!1),A=v.useRef(null),O=v.useRef(null),R=v.useRef(x);v.useEffect(()=>{_(null)},[i]);const[$,H]=v.useState(n);v.useEffect(()=>{n&&H(!0)},[n]),v.useEffect(()=>{if(!$)return;if(!e.theaterId){f({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let D=!1;return f({kind:"loading"}),e.api.fetch("repository","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,...i?{ref:i}:{}})}).then(async j=>{if(!j.ok)throw new Error((await j.json()).error??"git_failed");return j.json()}).then(j=>{D||f({kind:"ok",commits:j.commits,checkouts:j.checkouts,truncated:j.truncated??!1})}).catch(j=>{D||f({kind:"error",message:j instanceof Error?j.message:"unknown"})}),()=>{D=!0}},[e.api,e.theaterId,$,w,i,t]),v.useEffect(()=>{o?.(n&&g!==null)},[n,o,g]),v.useEffect(()=>()=>O.current?.(),[]);const J=v.useCallback(D=>{D.preventDefault();const j=A.current;if(!j)return;const T=R.current,B=D.clientY,L=j.getBoundingClientRect().height;O.current?.(),U(!0),O.current=C1({documentTarget:document,windowTarget:window,onMove:F=>{const W=IL(T,F.clientY-B,L,LL,ML,vr);W!==null&&(R.current=W,I(W))},onFinish:()=>{try{localStorage.setItem(UL,String(R.current))}catch{}U(!1),O.current=null}})},[]),Z=v.useMemo(()=>p.kind==="ok"?RY(p.commits,b):[],[b,p]),K=p.kind==="ok"?CY(Z):null,M=v.useMemo(()=>LY(r),[r]),N=MY(M,b,i);return c.jsxs("div",{ref:A,className:`history-root${z?" is-dragging":""}`,style:g?{gridTemplateRows:lY(x)}:void 0,children:[c.jsxs("div",{className:"history-list-pane",children:[c.jsxs("div",{className:"history-toolbar",children:[c.jsxs("div",{className:"history-filter",children:[c.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:b,onChange:D=>S(D.target.value)}),b&&c.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>S(""),children:"✕"})]}),i&&c.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:u,children:[i," ✕"]}),p.kind==="ok"&&c.jsx("span",{className:"history-count",children:b?`${Z.length}/${p.commits.length}`:p.commits.length})]}),c.jsxs("div",{className:"history-list",children:[N&&c.jsxs("button",{type:"button",className:"repository-wip-row",onClick:h,children:["Uncommitted changes ",c.jsxs("span",{children:[M.files," files · +",M.additions," −",M.deletions]})]}),p.kind==="loading"&&c.jsx("div",{className:"history-empty",children:"Loading…"}),p.kind==="error"&&c.jsxs("div",{className:"history-error",children:[p.message,c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>C(D=>D+1),children:"Retry"})]}),p.kind==="ok"&&p.commits.length===0&&c.jsx("div",{className:"history-empty",children:"No history"}),p.kind==="ok"&&p.commits.length>0&&Z.length===0&&c.jsx("div",{className:"history-empty",children:"No matching items"}),p.kind==="ok"&&K&&Z.map((D,j)=>c.jsx(jY,{entry:D,checkouts:p.checkouts,selected:g?.fullHash===D.fullHash,graphNode:K.nodes[j],onSelect:T=>_({fullHash:T.fullHash,entry:T})},D.fullHash)),p.kind==="ok"&&(p.truncated||p.commits.length>=200)&&c.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),g&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":"Resize commit log",onPointerDown:J}),c.jsx("div",{className:"history-detail-pane",children:c.jsx(OY,{ctx:e,repoRel:t,target:g,onSelectCommit:_,onClose:()=>_(null)})})]})]})}function PY(){return Nb(UL,kY,LL)}function $Y(){try{const e=localStorage.getItem(WL);if(e==="list"||e==="tree")return e}catch{}return"list"}function Nb(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function zY(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const qL="fleet-console.diff.viewMode",GL="fleet-console.diff.listPaneWidth",KL="fleet-console.repository.source",rm="fleet-console.repository.repo.",VL="fleet-console.repository.scanDepth",YL=1,XL=8,HY=3,FY=400,UY=248,ZL=220;function WY(){try{const e=localStorage.getItem(qL);if(e==="list"||e==="tree")return e}catch{}return"list"}function qY(){try{const e=localStorage.getItem(KL);if(e==="repositories"||e==="worktrees"||e==="changes"||e==="history"||e==="compare"||e==="branches"||e==="tags"||e==="stashes")return e}catch{}return"changes"}function GY(e){try{return localStorage.getItem(`${rm}${e}`)??""}catch{return""}}function KY(e,t,n){try{const i=`${rm}${e}`,r=localStorage.getItem(i);if(r===null)return"";if(t.some(o=>o.relPath===r)||n.some(o=>o.relPath===r))return r;localStorage.removeItem(i)}catch{}return""}function VY(){try{const e=Number.parseInt(localStorage.getItem(VL)??"",10);if(Number.isInteger(e)&&e>=YL&&e<=XL)return e}catch{}return HY}function YY(e){try{localStorage.setItem(VL,String(e))}catch{}}function XY(e,t){try{localStorage.setItem(`${rm}${e}`,t)}catch{}}function ZY(e){try{localStorage.removeItem(`${rm}${e}`)}catch{}}function JY(e){try{localStorage.setItem(KL,e)}catch{}}function QY(){try{const e=localStorage.getItem(GL),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(ZL,t)}catch{}return UY}function eX(e){return e.entry.status==="U"?"untracked":"unified"}function tX({ctx:e}){return c.jsx(sX,{ctx:e},e.theaterId)}function nX(e,t,n){return!e||n===t?{transition:!1,landing:"history"}:{transition:!0,landing:"history"}}function T1(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function iX(e,t){const n=(i,r)=>i.map(o=>({key:o.ref,source:r,primary:o.label,ref:o.ref,current:o.current}));return e==="branches"?[{label:"LOCAL",rows:n(t.branches,"branches")},{label:"REMOTES",rows:n(t.remotes.filter(i=>!T1(i.ref)),"branches")}]:e==="tags"?[{rows:n(t.tags,"tags")}]:[{rows:t.stashes.map(i=>({key:i.name,source:e,primary:i.subject||i.name,sub:i.name,ref:null,current:!1}))}]}function sX({ctx:e}){const[t,n]=v.useState([]),[i,r]=v.useState(!1),[o,u]=v.useState(0),[h,p]=v.useState(!1),[f,g]=v.useState(VY),_=v.useCallback(xe=>{g(xe),YY(xe)},[]),[b,S]=v.useState(!1),[w,C]=v.useState([]),[x,I]=v.useState(!1),[z,U]=v.useState(0),[A,O]=v.useState(null),[R,$]=v.useState(()=>e.theaterId?GY(e.theaterId):""),H=v.useRef(R),[J,Z]=v.useState(qY),[K,M]=v.useState(null),[N,D]=v.useState({branches:[],remotes:[],tags:[],stashes:[]}),[j,T]=v.useState(!1),[B,L]=v.useState(0),[F,W]=v.useState({kind:"loading"}),[E,G]=v.useState(0),[Y,re]=v.useState(!1),[he,ae]=v.useState(!1),[ke,Re]=v.useState(WY),[De,Ue]=v.useState(""),[Oe,Le]=v.useState(0),we=bY(e.theaterId??null,R),[Ie,Qe]=v.useState(QY),dt=v.useRef(Ie),Je=v.useRef(null),[le,Ye]=v.useState(!1),Pe=v.useCallback(xe=>{Z(xe),JY(xe)},[]),At=v.useCallback((xe,it,ht="changes")=>{e.theaterId&&(it&&XY(e.theaterId,xe),_v(),M(null),Ue(""),re(!1),ae(!1),W({kind:"loading"}),D({branches:[],remotes:[],tags:[],stashes:[]}),H.current=xe,$(xe),Pe(ht))},[e.theaterId,Pe]);v.useEffect(()=>{if(!e.theaterId)return;let xe=!1;return r(!1),S(!1),e.api.fetch("repository","repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:f})}).then(it=>it.json()).then(it=>{xe||(n(it.repos),p(it.truncated===!0),S(!0))}).catch(()=>{xe||r(!0)}),()=>{xe=!0}},[e.api,e.theaterId,o,f]),v.useEffect(()=>{if(!e.theaterId)return;let xe=!1;const it=R;return C([]),I(!1),O(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:it})}).then(ht=>ht.json()).then(ht=>{xe||(C(ht.worktrees),O(it))}).catch(ht=>{if(xe)return;if((typeof ht=="object"&&ht!==null&&"status"in ht?ht.status:null)===400&&it!==""){ZY(e.theaterId),At("",!1);return}I(!0)}),()=>{xe=!0}},[e.api,e.theaterId,R,At,z]),v.useEffect(()=>{if(!e.theaterId||!b||A!==R)return;const xe=KY(e.theaterId,t,w);xe!==H.current&&At(xe,!1)},[e.theaterId,R,t,b,At,w,A]),v.useEffect(()=>{if(!e.theaterId)return;let xe=!1;return D({branches:[],remotes:[],tags:[],stashes:[]}),T(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:R})}).then(it=>it.ok?it.json():Promise.reject()).then(it=>{xe||D(it)}).catch(()=>{xe||T(!0)}),()=>{xe=!0}},[e.api,e.theaterId,R,B]),v.useEffect(()=>{if(!e.theaterId){W({kind:"error",message:"no_theater"});return}let xe=!1;return W({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:R})}).then(async it=>{if(!it.ok){const Ct=(await it.json()).error??"git_failed";xe||W(Ct==="no_git_repo"||Ct==="git_unavailable"?{kind:"notice",reason:Ct}:{kind:"error",message:Ct});return}const ht=await it.json();xe||W({kind:"ok",files:ht.files})}).catch(it=>{xe||W({kind:"error",message:it instanceof Error?it.message:"unknown"})}),()=>{xe=!0}},[E,e.theaterId,R]),v.useLayoutEffect(()=>()=>_v(),[]);const Zt=v.useCallback(xe=>{e.theaterId&&SY(xe,e.theaterId,R)},[e.theaterId,R]),fn=v.useCallback(xe=>{const it=nX(e.theaterId,R,xe.relPath);if(!it.transition){M(null),Le(ht=>ht+1),Pe(it.landing);return}At(xe.relPath,!0,it.landing)},[e.theaterId,R,Pe,At]),wt=v.useCallback(()=>_v(),[]),Kt=v.useCallback(xe=>{Re(xe);try{localStorage.setItem(qL,xe)}catch{}},[]),xt=v.useCallback(xe=>{xe.preventDefault();const it=Je.current;if(!it)return;const ht=it.getBoundingClientRect().width,Dt=xe.clientX,Ct=dt.current;Ye(!0);const Bt=se=>{const me=OL({startWidth:Ct,dx:se.clientX-Dt,containerWidth:ht,listPaneMinWidth:ZL,hunkPaneMinWidth:x1,dividerWidth:vr});me!==null&&(dt.current=me,Qe(me))},Ni=()=>{document.removeEventListener("pointermove",Bt),document.removeEventListener("pointerup",Ni),Ye(!1);try{localStorage.setItem(GL,String(dt.current))}catch{}};document.addEventListener("pointermove",Bt),document.addEventListener("pointerup",Ni)},[]);v.useLayoutEffect(()=>(e.requestExtraWidth?.(J==="changes"&&we||J==="history"&&Y||J==="compare"&&he?FY:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,we,J,Y,he]);const Se=we?eX(we):null,We=v.useCallback(()=>G(xe=>xe+1),[]),xn=F.kind==="ok"?F.files:[],$e=t.find(xe=>xe.relPath===R)??w.find(xe=>xe.relPath===R);return c.jsxs("div",{className:"repository-unified",children:[c.jsxs("div",{className:`repository-identity${R?" is-subcontext":""}`,children:[c.jsx(QL,{}),c.jsx("strong",{children:$e?.name??"Repository"}),$e?.branch&&c.jsx("span",{children:$e.branch})]}),c.jsxs("div",{className:"repository-unified-body",children:[c.jsx(rX,{source:J,refs:N,repos:t,worktrees:w,onSource:Pe}),c.jsxs("div",{className:"repository-source-content",children:[J==="repositories"?i?c.jsxs("div",{className:"history-error",children:["Unable to load repositories",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>u(xe=>xe+1),children:"Retry"})]}):c.jsx(aX,{repos:t,selectedRel:R,onRepository:fn,scanDepth:f,onScanDepth:_,truncated:h}):null,J==="worktrees"?x?c.jsxs("div",{className:"history-error",children:["Unable to load worktrees",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>U(xe=>xe+1),children:"Retry"})]}):c.jsx(lX,{worktrees:w,onWorktree:fn}):null,c.jsx("div",{className:"repository-source-fill",hidden:J!=="history",children:c.jsx(IY,{ctx:e,repoRel:R,active:J==="history",refFilter:K,wipFiles:xn,onInspectorOpenChange:re,onClearRef:()=>M(null),onWip:()=>Pe("changes")},`${e.theaterId??""}:${R}:${Oe}`)}),c.jsx("div",{className:"repository-source-fill",hidden:J!=="compare",children:c.jsx(gY,{ctx:e,repoRel:R,refs:N,refsError:j,onRetryRefs:()=>L(xe=>xe+1),onFileOpenChange:ae},`${e.theaterId??""}:${R}`)}),J!=="repositories"&&J!=="worktrees"&&J!=="changes"&&J!=="history"&&J!=="compare"?j?c.jsxs("div",{className:"history-error",children:["Unable to load refs",c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>L(xe=>xe+1),children:"Retry"})]}):c.jsx(cX,{source:J,refs:N,onRef:xe=>{M(xe),Pe("history")}}):null,c.jsxs("div",{hidden:J!=="changes",ref:Je,className:`repository-root${we?" has-hunk":""}${le?" is-dragging":""}`,style:we?{gridTemplateColumns:DL(Ie)}:void 0,children:[we&&Se?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:we.entry.path}),c.jsx("button",{type:"button",onClick:wt,children:"✕"})]}),c.jsx(w1,{ctx:e,repoRel:R,file:we.entry,mode:Se})]}):null,we?c.jsx("div",{className:"repository-divider",onPointerDown:xt,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane",children:[c.jsxs("div",{className:"repository-toolbar",children:[c.jsxs("div",{className:"repository-filter",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:De,onChange:xe=>Ue(xe.target.value)}),De?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear filter",onClick:()=>Ue(""),children:"✕"}):null]}),c.jsxs("div",{className:"repository-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${ke==="list"?" is-active":""}`,title:"List view","aria-pressed":ke==="list",onClick:()=>Kt("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${ke==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":ke==="tree",onClick:()=>Kt("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx(RL,{state:F,onRetry:We,viewMode:ke,selectedPath:we?.entry.path??null,onSelect:Zt,filterText:De})]})]})]})]})]})}function am({source:e}){const t=e==="repositories"?"M3 5h12v9H3zM5 3h8v2":e==="worktrees"?"M5 3v12M5 6h7M5 12h7":e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="compare"?"M5.5 3v9M3 9.5l2.5 2.5L8 9.5M12.5 15V6M10 8.5L12.5 6L15 8.5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":"M4 5h10v9H4zM6 3h6";return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function rX({source:e,refs:t,repos:n,worktrees:i,onSource:r}){const o=(u,h,p)=>c.jsxs("button",{type:"button","aria-label":h,"aria-current":e===u?"page":void 0,onClick:()=>r(u),children:[c.jsx(am,{source:u}),c.jsx("span",{children:h}),p!==void 0&&c.jsx("i",{children:p})]},u);return c.jsxs("nav",{className:"repository-source-nav","aria-label":"Repository sources",children:[c.jsx("b",{children:"CONTEXT"}),o("repositories","Repositories",n.length),o("worktrees","Worktrees",i.length),c.jsx("b",{children:"WORKING"}),o("changes","Changes"),o("history","History"),o("compare","Compare"),c.jsx("b",{children:"REFS"}),o("branches","Branches",t.branches.length+t.remotes.filter(u=>!T1(u.ref)).length),o("tags","Tags",t.tags.length),o("stashes","Stashes",t.stashes.length)]})}function aX({repos:e,selectedRel:t,onRepository:n,scanDepth:i,onScanDepth:r,truncated:o}){const[u,h]=v.useState(""),p=e.filter(x=>x.kind==="root").sort((x,I)=>x.name.localeCompare(I.name)),f=e.filter(x=>x.kind==="nested"),g=_Y(f),_=x=>{const I=jE(u,x.name);return(I??jE(u,x.relPath))===null?null:{repo:x,nameMatch:I??void 0}},b=u?p.map(_).filter(x=>x!==null):[],S=u?f.map(_).filter(x=>x!==null):[],w=b.length+S.length,C=u?[...b.length>0?[{key:"root",label:"THIS THEATER",render:()=>c.jsx(c.Fragment,{children:b.map(({repo:x,nameMatch:I})=>c.jsx(Wf,{repo:x,depth:0,selectedRel:t,onRepository:n,nameMatch:I},x.relPath))})}]:[],...S.length>0?[{key:"nested",label:"NESTED",render:()=>c.jsx(c.Fragment,{children:S.map(({repo:x,nameMatch:I})=>c.jsx(Wf,{repo:x,depth:0,selectedRel:t,onRepository:n,nameMatch:I},x.relPath))})}]:[]]:[...p.length>0?[{key:"root",label:"THIS THEATER",render:()=>c.jsx(c.Fragment,{children:p.map(x=>c.jsx(Wf,{repo:x,depth:0,selectedRel:t,onRepository:n},x.relPath))})}]:[],...f.length>0?[{key:"nested",label:"NESTED",render:()=>c.jsx(JL,{node:g,depth:0,selectedRel:t,onRepository:n})}]:[]];return c.jsxs("div",{className:"repository-scan-pane",children:[c.jsxs("div",{className:"repository-discovery",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:"Find repositories…","aria-label":"Find repositories",value:u,onChange:x=>h(x.target.value),onKeyDown:x=>{if(x.key!=="Enter"||x.nativeEvent.isComposing)return;const I=b[0]??S[0];I&&n(I.repo)}}),u?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":"Clear search",onClick:()=>h(""),children:"✕"}):null,c.jsxs("span",{className:"repository-discovery-depth",children:["Depth",c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":"Scan shallower",disabled:i<=YL,onClick:()=>r(i-1),children:"−"}),c.jsx("output",{className:"repository-depth-value",children:i}),c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":"Scan deeper",disabled:i>=XL,onClick:()=>r(i+1),children:"+"})]}),c.jsx("span",{className:"repository-scan-count",children:u?`${w} of ${e.length}`:`${e.length} found${o?" · limit reached":""}`})]}),c.jsxs("div",{className:"repository-ref-list",children:[C.map(x=>c.jsxs("div",{className:"repository-ref-group",children:[c.jsx("b",{className:"repository-ref-group-label",children:x.label}),x.render()]},x.key)),u&&w===0?c.jsx("div",{className:"repository-empty-row",children:"No matching repositories"}):null]})]})}function JL({node:e,depth:t,selectedRel:n,onRepository:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([r,o])=>c.jsx(oX,{dirKey:r,node:o,depth:t,selectedRel:n,onRepository:i},r)),e.repos.map(r=>c.jsx(Wf,{repo:r,depth:t,selectedRel:n,onRepository:i},r.relPath))]})}function oX({dirKey:e,node:t,depth:n,selectedRel:i,onRepository:r}){const[o,u]=v.useState(!1),h=v.useCallback(()=>u(b=>!b),[]),{label:p,node:f}=vY(e,t),g=n*16+12,_=zL(f);return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${g}px`,gridTemplateColumns:"12px 15px 1fr auto"},onClick:h,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-folder-name",children:p}),c.jsx("span",{className:"repository-folder-count",children:_})]}),!o&&c.jsx(JL,{node:f,depth:n+1,selectedRel:i,onRepository:r})]})}function Wf({repo:e,depth:t,selectedRel:n,onRepository:i,nameMatch:r}){const o=t*16+30;return c.jsxs("button",{type:"button",title:e.relPath,className:`repository-ref-row${e.relPath===n?" is-current":""}`,style:{paddingLeft:`${o}px`},onClick:()=>i(e),children:[c.jsx(am,{source:"repositories"}),c.jsx("span",{className:"repository-ref-name",children:r?Array.from(e.name).map((u,h)=>r.includes(h)?c.jsx("b",{className:"repository-ref-hl",children:u},h):u):e.name}),e.relPath===n&&c.jsx("span",{className:"repository-ref-mark",children:"✓"}),e.branch&&c.jsx("span",{className:"repository-ref-sub",children:e.branch})]})}function lX({worktrees:e,onWorktree:t}){return c.jsx("div",{className:"repository-ref-list",children:e.map(n=>c.jsxs("button",{type:"button",title:n.relPath,className:`repository-ref-row${n.current?" is-current":""}`,onClick:()=>t(n),children:[c.jsx(am,{source:"worktrees"}),c.jsx("span",{className:"repository-ref-name",children:n.name}),n.current&&c.jsx("span",{className:"repository-ref-mark",children:"✓"}),n.branch&&c.jsx("span",{className:"repository-ref-sub",children:n.branch})]},n.relPath))})}function cX({source:e,refs:t,onRef:n}){return e==="repositories"||e==="worktrees"||e==="changes"||e==="history"||e==="compare"?null:c.jsx("div",{className:"repository-ref-list",children:iX(e,t).map(i=>c.jsxs("div",{className:"repository-ref-group",children:[i.label&&c.jsx("b",{className:"repository-ref-group-label",children:i.label}),i.rows.map(r=>c.jsxs("button",{type:"button",className:`repository-ref-row${r.current?" is-current":""}`,disabled:r.ref===null,onClick:()=>{r.ref&&n(r.ref)},children:[c.jsx(am,{source:r.source}),c.jsx("span",{className:"repository-ref-name",children:r.primary}),r.current&&c.jsx("span",{className:"repository-ref-mark",children:"✓"}),r.sub&&c.jsx("span",{className:"repository-ref-sub",children:r.sub})]},r.key))]},i.label??e))})}function QL(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),c.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const uX={id:"repository",title:"Repository",icon:()=>c.jsx(QL,{}),render:e=>c.jsx(tX,{ctx:e})},dX={id:"repository",railPanels:[uX]},hX=[dX],yf=["claude-code","codex","cursor","opencode"],fX={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},pX="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function mX({source:e,skill:t,theaterId:n,onCancel:i,onStarted:r,jobLog:o}){const[u,h]=v.useState(n?"project":"global"),[p,f]=v.useState(!0),[g,_]=v.useState(new Set(yf)),{status:b,start:S}=o,w=b==="running",C=b==="done",x=b==="error",I=v.useCallback(()=>{f(!0),_(new Set(yf))},[]),z=v.useCallback(A=>{f(!1),_(O=>{const R=new Set(O);return R.has(A)?R.delete(A):R.add(A),R})},[]),U=v.useCallback(()=>{const A=p?yf:Array.from(g);if(A.length===0)return;const O={source:e,skill:t,scope:u,agents:A};u==="project"&&n&&(O.theaterId=n),S("/plugins/skills/install",O),r(u)},[p,g,e,t,u,n,S,r]);return c.jsxs("div",{className:"skills-install-flow",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${u==="project"?" is-active":""}`,onClick:()=>h("project"),disabled:!n||w||C,title:n?void 0:"Select a Theater to install project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${u==="global"?" is-active":""}`,onClick:()=>h("global"),disabled:w||C,children:"Global"})]}),c.jsxs("div",{className:"skills-agents-row",children:[c.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:I,disabled:w||C,children:"All agents"}),yf.map(A=>c.jsx("button",{type:"button",className:`skills-agent-chip${!p&&g.has(A)?" is-active":""}`,onClick:()=>z(A),disabled:w||C,children:fX[A]},A))]}),c.jsx("p",{className:"skills-permission-warning",children:pX}),!w&&!C&&!x&&c.jsxs("div",{className:"skills-card-actions",children:[c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:"Cancel"}),c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:U,disabled:!p&&g.size===0,children:"Install now"})]})]})}const gX=4e3;function eM({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:r,onDismiss:o,onRetry:u}){const[h,p]=v.useState(!1),f=v.useRef(null),g=v.useRef(null);v.useEffect(()=>{e==="running"&&p(!1)},[e]),v.useEffect(()=>{const x=f.current;x&&(x.scrollTop=x.scrollHeight)},[t]),v.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{p(!1),o()},gX),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,o]);const _=v.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),p(!1),o()},[o]),b=v.useCallback(()=>p(x=>!x),[]);if(e==="idle")return null;const S=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",w=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",C=e==="running"?n:e==="done"?i:r;return c.jsxs("div",{className:"skills-dock",children:[h&&c.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((x,I)=>c.jsx("div",{className:"skills-dock-log-line",children:x},I)),e==="done"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",r]})]}),c.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${h?" is-open":""}`,"aria-expanded":h,onClick:b,onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),b())},children:[c.jsx("span",{className:S,"aria-hidden":"true"}),c.jsx("span",{className:w,"aria-live":"polite",children:C}),e==="running"&&t.length>0&&c.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:x=>{x.stopPropagation(),_()},children:"✕"}),e==="error"&&c.jsxs(c.Fragment,{children:[u!=null&&c.jsx("button",{type:"button",className:"skills-dock-retry",onClick:x=>{x.stopPropagation(),u()},children:"Retry"}),c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:x=>{x.stopPropagation(),_()},children:"✕"})]}),c.jsx("span",{className:`skills-dock-chevron${h?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const _X={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},Lb=new Set;let di=_X;function Ja(){for(const e of Lb)e()}function vX(e){return Lb.add(e),()=>{Lb.delete(e)}}function HE(){return di}function A1(){return v.useSyncExternalStore(vX,HE,HE)}function bf(e){di={...di,activeTab:e},Ja()}function FE(e){di={...di,scope:e},Ja()}function yX(e){di={...di,filterText:e},Ja()}function bX(e){di={...di,searchQuery:e},Ja()}function zl(e,t){di={...di,searchResults:e,searchLoading:t},Ja()}function Lp(e){return e??""}function Mb(e,t){return e.installedContextKey===t}function bv(e,t,n){di.installedContextKey===e&&(di={...di,installedList:t,installedLoading:n},Ja())}function jb(e){di={...di,installFormOpenId:e},Ja()}function SX(e){di={...di,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ja()}const UE=750;function tM(){const[e,t]=v.useState({status:"idle",lines:[]}),n=v.useRef(null),i=v.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);v.useEffect(()=>()=>i(),[i]);const r=v.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=v.useCallback((u,h)=>{i(),t({status:"running",lines:[]}),(async()=>{const p=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).catch(()=>null);if(!p?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await p.json();let g=0;const _=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${g}`).catch(()=>null);if(!b?.ok){t(w=>({...w,status:"error"}));return}const S=await b.json();g=S.nextCursor,t(w=>({...w,lines:[...w.lines,...S.lines]})),S.status==="running"?n.current=setTimeout(()=>{_()},UE):t(w=>({...w,status:S.status}))};n.current=setTimeout(()=>{_()},UE)})()},[i]);return{...e,start:o,reset:r}}const wX=300,qf=2;function xX(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function CX(e){if(e.length<qf){zl([],!1);return}zl([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){zl([],!1);return}const n=await t.json();zl(n.skills??[],!1)}catch{zl([],!1)}}function kX({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:r,onInstallStarted:o,jobLog:u}){const h={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return c.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>r(h,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&c.jsx("span",{className:"skills-card-installs",children:xX(e.installs)})]}),c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("div",{className:"skills-card-actions",children:c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:n?"Cancel":"Install"})}),n&&c.jsx(mX,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:p=>o(e.name,p),jobLog:u})]})}function EX({theaterId:e,onReadMore:t,onInstallSuccess:n}){const{searchQuery:i,searchResults:r,searchLoading:o,installFormOpenId:u}=A1(),h=v.useRef(null),p=tM(),[f,g]=v.useState(null),_=v.useCallback(S=>{if(bX(S),h.current&&clearTimeout(h.current),S.length<qf){zl([],!1);return}h.current=setTimeout(()=>{CX(S)},wX)},[]);v.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),v.useEffect(()=>{p.status!=="done"||!f||(n(f.name,f.scope),jb(null),g(null))},[p.status,f,n]);const b=f?`Installing ${f.name}…`:"Installing…";return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:i,onChange:S=>_(S.target.value),"aria-label":"Search skills registry"}),o&&c.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!o&&i.length>=qf&&r.length===0&&c.jsxs("div",{className:"skills-empty-state",children:['No results for "',i,'".']}),!o&&i.length>0&&i.length<qf&&c.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),c.jsx("div",{className:"skills-card-list",children:r.map(S=>c.jsx(kX,{result:S,theaterId:e,isFormOpen:u===S.id,onInstallClick:()=>jb(u===S.id?null:S.id),onReadMore:t,onInstallStarted:(w,C)=>g({name:w,scope:C}),jobLog:p},S.id))})]}),c.jsx(eM,{status:p.status,lines:p.lines,runningLabel:b,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:p.reset})]})}const TX=2600;function AX({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:r}){const[o,u]=v.useState(!1),h=v.useRef(null),p=v.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),f=v.useCallback(()=>{o?(p(),u(!1),i?.(e.name,e.scope)):(u(!0),h.current=setTimeout(()=>u(!1),TX))},[o,p,i,e.name,e.scope]);return v.useEffect(()=>()=>p(),[p]),c.jsxs("div",{className:"skills-card",children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),c.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),c.jsxs("div",{className:"skills-card-actions",children:[n&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>n(e.scope),disabled:r,children:r?"Updating…":"Update all"}),i&&c.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${o?" is-armed":""}`,onClick:f,"aria-label":o?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:o?"Remove?":"✕"})]})]})}async function RX(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function NX({theaterId:e,onReadMore:t,refreshKey:n}){const i=A1(),{scope:r,filterText:o}=i,u=Lp(e),h=Mb(i,u)?i.installedList:[],p=Mb(i,u)&&i.installedLoading,f=tM(),g=v.useRef(null),_=v.useCallback(z=>{const U=Lp(z);bv(U,[],!0),RX(z).then(A=>bv(U,A,!1)).catch(()=>bv(U,[],!1))},[]);v.useEffect(()=>{_(e)},[e,_,n]),v.useEffect(()=>{(f.status==="done"||f.status==="error")&&_(e)},[f.status,e,_]);const b=v.useCallback(z=>{const U=z;g.current=U;const A={scope:U};U==="project"&&e&&(A.theaterId=e),f.start("/plugins/skills/update",A)},[e,f]),S=v.useCallback((z,U)=>{const A={scope:U,skill:z};U==="project"&&e&&(A.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}).then(()=>_(e)).catch(()=>null)},[e,_]),w=v.useCallback(()=>{g.current&&b(g.current)},[b]),C=r==="project"&&!e?"global":r,x=h.filter(z=>z.scope!==C?!1:o?z.name.toLowerCase().includes(o.toLowerCase()):!0),I=f.status==="running"&&g.current===C;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${C==="project"?" is-active":""}`,onClick:()=>FE("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),c.jsx("button",{type:"button",className:`skills-scope-btn${C==="global"?" is-active":""}`,onClick:()=>FE("global"),children:"Global"})]}),c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:z=>yX(z.target.value),"aria-label":"Filter installed skills"}),p&&c.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!p&&x.length===0&&c.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${C} skills installed.`}),c.jsx("div",{className:"skills-card-list",children:x.map(z=>c.jsx(AX,{skill:z,onReadMore:t,onUpdate:b,onRemove:S,isUpdating:I},`${z.scope}:${z.name}`))})]}),c.jsx(eM,{status:f.status,lines:f.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:f.reset,onRetry:w})]})}function Sv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";n&&!/^(https?:|mailto:|#)/i.test(n)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function LX({content:e}){const t=v.useMemo(()=>{const r=Bs(e).html,o=new DOMParser().parseFromString(r,"text/html");return Sv(o.body),o.body.innerHTML},[e]),n=v.useRef(null);v.useEffect(()=>{const r=n.current;if(!r)return;Sv(r);const o=new MutationObserver(()=>Sv(r));return o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>o.disconnect()},[t]);const i=v.useCallback(r=>{const o=r.target.closest('[data-action="copy-code"]');if(!o)return;const u=o.closest("pre")?.getAttribute("data-code");if(!u)return;navigator.clipboard?.writeText(u);const h=o.textContent;o.textContent="Copied",window.setTimeout(()=>{o.textContent=h},1200)},[]);return c.jsx("div",{ref:n,className:"markdown-body",onClick:i,dangerouslySetInnerHTML:{__html:t}})}const MX=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),jX="Skills run with full agent permissions. Review before use.";function OX(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(MX)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function DX({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:r}){const[o,u]=v.useState(null),[h,p]=v.useState(!1),f=v.useRef(null),g=v.useRef(null),_=v.useRef(null);if(v.useEffect(()=>{e&&f.current===null&&(f.current=document.activeElement)},[e]),v.useEffect(()=>{if(!e){u(null);return}p(!0),u(null);let S=!1;return(async()=>{try{let C;if(t){const I={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(I.theaterId=n),C=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)})}else C=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(S)return;if(!C.ok){p(!1);return}const x=await C.json();S||(u(x.markdown??""),p(!1))}catch{S||p(!1)}})(),()=>{S=!0}},[e,t,n]),v.useEffect(()=>{if(!e)return;const S=w=>{w.key==="Escape"?(w.preventDefault(),i()):w.key==="Tab"&&OX(w,_.current),w.stopImmediatePropagation()};return g.current?.focus(),window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0);const w=f.current;f.current=null,w?.focus?.()}},[e,i]),v.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const b=e.displayPath||e.source||null;return Qr.createPortal(c.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:c.jsxs("div",{ref:_,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:S=>S.stopPropagation(),children:[c.jsxs("div",{className:"skills-overlay-header",children:[c.jsx("span",{className:"skills-overlay-title",children:e.name}),b&&c.jsx("span",{className:"skills-overlay-meta",children:b}),c.jsx("button",{ref:g,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"skills-overlay-body",children:[h&&c.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!h&&o===null&&c.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),o!==null&&c.jsx(LX,{content:o})]}),c.jsxs("div",{className:"skills-overlay-footer",children:[c.jsx("p",{className:"skills-permission-warning",children:jX}),!t&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),r()},children:"Install"})]})]})}),document.body)}const IX=3200;function BX({message:e,onDismiss:t}){return v.useEffect(()=>{if(!e)return;const n=setTimeout(t,IX);return()=>clearTimeout(n)},[e,t]),e?c.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function PX({ctx:e}){const t=Lp(e.theaterId);return c.jsx($X,{ctx:e},t)}function $X({ctx:e}){const{theaterId:t}=e,n=A1(),{activeTab:i}=n,r=Lp(e.theaterId),[o,u]=v.useState(null),[h,p]=v.useState(null),[f,g]=v.useState(0),_=Mb(n,r)?n.installedList.length:0;v.useLayoutEffect(()=>{SX(r)},[r]);const b=v.useCallback(x=>{u({skill:x,isInstalled:!0})},[]),S=v.useCallback((x,I)=>{u({skill:x,isInstalled:!1,registryId:I})},[]),w=v.useCallback((x,I)=>{p(`Installed ${x} to ${I}`),g(z=>z+1),bf("installed")},[]),C=v.useCallback(()=>{o?.registryId&&(jb(o.registryId),bf("find")),u(null)},[o]);return c.jsxs("div",{className:"skills-root",children:[c.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>bf("installed"),children:["Installed",_>0?` ${_}`:""]}),c.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>bf("find"),children:"Find"})]}),i==="installed"?c.jsx(NX,{theaterId:t,onReadMore:b,refreshKey:f}):c.jsx(EX,{theaterId:t,onReadMore:S,onInstallSuccess:w}),c.jsx(BX,{message:h,onDismiss:()=>p(null)}),c.jsx(DX,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>u(null),onInstall:C})]})}function zX(){return c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const HX={id:"skills",title:"Skills",icon:zX,render:e=>c.jsx(PX,{ctx:e})},FX={id:"skills",railPanels:[HX]},UX=[FX],nM=[...YK,...YV,...hX,...UX],WX=sM(nM),iM=v.createContext(WX),qX=iM.Provider;async function GX(){const e=[...nM],t=new Set(e.map(i=>i.id)),n=await KX();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const r=await VX(i);if(r){if(t.has(r.id)){console.warn(`Skipping external plugin with duplicate id: ${r.id}`);continue}t.add(r.id),e.push(r)}}return sM(e)}function xc(){return v.useContext(iM)}async function KX(){try{const e=await fetch("/plugin-runtime/manifest");if(!e.ok)return console.warn(`Plugin runtime manifest unavailable: ${e.status}`),[];const t=await e.json();return Array.isArray(t.plugins)?t.plugins.filter(XX):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function VX(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return YX(n)?n:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function sM(e){const t=new Set,n=[];for(const i of e)for(const r of i.railPanels??[]){if(t.has(r.id)){console.warn(`Skipping rail panel with duplicate id: ${r.id}`);continue}t.add(r.id),n.push(r)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function YX(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function XX(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.clientUrl=="string"&&Number.isInteger(t.apiVersion)}let rM=!1;const Ob=new Set;function ZX(){return v.useSyncExternalStore(JX,WE,WE)}function WE(){return rM}function aM(e){rM=QX(e)?e.fullscreen:!1;for(const t of Ob)t()}function qE(){aM({fullscreen:!1})}function JX(e){return Ob.add(e),()=>Ob.delete(e)}function QX(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Object.keys(t).length===1&&typeof t.fullscreen=="boolean"}const oM="(display-mode: fullscreen)",eZ=480,tZ=480,nZ=()=>!0;function iZ(){return typeof window<"u"&&window.matchMedia(oM).matches}function sZ(e=nZ){const t=ZX(),[n,i]=v.useState(iZ),r=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||r&&t,u=v.useRef(o);u.current=o;const h=v.useRef(!1),p=v.useRef(null),[f,g]=v.useState(o),[_,b]=v.useState(!0),[S,w]=v.useState(!1),C=v.useCallback(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)},[]),x=v.useCallback(A=>{C(),!(!u.current||h.current)&&(p.current=setTimeout(()=>{p.current=null,u.current&&!h.current&&e()&&b(!1)},A))},[e,C]),I=v.useCallback(()=>{C(),u.current&&b(!0)},[C]),z=v.useCallback(()=>x(tZ),[x]),U=v.useCallback(()=>{const A=!h.current;h.current=A,w(A),A&&(C(),b(!0))},[C]);return v.useEffect(()=>{const A=window.matchMedia(oM),O=()=>i(A.matches);return O(),A.addEventListener("change",O),()=>A.removeEventListener("change",O)},[]),v.useLayoutEffect(()=>(C(),g(o),b(!0),o&&!h.current&&x(eZ),C),[C,o,x]),{isFullscreen:f,isVisible:_,isPinned:S,reveal:I,hideAfterLeave:z,togglePin:U}}function rZ({operationsViewVisible:e}){const t=Js(),n=xc(),i=lA(),r=bA(),o=oZ(),u=`${o}${o==="⌘"?"":"+"}B`,h=`${o}${o==="⌘"?"⌥":"+Alt+"}B`,p=l0(),f=t.theaters.find($e=>$e.id===t.activeTheaterId)??null,g=jI(t.operations,t.activeOperationId,t.activeTheaterId),_=g?n.plugins.find($e=>$e.id===g.pluginId):null,b=typeof g?.payload.cliId=="string"?g.payload.cliId:null,S=typeof g?.payload.cliLabel=="string"?g.payload.cliLabel:b,w=g?_?.operationKinds?.find($e=>$e.type===g.type)??null:null,C=g&&_?.renderLaunchIcon?_.renderLaunchIcon({id:b??g.type,type:g.type,title:w?.title??g.type}):null,x=v.useRef(null),I=v.useRef(null),z=v.useRef(null),U=v.useRef(null),A=v.useRef({edge:!1,band:!1}),O=v.useRef(null),R=v.useRef(null),$=v.useRef(null),H=v.useRef(null),J=v.useRef(null),[Z,K]=v.useState(null),[M,N]=v.useState(0),[D,j]=v.useState(!1),[T,B]=v.useState(null),[L,F]=v.useState(null),[W,E]=v.useState(!1),[G,Y]=v.useState(null),[re,he]=v.useState(null),ae=()=>{B(null),F(null),E(!1),Y(null),he(null)},ke=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",Re=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?"Local":"Local · Desktop",De=v.useCallback(()=>{const $e=document.activeElement;return!($e instanceof Node&&(z.current?.contains($e)||U.current?.contains($e)))&&!A.current.edge&&!A.current.band},[]),Ue=sZ(De),Oe=g?.id??null,Le=v.useRef(null);Le.current=Oe;const we=E0({currentTitle:g?.title??"",onCommit:$e=>{const xe=FC(O.current,Le.current);O.current=null,xe&&sT(xe,$e).then(()=>Qi(null)).then(fs).catch(()=>{})}});v.useEffect(()=>{!we.renaming||FC(O.current,Oe)||(O.current=null,we.cancel())},[we,Oe]),v.useEffect(()=>{if(!D)return;const $e=new AbortController;return B(null),F(null),E(!0),yO($e.signal).then(B).catch(xe=>{$e.signal.aborted||F(xe instanceof Error?xe.message:"Unable to load environment details.")}).finally(()=>{$e.signal.aborted||E(!1)}),()=>$e.abort()},[D]),v.useEffect(()=>{if(!D)return;const $e=it=>{const ht=it.target;!(ht instanceof Node)||x.current?.contains(ht)||I.current?.contains(ht)||(j(!1),ae())},xe=it=>{it.key==="Escape"&&(j(!1),ae(),x.current?.focus())};return document.addEventListener("pointerdown",$e),document.addEventListener("keydown",xe),()=>{document.removeEventListener("pointerdown",$e),document.removeEventListener("keydown",xe)}},[D]),v.useEffect(()=>{if(Z===null)return;const $e=Z==="theater"?R:$,xe=ht=>{const Dt=ht.target;!(Dt instanceof Node)||$e.current?.contains(Dt)||J.current?.contains(Dt)||K(null)},it=ht=>{ht.key==="Escape"&&(K(null),$e.current?.focus())};return document.addEventListener("pointerdown",xe),document.addEventListener("keydown",it),()=>{document.removeEventListener("pointerdown",xe),document.removeEventListener("keydown",it)}},[Z]),v.useEffect(()=>{K(null)},[t.activeTheaterId,t.activeOperationId]),v.useLayoutEffect(()=>{if(Z===null)return;const $e=()=>{const xe=H.current,it=J.current;if(!xe||!it)return;const ht=Z==="operation"?$.current?.offsetLeft??0:0;N(DI(ht,xe.getBoundingClientRect().left,it.getBoundingClientRect().width,window.innerWidth))};return $e(),window.addEventListener("resize",$e),()=>window.removeEventListener("resize",$e)},[Z]),v.useEffect(()=>{t.channel!=="local"&&(j(!1),B(null),F(null),E(!1),Y(null),he(null))},[t.channel]);const Ie=$e=>{navigator.clipboard.writeText($e).then(()=>{Y($e),he(null)}).catch(()=>{he($e),Y(null)})},Qe=()=>{g&&(K(null),O.current=g.id,we.begin())},dt=$e=>{j(!1),ae(),K(xe=>xe===$e?null:$e)},Je=$e=>{Z===null||!OI($e.currentTarget,$e.relatedTarget)||K(null)},le=$e=>{K(null),R.current?.focus(),$e!==t.activeTheaterId&&v0($e)},Ye=$e=>{K(null),$.current?.focus(),lc($e)},Pe=()=>{K(null),R.current?.focus(),oI()},At=()=>{f&&(K(null),$.current?.focus(),cI(f.id))},Zt=MI(t.operations,t.groups,t.activeTheaterId,p.operationOrder),fn=()=>{De()&&Ue.hideAfterLeave()},wt=$e=>{const xe=$e.relatedTarget;(!(xe instanceof Node)||!z.current?.contains(xe)&&!U.current?.contains(xe))&&!A.current.edge&&!A.current.band&&Ue.hideAfterLeave()},Kt=()=>{A.current.edge=!0,Ue.reveal()},xt=()=>{A.current.edge=!1,fn()},Se=()=>{A.current.band=!0,Ue.reveal()},We=()=>{A.current.band=!1,fn()},xn=Ue.isFullscreen&&!Ue.isVisible;return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:U,type:"button",className:`command-band-edge-reveal${Ue.isFullscreen?" is-fullscreen":""}`,"aria-label":"Show command band",onPointerEnter:Kt,onPointerLeave:xt,onFocus:Ue.reveal,onBlur:wt,onKeyDown:$e=>{$e.key==="Tab"&&Ue.reveal()}}),c.jsxs("header",{ref:z,className:`command-band${e?" is-operations":" is-utility"}${Ue.isFullscreen?" is-fullscreen":""}${Ue.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${i.width}px`},"aria-hidden":xn||void 0,inert:xn||void 0,onPointerEnter:Se,onPointerLeave:We,onFocus:Ue.reveal,onBlur:wt,children:[c.jsxs("div",{className:`command-band-left${e&&i.collapsed?" is-collapsed":""}`,children:[c.jsx(d8,{className:"command-band-brand"}),t.channel==="local"?c.jsxs("div",{className:"command-band-environment",children:[c.jsxs("button",{ref:x,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":D,onClick:()=>{K(null),ae(),j($e=>!$e)},children:[c.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),c.jsx("span",{className:"command-band-local-chip-label",children:ke?Re:"Local"})]}),D?c.jsx("div",{ref:I,children:c.jsx(aZ,{environment:T,error:L,loading:W,copiedValue:G,copyFailedValue:re,desktopShell:ke,onCopy:Ie})}):null]}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>Xl(!i.collapsed),"aria-label":`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,title:`${i.collapsed?"Expand sidebar":"Collapse sidebar"} (${u})`,children:c.jsx(GE,{side:"left"})}):null,c.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:UT,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:c.jsx(lZ,{})})]}),c.jsx("div",{className:"command-band-center",children:e&&f?c.jsxs("div",{ref:H,className:"command-band-switcher",onBlur:Je,children:[c.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${f.label}`,children:[c.jsxs("button",{ref:R,type:"button",className:`command-band-theater-segment command-band-segment-trigger${Z==="theater"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Z==="theater",title:"Switch Theater",onClick:()=>dt("theater"),children:[c.jsx("span",{className:"command-band-theater-mark",children:A0(f.label)}),c.jsx("span",{className:"command-band-segment-label",children:f.label}),c.jsx(k_,{})]}),c.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),g?c.jsxs(c.Fragment,{children:[we.renaming?c.jsx("input",{ref:we.inputRef,className:"command-band-rename-input",value:we.draftTitle,"aria-label":`${g.title} 이름 변경`,onChange:$e=>we.setDraftTitle($e.target.value),onKeyDown:we.handleKeyDown,onBlur:we.handleBlur}):c.jsxs("button",{ref:$,type:"button",className:`command-band-operation-name command-band-segment-trigger${Z==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Z==="operation",title:"Switch operation — double-click to rename",onClick:()=>dt("operation"),onDoubleClick:Qe,children:[c.jsx("span",{className:"command-band-segment-label",children:g.title}),c.jsx(k_,{})]}),S?c.jsxs("span",{className:"command-band-operation-attribute",title:w?.title??S,children:[C?c.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:C}):null,S]}):null]}):c.jsxs("button",{ref:$,type:"button",className:`command-band-operation-placeholder command-band-segment-trigger${Z==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":Z==="operation",title:"Select operation",onClick:()=>dt("operation"),children:[c.jsx("span",{className:"command-band-segment-label",children:"Select operation…"}),c.jsx(k_,{})]})]}),Z==="theater"?c.jsx(g7,{theaters:t.theaters,operations:t.operations,activeTheaterId:t.activeTheaterId,addingTheater:t.addingTheater,onSelectTheater:le,onAddTheater:Pe,style:{left:M},containerRef:J}):null,Z==="operation"?c.jsx(_7,{operations:Zt,activeOperationId:g?.id??null,theaterLabel:f.label,onSelectOperation:Ye,onRenameOperation:g?Qe:null,onNewOperation:At,style:{left:M},containerRef:J}):null]}):null}),c.jsxs("div",{className:"command-band-right",children:[Ue.isFullscreen?c.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:Ue.togglePin,"aria-label":"Pin command band","aria-pressed":Ue.isPinned,title:Ue.isPinned?"Unpin command band":"Pin command band",children:c.jsx(cZ,{})}):null,e?c.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:R0,"aria-label":`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,title:`${r?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,children:c.jsx(GE,{side:"right"})}):null]})]})]})}function aZ({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:r,desktopShell:o,onCopy:u}){if(n)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:"Loading environment details…"});if(t)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:t});if(!e)return null;const h=[["Channel",e.channel],["Version",e.version],["Reachable on",`127.0.0.1:${e.effectivePort}`],["Data root",e.dataDir],["Runtime lock",e.lockFile],...o?[["Desktop data",`${e.dataDir}/desktop`]]:[]];return c.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":"Environment",children:[c.jsx("div",{className:"command-band-environment-title",children:"Environment"}),h.map(([p,f])=>c.jsxs("div",{className:"command-band-environment-row",children:[c.jsx("span",{children:p}),c.jsx("code",{children:f}),c.jsx("button",{type:"button",onClick:()=>u(f),children:i===f?"Copied":r===f?"Copy failed":"Copy"})]},p)),c.jsx("div",{className:"command-band-environment-footer",children:"Development and published channels keep separate data roots."})]})}function oZ(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function lZ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function GE({side:e}){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function cZ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const uZ=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function dZ({state:e}){const[t,n]=v.useState(!1),i=v.useRef(null),r=v.useRef(null),o=v.useRef(null),u=e.theaters.length>0;if(v.useEffect(()=>{if(e.onboardingOpen)return i.current=document.activeElement,r.current?.focus(),()=>{const g=i.current;i.current=null,g?.focus?.()}},[e.onboardingOpen]),v.useEffect(()=>{if(!e.onboardingOpen)return;const g=_=>{t||(_.key==="Escape"?(_.preventDefault(),_u()):_.key==="Tab"&&hZ(_,o.current),_.stopImmediatePropagation())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const h=()=>{n(!0)},p=()=>{n(!1)},f=async g=>{n(!1),HT();try{const _=await iT(g),b=await nT(_);FT(b)}catch(_){ly(_ instanceof Error?_.message:String(_))}};return c.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[c.jsx("button",{type:"button",className:"commissioning-scrim",onClick:_u,"aria-label":"Close setup guide"}),c.jsxs("section",{className:"commissioning-card",ref:o,children:[c.jsxs("header",{className:"commissioning-header",children:[c.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),c.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),c.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),c.jsxs("ol",{className:"commissioning-steps",children:[c.jsxs("li",{className:`commissioning-step commissioning-step--primary ${u?"is-complete":"is-current"}`,children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:u?"✓":"01"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Register a Theater"}),c.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),u?c.jsx(cd,{ref:g=>{r.current=g},className:"commissioning-primary-action",to:"/operations",onClick:_u,children:"Go to Operations →"}):c.jsx("button",{ref:g=>{r.current=g},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:h,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?c.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Open an Operation"}),c.jsx("p",{children:"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session."}),c.jsx(cd,{className:"commissioning-secondary-link",to:"/operations",onClick:_u,children:"Go to Operations"})]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:"Monitor Carriers"}),c.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),c.jsxs("footer",{className:"commissioning-footer",children:[c.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),c.jsx("button",{type:"button",className:"commissioning-skip",onClick:_u,children:"Skip for now"})]})]}),c.jsx(JT,{open:t,onCancel:p,onConfirm:f})]})}function hZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(uZ)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}let Db=null;function fZ(e){Db=e}function pZ(){const e=Db;return Db=null,e}const mZ=[{id:"instrument",label:"Instrument"},{id:"maritime",label:"Maritime"},{id:"carbon",label:"Carbon"}];function gZ(e){return e.startsWith(">")}function KE(e){return e.slice(1)}function _Z(e,t){const n=[],i=e.theaters.find(r=>r.id===e.activeTheaterId)??null;for(const r of e.theaters)n.push({commandId:`switch-theater:${r.id}`,label:`Switch theater: ${r.label}`,current:r.id===e.activeTheaterId,action:{kind:"switch-theater",theaterId:r.id}});i&&n.push({commandId:"new-operation",label:`New Operation in ${i.label}`,current:!1,action:{kind:"new-operation"}});for(const r of t)n.push({commandId:`open-rail-panel:${r.id}`,label:`Open panel: ${r.title}`,current:!1,action:{kind:"open-rail-panel",panelId:r.id}});n.push({commandId:"toggle-rail",label:"Toggle Activity Rail",current:!1,action:{kind:"toggle-rail"}}),n.push({commandId:"toggle-sidebar",label:"Toggle sidebar",current:!1,action:{kind:"toggle-sidebar"}});for(const r of mZ)n.push({commandId:`switch-theme:${r.id}`,label:`Switch theme: ${r.label}`,current:r.id===e.activeTheme,action:{kind:"switch-theme",theme:r.id}});return n.push({commandId:"open-settings",label:"Open Settings",current:!1,action:{kind:"open-settings"}}),n.push({commandId:"open-keyboard-shortcuts",label:"Open keyboard shortcuts",current:!1,action:{kind:"open-keyboard-shortcuts"}}),e.releaseNotes.length>0&&n.push({commandId:"whats-new",label:"What's new",current:!1,action:{kind:"whats-new"}}),n}function vZ(e,t){const n=_0(t);return n.length===0?e:e.filter(i=>{const r=i.label.toLocaleLowerCase();return n.every(o=>r.includes(o))})}const yZ="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",VE="operation-search-listbox",lM="__unassigned__",YE="operation-search-heading-commands";function bZ({state:e,railPanels:t}){const n=_c(),i=gs(),[r,o]=v.useState(""),[u,h]=v.useState(0),p=v.useRef(null),f=v.useRef(null),g=v.useRef(null),_=v.useRef(new Map),b=gZ(r),S=v.useMemo(()=>SI(e),[e]),w=v.useMemo(()=>HD(S,r),[S,r]),C=v.useMemo(()=>FD(w),[w]),x=v.useMemo(()=>_Z(e,t),[e,t]),I=v.useMemo(()=>b?vZ(x,KE(r)):x,[b,x,r]),z=v.useMemo(()=>_0(b?KE(r):r),[b,r]),U=b?I.length:w.length,A=XE(u,U),O=b?I[A]?.commandId:w[A]?.operationId,R=O===void 0?void 0:b?JE(O):ZE(O);if(v.useEffect(()=>{if(!e.operationSearchOpen)return;g.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const Z=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=Z,g.current?.focus()}},[e.operationSearchOpen]),v.useEffect(()=>{if(!e.operationSearchOpen){o(""),h(0);return}h(0)},[e.operationSearchOpen,r]),v.useEffect(()=>{!e.operationSearchOpen||O===void 0||_.current.get(O)?.scrollIntoView({block:"nearest"})},[O,e.operationSearchOpen]),!e.operationSearchOpen)return null;const $=Z=>{g.current=null,lc(Z),n("/operations"),Kh()},H=Z=>{const K=Z.action;switch(K.kind){case"switch-theater":{if(Z.current)break;g.current=null,v0(K.theaterId),n("/operations");break}case"new-operation":{g.current=null,i.pathname.startsWith("/operations")||n("/operations"),uI();break}case"open-rail-panel":{i.pathname.startsWith("/operations")||n("/operations"),x7(K.panelId),vA(!0);break}case"toggle-rail":{i.pathname.startsWith("/operations")||n("/operations"),g.current=document.querySelector(".command-band-rail-toggle"),R0();break}case"toggle-sidebar":{i.pathname.startsWith("/operations")||n("/operations"),g.current=document.querySelector(".command-band-sidebar-toggle"),Xl(!op().collapsed);break}case"switch-theme":{if(Z.current)break;const M=e.activeTheme;oc(K.theme),Va("theme",K.theme).then(N=>{N||oc(M)});break}case"open-settings":{g.current=null,n("/settings");break}case"open-keyboard-shortcuts":{fZ(g.current),g.current=null,hI();break}case"whats-new":{WT();break}}Kh()},J=Z=>{if(Z.key==="Escape"){Z.preventDefault(),Kh();return}if(Z.key==="ArrowDown"||Z.key==="ArrowUp"){Z.preventDefault(),h(K=>XE(K+(Z.key==="ArrowDown"?1:-1),U));return}if(Z.key==="Enter"){if(b){const M=I[A];if(!M)return;Z.preventDefault(),H(M);return}const K=w[A];if(!K)return;Z.preventDefault(),$(K.operationId);return}Z.key==="Tab"&&CZ(Z,f.current)};return c.jsx("div",{className:"operation-search-overlay",onMouseDown:Z=>{Z.target===Z.currentTarget&&Kh()},children:c.jsxs("section",{ref:f,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":b?"Console commands":"Operation quick search",tabIndex:-1,onKeyDown:J,children:[c.jsxs("div",{className:"operation-search-field",children:[c.jsx(kZ,{}),c.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:r,onChange:Z=>o(Z.target.value),placeholder:"Search Operations — type > for commands",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":VE,"aria-activedescendant":R,"aria-autocomplete":"list",spellCheck:!1}),c.jsx("kbd",{children:"esc"})]}),c.jsx("div",{id:VE,className:"operation-search-results",role:"listbox","aria-label":b?"Command results":"Operation results",children:b?I.length>0?c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":YE,children:[c.jsx("h2",{id:YE,className:"operation-search-section-heading",children:"Commands"}),I.map((Z,K)=>{const M=K===A;return c.jsxs("button",{id:JE(Z.commandId),ref:N=>{N?_.current.set(Z.commandId,N):_.current.delete(Z.commandId)},type:"button",className:`operation-search-result ${M?"is-active":""}`,role:"option","aria-selected":M,onMouseEnter:()=>h(K),onClick:()=>H(Z),children:[c.jsx("span",{className:"operation-search-command-glyph","aria-hidden":"true",children:"›"}),c.jsx("span",{className:"operation-search-result-text",children:c.jsx("strong",{children:Sf(Z.label,z)})}),Z.current?c.jsx("span",{className:"operation-search-theater",children:"current"}):null]},Z.commandId)})]}):c.jsx("p",{className:"operation-search-empty",children:"No matching commands."}):C.length>0?C.map(Z=>{const K=wZ(Z.theaterId);return c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":K,children:[c.jsx("h2",{id:K,className:"operation-search-section-heading",children:Sf(Z.theaterLabel,z)}),Z.entries.map(M=>{const N=w.indexOf(M),D=N===A;return c.jsxs("button",{id:ZE(M.operationId),ref:j=>{j?_.current.set(M.operationId,j):_.current.delete(M.operationId)},type:"button",className:`operation-search-result ${D?"is-active":""}`,role:"option","aria-selected":D,onMouseEnter:()=>h(N),onClick:()=>$(M.operationId),children:[c.jsxs("span",{className:"operation-search-result-text",children:[c.jsx("strong",{children:Sf(M.operationName,z)}),c.jsx("small",{children:SZ(M)})]}),c.jsx("span",{className:"operation-search-theater",children:Sf(M.theaterLabel,z)})]},M.operationId)})]},Z.theaterId??lM)}):c.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function XE(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function SZ(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function wZ(e){return`operation-search-heading-${R1(e??lM)}`}function ZE(e){return`operation-search-option-${R1(e)}`}function JE(e){return`operation-search-command-${R1(e)}`}function R1(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Sf(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const r=xZ(e,t,i);if(!r){n.push(e.slice(i));break}r.start>i&&n.push(e.slice(i,r.start)),n.push(c.jsx("mark",{children:e.slice(r.start,r.end)},`${r.start}-${r.end}`)),i=r.end}return n}function xZ(e,t,n){const i=e.toLocaleLowerCase();let r=null;for(const o of t){const u=i.indexOf(o,n);u!==-1&&(!r||u<r.start)&&(r={start:u,end:u+o.length})}return r}function CZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(yZ)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],r=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),r?.focus();return}!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i?.focus())}function kZ(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function EZ({open:e,title:t,message:n,tone:i="info",onDismiss:r}){return e?c.jsx("div",{className:"app-toast-host",children:c.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[c.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),c.jsxs("div",{className:"app-toast-body",children:[c.jsx("p",{className:"app-toast-title",children:t}),n?c.jsx("p",{className:"app-toast-message",children:n}):null]}),r?c.jsx("button",{type:"button",className:"app-toast-close",onClick:r,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}let tc=null,ed=0;function cM(e){tc?.abort();const t=new AbortController,n=++ed;return tc=t,VD(),bO({...e,signal:t.signal}).then(i=>{n===ed&&YD(i)}).catch(i=>{t.signal.aborted||n!==ed||XD(i instanceof Error?i.message:String(i))}).finally(()=>{n===ed&&(tc=null)})}function TZ(){tc!==null&&(tc.abort(),tc=null,ed+=1)}function uM(e,t=AZ()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function AZ(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const dM=[{id:"fleet-cli",label:"Fleet CLI"},{id:"fleet-console",label:"Fleet Console"},{id:"fleet-desktop",label:"Fleet Desktop"},{id:"fleet-plugin",label:"Fleet Plugin"},{id:"fleet-core",label:"Fleet Core"}],wv={id:"overview",label:"Overview"},RZ={id:"all-updates",label:"All updates"},NZ={id:"other-updates",label:"Other updates"};function hM(e){const t=e.sections.some(i=>i.items.some(r=>r.product===void 0)),n=dM.filter(i=>e.sections.some(r=>r.items.some(o=>o.product===i.id)));return n.length===0?[wv,RZ]:t?[wv,...n,NZ]:[wv,...n]}function LZ(e,t){return t==="overview"?[]:e.sections.map(n=>({...n,items:n.items.filter(i=>t==="all-updates"||t==="other-updates"?i.product===void 0:i.product===t)})).filter(n=>n.items.length>0)}function MZ(e){const t=dM.flatMap(i=>{const r=e.sections.flatMap(o=>o.items.filter(u=>u.product===i.id));return r.length===0?[]:[{id:i.id,label:i.label,count:r.length,summary:r[0].text}]}),n=e.sections.flatMap(i=>i.items.filter(r=>r.product===void 0));return n.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:n.length,summary:n[0].text}]}function jZ(e,t){return hM(e).some(n=>n.id===t)}const OZ=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),$u=10;function DZ({state:e}){const t=v.useRef(null),n=v.useRef([]),i=v.useRef(null),r=v.useRef(null),o=v.useRef(new Map),[u,h]=v.useState("overview"),p=r0(),f=uM(p.state?.language??"auto"),g=e.selectedReleaseNoteKey??zu(e.releaseNotes[0]?.version??"",0),_=e.releaseNotes.findIndex((H,J)=>zu(H.version,J)===g),b=e.releaseNotes[_]??e.releaseNotes[0],S=b?zu(b.version,_>=0?_:0):"",w=b?hM(b):[];v.useEffect(()=>{h("overview")},[S]),v.useEffect(()=>{b&&!jZ(b,u)&&h("overview")},[u,b]),v.useEffect(()=>{const H=J=>{const Z=J.target instanceof HTMLElement?J.target:null;if(!Z||Z.closest(".whatsnew-card"))return;const K=n.current.filter(M=>M!==Z&&M.isConnected);n.current=[...K.slice(-4),Z]};return document.addEventListener("focusin",H,!0),()=>document.removeEventListener("focusin",H,!0)},[]);const C=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen||e.keyboardShortcutsOpen;if(e.whatsNewOpen&&!C&&t.current===null&&(t.current=document.activeElement),v.useEffect(()=>{if(!e.whatsNewOpen||C)return;const H=J=>{zZ(J)||(J.key==="Escape"?(J.preventDefault(),Vh()):FZ(J,r.current,h)?J.preventDefault():J.key==="Tab"&&HZ(J,r.current),J.stopImmediatePropagation())};return i.current?.focus(),window.addEventListener("keydown",H,!0),()=>{window.removeEventListener("keydown",H,!0);const J=t.current?.isConnected?t.current:[...n.current].reverse().find(Z=>Z.isConnected);t.current=null,J?.focus?.()}},[e.whatsNewOpen,C]),!e.whatsNewOpen||C||b===void 0)return null;const x=()=>{cM({force:!0,locale:f})},I=async H=>{await Va("language",H)},z=Math.max(1,Math.ceil(e.releaseNotes.length/$u)),U=Math.min(z-1,Math.floor((_>=0?_:0)/$u)),A=U*$u,O=e.releaseNotes.slice(A,A+$u),R=H=>{const J=U+H;if(J<0||J>=z)return;const Z=J*$u,K=e.releaseNotes[Z];K&&$C(zu(K.version,Z))},$=H=>{h(H),requestAnimationFrame(()=>o.current.get(H)?.focus())};return c.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[c.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Vh,"aria-label":"Close What's new"}),c.jsxs("section",{className:"whatsnew-card",ref:r,children:[c.jsxs("header",{className:"whatsnew-header",children:[c.jsxs("div",{className:"whatsnew-heading-row",children:[c.jsx("h2",{id:"whatsnew-title",children:"What's new"}),c.jsxs("span",{className:"whatsnew-version-badge",children:["v",b.version]})]}),c.jsxs("div",{className:"whatsnew-meta-row",children:[b.date?c.jsxs("time",{className:"whatsnew-date",dateTime:b.date,children:["Released ",b.date]}):c.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?c.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),c.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:Vh,"aria-label":"Close What's new",children:"x"}),c.jsxs("div",{className:"whatsnew-body",children:[c.jsxs("div",{className:"whatsnew-version-selector",children:[c.jsx(Ri,{label:"Release version",className:"whatsnew-version-select",value:S,onChange:$C,options:O.map((H,J)=>{const Z=A+J;return{value:zu(H.version,Z),label:`${H.version==="Unreleased"?"Unreleased":`v${H.version}`}${H.date?` · ${H.date}`:""}`}})}),z>1?c.jsxs("div",{className:"whatsnew-pagination",children:[c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>R(-1),disabled:U===0,"aria-label":"Newer versions",children:"‹"}),c.jsxs("span",{className:"whatsnew-page-status",children:[U+1," / ",z]}),c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>R(1),disabled:U>=z-1,"aria-label":"Older versions",children:"›"})]}):null,c.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(H=>c.jsx("button",{type:"button",className:f===H?"is-active":"","aria-pressed":f===H,disabled:p.savingField==="language",onClick:()=>{I(H)},children:H==="en"?"EN":"한국어"},H))}),c.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:x,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),c.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:w.map(H=>c.jsx("button",{ref:J=>{J?o.current.set(H.id,J):o.current.delete(H.id)},id:`whatsnew-tab-${H.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":H.id,"aria-selected":u===H.id,"aria-controls":"whatsnew-tab-panel",tabIndex:u===H.id?0:-1,onClick:()=>h(H.id),children:H.label},H.id))}),e.releaseNotesError?c.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,c.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${u}`,children:u==="overview"?c.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:MZ(b).map(H=>c.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>$(H.id),children:[c.jsx("span",{className:"whatsnew-overview-label",children:H.label}),c.jsxs("span",{className:"whatsnew-overview-count",children:[H.count," ",H.count===1?"update":"updates"]}),c.jsx("span",{className:"whatsnew-overview-summary",children:H.summary})]},H.id))}):LZ(b,u).map((H,J)=>c.jsx(IZ,{section:H,index:J},H.heading))})]}),c.jsx("footer",{className:"whatsnew-footer",children:c.jsx("button",{type:"button",className:"whatsnew-done",onClick:Vh,children:"Close"})})]})]})}function IZ({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return c.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[c.jsx("h3",{children:c.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),c.jsx("ul",{children:e.items.map((r,o)=>c.jsx("li",{children:c.jsx(BZ,{item:r})},`${r.text}:${o}`))})]})}function BZ({item:e}){return c.jsxs(c.Fragment,{children:[e.packageTags.map((t,n)=>c.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),c.jsx("span",{children:e.text})]})}function zu(e,t){return`${e}:${t}`}const PZ=new Set(["ArrowDown","ArrowUp","Enter"," "]);function $Z(e){return e instanceof HTMLElement&&e.dataset.open==="true"}function zZ(e){const t=e.target instanceof Element?e.target:null;if(!t)return!1;if(t.closest('.fc-select__popup[data-open="true"]'))return!0;const n=t.closest(".fc-select__trigger");if(n instanceof HTMLButtonElement){const i=n.getAttribute("aria-controls");return i&&$Z(document.getElementById(i))?!0:PZ.has(e.key)}return!1}function HZ(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(OZ)),i=n[0],r=n[n.length-1];!i||!r||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus()))}function FZ(e,t,n){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const i=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!i||!t)return!1;const r=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=r.indexOf(i);if(o<0||r.length===0)return!1;const u=e.key==="Home"?0:e.key==="End"?r.length-1:(o+(e.key==="ArrowRight"?1:-1)+r.length)%r.length,h=r[u],p=h.dataset.tabId;return p?(n(p),h.focus(),!0):!1}function fM(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function UZ(e,t=window){const n=i=>{if(!(eA()||fM(t.document))){if((i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"){i.preventDefault(),i.stopImmediatePropagation(),e.toggleOperationSearch();return}if((i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&i.altKey&&!i.shiftKey&&(i.metaKey||i.key.toLowerCase()==="b")){i.preventDefault(),i.stopImmediatePropagation(),e.toggleRailChrome();return}(i.metaKey||i.ctrlKey)&&i.code==="KeyB"&&!i.altKey&&!i.shiftKey&&(i.preventDefault(),i.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)}function om(e=()=>{}){return{...M5(e),notifications:{emit:n=>sI(n),dismiss:n=>_I(n)},status:{set:(n,i)=>iI(n,i),clear:n=>zT(n)}}}async function WZ(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await qZ(t),GZ(await t.json(),t.status).routes}async function qZ(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json();typeof n.error=="string"&&(t=n.error)}catch{}throw new hn(e.status,t)}function GZ(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new hn(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>KZ(i,t))}}function KZ(e,t){const n=e;if(!n||typeof n!="object"||typeof n.method!="string"||typeof n.path!="string"||typeof n.summary!="string"||typeof n.category!="string"||typeof n.gate!="string")throw new hn(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const Ib=new Set;let Bb={loading:!1,state:null,error:null};function VZ(){return v.useSyncExternalStore(YZ,QE,QE)}function QE(){return Bb}function YZ(e){return Ib.add(e),()=>{Ib.delete(e)}}async function XZ(e){xv({loading:!0,error:null});try{const t=await WZ(e);xv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;xv({loading:!1,error:ZZ(t)})}}function xv(e){Bb={...Bb,...e};for(const t of Ib)t()}function ZZ(e){return e instanceof Error?e.message:String(e)}function JZ(){const e=VZ(),[t,n]=v.useState(!0),i=v.useMemo(()=>tJ(e.state??[]),[e.state]),r=e.state?.length??0,o=i.length;return v.useEffect(()=>{const u=new AbortController;return XZ(u.signal),()=>u.abort()},[]),c.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[c.jsx("div",{className:`backend-api-control settings-disclosure-control ${t?"is-expanded":""}`,children:c.jsxs("div",{className:"settings-disclosure-head",children:[c.jsxs("div",{className:"backend-api-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),c.jsx("p",{className:"global-settings-help",children:r>0?`${r} loopback route${r===1?"":"s"} across ${o} categor${o===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),c.jsx("div",{className:"settings-disclosure-actions",children:c.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":t,onClick:()=>n(u=>!u),children:t?"Hide":"Show"})})]})}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?c.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?c.jsxs("div",{className:"backend-api-groups",children:[i.length>0?i.map(u=>c.jsx(QZ,{group:u},u.category)):null,e.state&&i.length===0?c.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,c.jsx("p",{className:"global-settings-foot",children:"Console backend routes are fetched from GET /api/v1/settings/api-catalog, so newly registered routes appear here automatically. The Codex/Fleet Wiki API surface is not included."})]})}function QZ({group:e}){return c.jsxs("div",{className:"backend-api-group",children:[c.jsxs("div",{className:"backend-api-group-head",children:[c.jsx("span",{children:e.category}),c.jsx("span",{children:e.entries.length})]}),c.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>c.jsx(eJ,{entry:t},`${t.method}:${t.path}`))})]})}function eJ({entry:e}){return c.jsxs("div",{className:"backend-api-row",children:[c.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),c.jsx("code",{className:"backend-api-path",children:e.path}),c.jsx("span",{className:"backend-api-summary",children:e.summary}),c.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function tJ(e){const t=new Map;for(const n of e){const i=n.category.trim()||"Uncategorized",r=t.get(i);r?r.push(n):t.set(i,[n])}return Array.from(t.entries()).map(([n,i])=>({category:n,entries:i}))}const nJ=[{id:"instrument",label:"Instrument",swatch:["oklch(16.5% 0.016 245)","oklch(80% 0.085 78)","oklch(77% 0.085 200)"]},{id:"maritime",label:"Maritime",swatch:["oklch(20% 0.045 248)","oklch(78% 0.13 75)","oklch(82% 0.13 195)"]},{id:"carbon",label:"Carbon",swatch:["oklch(18% 0.007 255)","oklch(76% 0.115 62)","oklch(80% 0.105 205)"]}],iJ=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],sJ=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],rJ=1024,aJ=65535,e5=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function oJ(){const e=r0(),t=e.state,n=e.savingField!==null,[i,r]=v.useState("general"),o=gs(),u=_c(),h=xc(),p=uJ(h.plugins),f=dJ(p),g=_=>{r(_),u({pathname:"/settings",search:_==="general"?"":`?section=${encodeURIComponent(_)}`})};return v.useEffect(()=>{const _=new AbortController;return QO(_.signal),()=>_.abort()},[]),v.useEffect(()=>{const _=new URLSearchParams(o.search).get("section"),b=new Set([...e5.map(w=>w.id),...p.map(w=>w.id)]),S=_&&b.has(_)?_:"general";r(S),_&&_!==S&&u({pathname:"/settings",search:""},{replace:!0})},[o.search,u,p]),c.jsxs("main",{className:"global-settings-page",children:[c.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[c.jsxs("div",{children:[c.jsx("p",{className:"bridge-kicker",children:"Console"}),c.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),c.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?"Saving…":""})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,c.jsxs("section",{className:"global-settings-grid",children:[c.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[c.jsx("p",{className:"global-settings-nav-group",children:"Console"}),e5.map(_=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${_.id===i?"is-active":""}`,"aria-pressed":_.id===i,onClick:()=>g(_.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:_.label}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:_.eyebrow})]},_.id)),p.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),f.map(_=>c.jsxs("div",{className:"global-settings-plugin-group",children:[c.jsx("p",{className:"global-settings-plugin-heading",children:_.pluginLabel}),_.sections.map(b=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${b.id===i?"is-active":""}`,"aria-pressed":b.id===i,onClick:()=>g(b.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:b.sectionTitle}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:b.pluginLabel})]},b.id))]},_.pluginId))]}):null]}),c.jsx("div",{className:"global-settings-detail",children:cJ(i,t,n,p)},i)]})]})}function lJ({render:e}){return c.jsx(c.Fragment,{children:e()})}function cJ(e,t,n,i){if(e.includes(":")){const r=i.find(o=>o.id===e);return r?.render?c.jsx(ep,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:c.jsx(lJ,{render:r.render})}):c.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return c.jsxs(c.Fragment,{children:[c.jsx(fJ,{state:t,saving:n}),c.jsx(pJ,{state:t,saving:n}),c.jsx(mJ,{state:t,saving:n})]});case"backend-api":return c.jsx(JZ,{})}}function uJ(e){return e.flatMap(t=>(t.settingsSections??[]).map(n=>({id:`${t.id}:${n.id}`,pluginId:t.id,pluginLabel:hJ(t.id),sectionTitle:n.title,render:n.render})))}function dJ(e){const t=[];for(const n of e){const i=t.at(-1);if(i?.pluginId===n.pluginId){t[t.length-1]={...i,sections:[...i.sections,n]};continue}t.push({pluginId:n.pluginId,pluginLabel:n.pluginLabel,sections:[n]})}return t}function hJ(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function fJ({state:e,saving:t}){const n=e?.theme??"instrument",i=r=>{if(ic().savingField!==null)return;const o=n;oc(r),Va("theme",r).then(u=>{u||oc(o)})};return c.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),c.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),c.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:nJ.map(r=>{const o=r.id===n;return c.jsxs("button",{type:"button","aria-pressed":o,className:`theme-card ${o?"is-active":""}`,disabled:t,onClick:()=>i(r.id),children:[c.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:r.swatch.map(u=>c.jsx("i",{style:{background:u}},u))}),c.jsx("span",{className:"theme-card-label",children:r.label}),c.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:o?c.jsx(yJ,{}):null})]},r.id)})})]}),c.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function pJ({state:e,saving:t}){const n=e?.uiFont??td,[i,r]=v.useState([]),[o,u]=v.useState(!0),[h,p]=v.useState(null);v.useEffect(()=>{const _=new AbortController;return xA({signal:_.signal}).then(b=>{r(b.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:w})=>({family:S,monospace:w}))),p(null)}).catch(b=>{_.signal.aborted||(r([]),p(b instanceof Error?b.message:"Installed fonts could not be loaded."))}).finally(()=>{_.signal.aborted||u(!1)}),()=>_.abort()},[]);const f=_=>{if(ic().savingField!==null)return;const b=n;ay(_),Va("uiFont",_).then(S=>{S||ay(b)})},g=_=>{const b=_.source==="builtin"?{source:"builtin",id:_.id,size:n.size}:{source:"system",familyName:_.familyName,size:n.size};f(b)};return c.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),c.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),c.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||n.source==="builtin"&&n.id==="manrope"&&n.size===Vl.defaultValue,onClick:()=>f(td),children:"Reset to Fleet default"})]}),c.jsx(SA,{builtIns:sp.map(({id:_,label:b,family:S,aliases:w,description:C})=>({id:_,label:b,family:S,aliases:w,description:C})),installedFonts:i,selected:n.source==="builtin"?{source:"builtin",id:n.id}:{source:"system",familyName:n.familyName},selectedSystemFont:n.source==="system"?n.familyName:null,fallbackStack:oT(td),previewText:"Fleet typography keeps operations readable.",size:n.size,sizeRange:Vl,loading:o,error:h,disabled:!e||t,onSelectionChange:g,onSizeCommit:_=>f({...n,size:_})}),c.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function mJ({state:e,saving:t}){const n=Js();return c.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?c.jsxs(c.Fragment,{children:[c.jsx(vJ,{state:e,saving:t,consoleState:n}),c.jsx(gJ,{state:e,saving:t}),c.jsx(_J,{state:e,saving:t})]}):c.jsx("p",{className:"global-settings-help",children:"Loading settings."}),c.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function gJ({state:e,saving:t}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Panel Motion"}),c.jsx("p",{className:"global-settings-help",children:"Stop panel animations when panels open, move, minimize, and restore. When off, your operating system's Reduce Motion setting is followed."})]}),c.jsx("button",{type:"button","aria-pressed":e.reducePanelMotion,className:`global-settings-toggle ${e.reducePanelMotion?"is-on":""}`,disabled:t,onClick:()=>{Va("reducePanelMotion",!e.reducePanelMotion)},children:"Reduce panel motion"})]})}function _J({state:e,saving:t}){return c.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),c.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),c.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:sJ.map(n=>{const i=e.language===n.id;return c.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,disabled:t,onClick:()=>{Va("language",n.id)},children:n.label},n.id)})}),c.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function vJ({state:e,saving:t,consoleState:n}){const[i,r]=v.useState(e.consoleStaticPort?.toString()??""),o=n.effectivePort,u=n.portMode==="static"&&!n.portHonored,h=n.requestedPort,p=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=i.trim(),g=Number(f),_=f.length>0,b=_&&t5(g),S=e.consolePortMode==="static"&&_&&!b;return v.useEffect(()=>{r(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),c.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",c.jsx("span",{className:"new-badge",children:"New"})]}),c.jsx("p",{className:"global-settings-help",children:"Dynamic lets the OS pick a free loopback port each time the console starts. Static pins a port you choose so the console URL stays the same across restarts."})]}),c.jsxs("div",{className:"console-port-control",children:[c.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:iJ.map(w=>{const C=e.consolePortMode===w.id;return c.jsx("button",{type:"button","aria-pressed":C,className:`segmented-option ${C?"is-active":""}`,disabled:t,onClick:()=>{Va("consolePortMode",w.id)},children:w.label},w.id)})}),c.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:c.jsxs("div",{className:"console-port-reveal-inner",children:[c.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),c.jsx("input",{id:"console-static-port-input",className:`console-port-input ${S?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:i,disabled:t,"aria-invalid":S,"aria-describedby":"console-static-port-hint",onChange:w=>{const C=w.target.value;r(C);const x=Number(C.trim());t5(x)&&Va("consoleStaticPort",x)}}),c.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${S?"is-invalid":""}`,children:"1024–65535"})]})}),c.jsxs("div",{className:`console-port-effective ${u?"is-fallback":""}`,"aria-live":"polite",children:[c.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),c.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",c.jsx("span",{children:o||"..."}),u?" · Dynamic":""]})]})]}),u&&h?c.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",c.jsx("strong",{children:h})," was unavailable — the console fell back to a ",c.jsx("strong",{children:"Dynamic"})," port and is running on ",c.jsxs("strong",{children:["127.0.0.1:",o||"..."]}),"."," ",p?c.jsxs(c.Fragment,{children:["Next restart will try ",c.jsx("strong",{children:e.consoleStaticPort}),"."]}):c.jsx(c.Fragment,{children:"Next restart will use a dynamic port."})]}):null,c.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function t5(e){return Number.isInteger(e)&&e>=rJ&&e<=aJ}function yJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function bJ(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function wd(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function SJ(e,t){return{...bJ(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const wJ=600,n5=360,i5="cubic-bezier(0.4, 0.14, 0.2, 1)";function pM(e){if(typeof document>"u"||h0())return;const t=mM(e);if(!Mp(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=gM(e);Mp(i)&&_M(n,i.getBoundingClientRect(),()=>xJ(i))})}function Pb(e){if(typeof document>"u"||h0())return;const t=gM(e);if(!Mp(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=mM(e);Mp(i)&&_M(n,i.getBoundingClientRect())})}function mM(e){return document.querySelector(`.canvas-operation[data-operation-id="${N1(e)}"]`)}function gM(e){return document.querySelector(`[data-side-bar-chip-id="${N1(e)}"]`)}function Mp(e){if(!e)return!1;const t=e.getBoundingClientRect();return t.width<=0||t.height<=0?!1:getComputedStyle(e).visibility!=="hidden"}function N1(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function _M(e,t,n){if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return;const i=document.createElement("div");if(i.className="panel-motion-ghost",i.setAttribute("aria-hidden","true"),i.style.left=`${e.left}px`,i.style.top=`${e.top}px`,i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,typeof i.animate!="function")return;document.body.appendChild(i);const{duration:r,easing:o}=CJ();let u=!1,h=null;const p=g=>{u||(u=!0,h!==null&&window.clearTimeout(h),i.remove(),g&&n?.())};let f;try{f=i.animate([{transform:"translate(0, 0) scale(1, 1)",opacity:.9},{transform:`translate(${t.left-e.left}px, ${t.top-e.top}px) scale(${t.width/e.width}, ${t.height/e.height})`,opacity:0}],{duration:r,easing:o})}catch{p(!1);return}h=window.setTimeout(()=>p(!0),r+120),f.onfinish=()=>p(!0),f.oncancel=()=>p(!1)}function xJ(e){e.classList.add("is-arrival-pulse"),window.setTimeout(()=>e.classList.remove("is-arrival-pulse"),wJ)}function CJ(){try{const e=getComputedStyle(document.documentElement);return{duration:kJ(e.getPropertyValue("--duration-slow"))??n5,easing:e.getPropertyValue("--ease-glide").trim()||i5}}catch{return{duration:n5,easing:i5}}}function kJ(e){const t=e.trim(),n=/^(\d+(?:\.\d+)?)(ms|s)$/.exec(t);if(!n)return null;const i=Number.parseFloat(n[1]);return n[2]==="s"?i*1e3:i}const s5=256,r5=176,Cv=12,wf=220,vM="fleet-console.map.radarCollapsed";function EJ({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:r,onJump:o}){const u=v.useRef(null),h=v.useRef(!1),p=v.useRef(null),[f,g]=v.useState(TJ),_=$p();if(v.useEffect(()=>{if(_){p.current===null&&(p.current=f,g(!0));return}p.current!==null&&(g(p.current),p.current=null)},[f,_]),r.width<=0||r.height<=0||i.zoom<=0)return null;const b=[...Object.entries(e).map(([T,B])=>({id:T,x:B.x,y:B.y,width:B.width,height:B.height})),...Object.entries(t).map(([T,B])=>({id:T,x:B.geometry.x,y:B.geometry.y,width:B.geometry.width,height:B.geometry.height}))];if(b.length===0)return null;const S=()=>{g(T=>{const B=!T;return _||AJ(B),B})};if(f)return c.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:c.jsx(NJ,{})});const w=s5-Cv*2,C=r5-Cv*2,x={x:-i.x/i.zoom,y:-i.y/i.zoom,width:r.width/i.zoom,height:r.height/i.zoom};let I=Math.min(x.x,...b.map(T=>T.x)),z=Math.min(x.y,...b.map(T=>T.y)),U=Math.max(x.x+x.width,...b.map(T=>T.x+T.width)),A=Math.max(x.y+x.height,...b.map(T=>T.y+T.height));I-=wf,z-=wf,U+=wf,A+=wf;const O=U-I,R=A-z,$=Math.min(w/O,C/R),H=(w-O*$)/2,J=(C-R*$)/2,Z=T=>H+(T-I)*$,K=T=>J+(T-z)*$,M=T=>{const B=u.current?.getBoundingClientRect();if(!B)return;const L=T.clientX-B.left,F=T.clientY-B.top;o({x:I+(L-H)/$,y:z+(F-J)/$})},N=T=>{T.stopPropagation(),h.current=!0,T.currentTarget.setPointerCapture(T.pointerId),M(T)},D=T=>{h.current&&(T.stopPropagation(),M(T))},j=T=>{h.current=!1;try{T.currentTarget.releasePointerCapture(T.pointerId)}catch{}};return c.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:s5,height:r5},children:[c.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),c.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:c.jsx(RJ,{})}),c.jsxs("div",{ref:u,className:"canvas-minimap-inner",style:{inset:Cv},onPointerDown:N,onPointerMove:D,onPointerUp:j,onPointerCancel:j,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[b.map(T=>c.jsx("div",{className:"canvas-minimap-operation",style:{left:Z(T.x),top:K(T.y),width:Math.max(2,T.width*$),height:Math.max(2,T.height*$),...n?.[T.id]?{"--user-accent":n[T.id]}:{}}},T.id)),c.jsx("div",{className:"canvas-minimap-view",style:{left:Z(x.x),top:K(x.y),width:x.width*$,height:x.height*$}})]})]})}function TJ(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vM)==="true"}catch{return!1}}function AJ(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vM,String(e))}catch{}}function RJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function NJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),c.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function LJ({viewport:e}){return c.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[c.jsx("div",{className:"operations-canvas-sea"}),c.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const MJ=["n","ne","e","se","s","sw","w","nw"],kv=320,Ev=200,jJ=1500;function OJ({operation:e,active:t,geometry:n,zoom:i,status:r,minimized:o=!1,maximized:u=!1,renderHidden:h=!1,focusLayerTarget:p=!1,topEdge:f=!1,interactionDisabled:g=!1,accentKey:_=null,children:b,onActivate:S,onClose:w,onMinimize:C,onMaximize:x,onRename:I,onSetAccent:z,onGeometryChange:U,onGeometryCommit:A,onRenderHiddenFocus:O}){const R=v.useRef(null),$=v.useRef(null),H=v.useRef(null),J=v.useRef(null),Z=v.useRef(null),K=v.useRef(n),M=v.useRef(!1),[N,D]=v.useState(null),[j,T]=v.useState(!1),[B,L]=v.useState(!1),F=e.title,W=E0({currentTitle:e.title,onBegin:()=>{re()},onCommit:Se=>{I(Se),M.current=!0}}),E=_?Xa(_):null,G=["canvas-operation",t?"is-active":"",o?"is-minimized":"",u?"is-maximized":"",f?"is-top-edge":"",B?"is-dragging":"",IJ(r)].filter(Boolean).join(" ");v.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current)},[]),v.useEffect(()=>{if(W.renaming||!M.current)return;M.current=!1;const Se=window.requestAnimationFrame(()=>$.current?.focus());return()=>window.cancelAnimationFrame(Se)},[W.renaming]),v.useLayoutEffect(()=>{if(!h||typeof document>"u")return;const Se=N!==null;Se&&D(null),(Se||R.current?.contains(document.activeElement))&&O?.()},[N,h,O]);const Y=()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},re=()=>{Y(),T(!1)},he=()=>{Y(),T(!0),Z.current=window.setTimeout(()=>{Z.current=null,T(!1)},jJ)};v.useEffect(()=>{!u&&!g&&!o||(H.current=null,J.current=null,L(!1))},[u,g,o]);const ae=()=>{!H.current&&!J.current||(H.current=null,J.current=null,L(!1))},ke=Se=>{re(),!(u||g)&&Se.button===0&&(Se.preventDefault(),Se.stopPropagation(),S(),H.current={pointerId:Se.pointerId,startX:Se.clientX,startY:Se.clientY,geometry:n,latest:n},L(!0),Se.currentTarget.setPointerCapture(Se.pointerId))},Re=Se=>{if(u||g)return;const We=H.current;if(!We||We.pointerId!==Se.pointerId)return;Se.preventDefault(),Se.stopPropagation();const xn={...We.geometry,x:We.geometry.x+(Se.clientX-We.startX)/i,y:We.geometry.y+(Se.clientY-We.startY)/i};We.latest=xn,U(xn)},De=Se=>{if(u||g){H.current=null,L(!1);return}const We=H.current;!We||We.pointerId!==Se.pointerId||(Se.preventDefault(),Se.stopPropagation(),H.current=null,L(!1),Se.currentTarget.releasePointerCapture(Se.pointerId),A(We.latest))},Ue=(Se,We)=>{u||g||(We.preventDefault(),We.stopPropagation(),S(),J.current={direction:Se,pointerId:We.pointerId,startX:We.clientX,startY:We.clientY,geometry:n,latest:n},L(!0),We.currentTarget.setPointerCapture(We.pointerId))},Oe=Se=>{if(u||g)return;const We=J.current;if(!We||We.pointerId!==Se.pointerId)return;Se.preventDefault(),Se.stopPropagation();const xn=DJ(We.geometry,We.direction,(Se.clientX-We.startX)/i,(Se.clientY-We.startY)/i);We.latest=xn,U(xn)},Le=Se=>{if(u||g){J.current=null,L(!1);return}const We=J.current;!We||We.pointerId!==Se.pointerId||(Se.preventDefault(),Se.stopPropagation(),J.current=null,L(!1),Se.currentTarget.releasePointerCapture(Se.pointerId),A(We.latest))},we=Se=>{Se.stopPropagation()},Ie=Se=>{Se.stopPropagation(),re()},Qe=Se=>{Se.stopPropagation(),S()},dt=Se=>{Se.stopPropagation()},Je=()=>{re();const Se=typeof document<"u"?document.activeElement:null;Se instanceof HTMLElement&&R.current?.contains(Se)&&Se.blur(),C()},le=()=>{re(),x?.()},Ye=Se=>{re(),S(),D(Se)},Pe=Se=>{Se.stopPropagation(),re(),S()},At=()=>{if(!j){he();return}re(),w()},Zt=Se=>{Se.stopPropagation(),W.begin()},fn=Se=>{Se.key!=="Enter"&&Se.key!=="F2"||(Se.preventDefault(),Se.stopPropagation(),W.begin())},wt=Se=>{Se.key==="Escape"&&(M.current=!0),W.handleKeyDown(Se)};o||(K.current=n);const Kt=o?K.current:n,xt={left:Math.round(Kt.x),top:Math.round(Kt.y),width:Math.round(Kt.width),height:Math.round(Kt.height),zIndex:Kt.zIndex,...h?{visibility:"hidden",pointerEvents:"none"}:{},...E?{"--user-accent":E}:{}};return c.jsxs("article",{ref:R,className:G,style:xt,onPointerDown:S,"data-canvas-operation":!0,"data-operation-id":e.id,"data-focus-layer-target":p?"true":void 0,"aria-label":`Operation ${F}`,"aria-hidden":h||void 0,tabIndex:p?-1:void 0,inert:o||h?!0:void 0,children:[E?c.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!u&&!g?c.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:ke,onPointerMove:Re,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:ae,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,c.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:ke,onPointerMove:Re,onPointerUp:De,onPointerCancel:De,onLostPointerCapture:ae,"data-canvas-blocker":!0,children:[E?c.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,W.renaming?c.jsx("input",{ref:W.inputRef,className:"canvas-operation-identity-input",value:W.draftTitle,"aria-label":`Rename operation ${F}`,onChange:Se=>W.setDraftTitle(Se.target.value),onKeyDown:wt,onBlur:W.handleBlur,onPointerDown:Ie}):c.jsx("button",{ref:$,type:"button",className:"canvas-operation-identity-name",onPointerDown:Ie,onDoubleClick:Zt,onKeyDown:fn,"aria-label":`Rename operation ${F}`,title:`${F} — Double-click, Enter, or F2 to rename`,children:F}),z?c.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:we,onClick:Se=>Ye(Se.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${F}`,"aria-haspopup":"menu",title:"Set accent",children:c.jsx("span",{className:a5(r),"aria-hidden":"true"})}):c.jsx("span",{className:a5(r),onPointerDown:Pe,"aria-hidden":"true"}),c.jsxs("div",{className:"canvas-operation-window-controls",children:[c.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:we,onClick:Je,"aria-label":`Minimize operation ${F}`,title:"Minimize operation",children:c.jsx(BJ,{})}),x?c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${u?"is-active":""}`,onPointerDown:we,onClick:le,"aria-label":u?`Restore operation ${F}`:`Maximize operation ${F}`,"aria-pressed":u,title:u?"Restore operation":"Maximize operation",children:u?c.jsx($J,{}):c.jsx(PJ,{})}):null,c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${j?"is-armed-close":""}`,onPointerDown:we,onClick:At,"aria-label":j?`Confirm close operation ${F}`:`Close operation ${F}`,title:j?"Confirm close":"Close operation",children:j?"Close?":c.jsx(zJ,{})})]})]}),c.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:F}),c.jsx("div",{className:"canvas-operation-terminal",onPointerDown:Qe,onWheel:dt,"data-canvas-blocker":!0,children:b}),!u&&!g&&MJ.map(Se=>c.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${Se}`,onPointerDown:We=>Ue(Se,We),onPointerMove:Oe,onPointerUp:Le,onPointerCancel:Le,onLostPointerCapture:ae,"data-canvas-blocker":!0,"aria-hidden":"true"},Se)),N&&z?c.jsx(ZI,{anchor:N,accentKey:_,onSelect:z,onClose:()=>D(null)}):null]})}function DJ(e,t,n,i){let{x:r,y:o,width:u,height:h}=e;return t.includes("e")&&(u+=n),t.includes("s")&&(h+=i),t.includes("w")&&(r+=n,u-=n),t.includes("n")&&(o+=i,h-=i),u<kv&&(t.includes("w")&&(r-=kv-u),u=kv),h<Ev&&(t.includes("n")&&(o-=Ev-h),h=Ev),{...e,x:r,y:o,width:u,height:h}}function IJ(e){const t=Fp(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function a5(e){const t=Fp(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"tenant-beacon is-idle"}function BJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function PJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function $J(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function zJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function HJ({rect:e,viewport:t}){const n=SJ(e,t);return c.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const FJ=.25,UJ=2,WJ=200,qJ=150,o5=5,GJ=.0018;function KJ({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:r,onCreate:o,onConsumePointerDown:u,onClick:h}){const p=v.useRef(null),f=v.useRef(e),[g,_]=v.useState(null),[b,S]=v.useState(!1),[w,C]=v.useState(!1);v.useEffect(()=>{f.current=e},[e]),v.useEffect(()=>{const R=H=>{H.key==="Shift"&&C(!0),!VJ(H.target)&&H.code==="Space"&&(H.preventDefault(),S(!0))},$=H=>{H.key==="Shift"&&C(!1),H.code==="Space"&&S(!1)};return window.addEventListener("keydown",R),window.addEventListener("keyup",$),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",$)}},[]);const x=R=>{if(t||l5(R.target)||R.button!==0&&R.button!==1)return;if(R.preventDefault(),n){u?.();return}const $=Av(R),H=R.shiftKey&&R.button===0&&!b?"create":"pan";p.current={pointerId:R.pointerId,mode:H,startScreen:$,currentScreen:$,startViewport:f.current},R.currentTarget.setPointerCapture(R.pointerId),H==="create"&&_(Tv($,$,f.current))},I=R=>{const $=p.current;if(!$||$.pointerId!==R.pointerId)return;R.preventDefault();const H=Av(R);if(p.current={...$,currentScreen:H},$.mode==="pan"){i({...$.startViewport,x:$.startViewport.x+H.x-$.startScreen.x,y:$.startViewport.y+H.y-$.startScreen.y});return}_(Tv($.startScreen,H,f.current))},z=R=>{O(R,!0)},U=R=>{O(R,!1)},A=R=>{if(t||l5(R.target))return;R.preventDefault();const $=Av(R),H=f.current,J=YJ(H.zoom*Math.exp(-R.deltaY*GJ),FJ,UJ),Z=wd($,H);r({x:$.x-Z.x*J,y:$.y-Z.y*J,zoom:J})},O=(R,$)=>{const H=p.current;if(!H||H.pointerId!==R.pointerId||(p.current=null,R.currentTarget.releasePointerCapture(R.pointerId),_(null),!$))return;const J=Math.abs(H.currentScreen.x-H.startScreen.x),Z=Math.abs(H.currentScreen.y-H.startScreen.y);if(J<o5&&Z<o5){h?.();return}if(H.mode!=="create")return;const K=Tv(H.startScreen,H.currentScreen,f.current),M={x:K.x,y:K.y,width:Math.max(K.width,WJ),height:Math.max(K.height,qJ)};o(M,H.currentScreen)};return{rubberBand:g,spaceActive:b,shiftActive:w,onPointerDown:x,onPointerMove:I,onPointerUp:z,onPointerCancel:U,onWheel:A}}function Tv(e,t,n){const i=wd(e,n),r=wd(t,n),o=Math.min(i.x,r.x),u=Math.min(i.y,r.y);return{x:o,y:u,width:Math.abs(i.x-r.x),height:Math.abs(i.y-r.y)}}function Av(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function l5(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function VJ(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function YJ(e,t,n){return Math.min(n,Math.max(t,e))}const XJ="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",ZJ=560,JJ=360,QJ=12;function eQ({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:r,onLaunchAtGeometry:o,onClose:u,onFocus:h,onRename:p,onSetAccent:f}){const g=v.useRef(null),_=l0(),b=vT(),S=$p(),w=gT(),C=_T(),x=dD(C),I=v.useRef(null),z=yT(),U=e.activeOperationId,[A,O]=v.useState(null),R=xc(),[$,H]=v.useState({width:0,height:0}),J=aQ(),Z=!e.activeTheaterId||e.addingTheater;v.useEffect(()=>{const le=g.current;if(!le||typeof ResizeObserver>"u")return;const Ye=()=>H({width:le.clientWidth,height:le.clientHeight});Ye();const Pe=new ResizeObserver(Ye);return Pe.observe(le),()=>Pe.disconnect()},[]);const K=KJ({viewport:_.viewport,disabled:Z||S||C!==null,onViewportChange:Qv,onZoom:ST,onCreate:le=>{if(O(null),e.activeTheaterId&&n){const Ye=oQ(t);if(!Ye)return;const Pe={...iQ(le),zIndex:Ho()};o(Ye.pluginId,Ye.kind,Pe)}},consumePointerDown:A!==null,onConsumePointerDown:()=>{O(null)},onClick:nQ}),M=(le,Ye)=>{const Pe=A?.canvasPoint;O(null),Pe&&r(le,Ye,Pe)},N=le=>{if(le.target instanceof Element&&le.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;le.preventDefault();const Ye=g.current?.getBoundingClientRect();if(!Ye)return;const Pe={x:le.clientX-Ye.left,y:le.clientY-Ye.top};O({anchor:Pe,canvasPoint:wd(Pe,_.viewport)})},D=new Set(z);v.useEffect(()=>{e.activeOperationId&&D.has(e.activeOperationId)&&Ii(null)},[z,e.activeOperationId]);const j=Object.fromEntries(Object.entries(_.operations).filter(([le])=>!D.has(le))),T=(e.operations??[]).filter(le=>le.theaterId===e.activeTheaterId),B=R.operationKinds,F=w!==null&&T.some(le=>le.id===w&&!D.has(le.id))?w:null,W=C===null?void 0:T.find(le=>le.id===C&&!D.has(le.id)),E=W?B.find(le=>le.pluginId===W.pluginId&&le.type===W.type):void 0;C===null&&(I.current=null),W&&E?.companions?.length&&(I.current={operation:W,descriptor:E});const G=!W&&I.current?.operation.id===C?I.current:null,Y=W??G?.operation,he=(E??G?.descriptor)?.companions??[],ae=he.filter(le=>x[le.id]??!le.defaultHidden),ke=he.filter(le=>!ae.includes(le)).map(le=>le.id),Re=Y&&he.length>0?Y.id:null,De=W&&E?.companions?.length?W.id:null,Ue=Y&&!T.some(le=>le.id===Y.id)?[...T,Y]:T,Oe=Ue.length>0;v.useEffect(()=>{if(C===null||De!==null)return;const le=setTimeout(()=>{I.current=null,Xs()},1500);return()=>clearTimeout(le)},[C,De]);const Le=b0(T,e.groups.filter(le=>le.theaterId===e.activeTheaterId),_.operationOrder,[]).filter(le=>!D.has(le.id)).map(le=>le.id),we=S?mD({x:0,y:0,width:$.width,height:$.height},Le.length,void 0,void 0,void 0,void 0,b):[],Ie=new Map(Le.map((le,Ye)=>[le,we[Ye]]));v.useEffect(()=>{if(!S||h0())return;const le=g.current;if(!le)return;const Ye=Le.map(Zt=>le.querySelector(`.canvas-operation[data-operation-id="${N1(Zt)}"]`)).filter(Zt=>Zt!==null);Ye.forEach((Zt,fn)=>{Zt.style.setProperty("--panel-stagger-delay",`${fn*40}ms`)});const Pe=()=>{for(const Zt of Ye)Zt.style.removeProperty("--panel-stagger-delay")},At=window.setTimeout(Pe,600+Ye.length*40);return()=>{window.clearTimeout(At),Pe()}},[S,b]);const Qe=F||Re||S?1:_.viewport.zoom,dt=rQ(_.operations)+1,Je=ae.length+1;return c.jsxs("main",{className:`operations-canvas ${K.spaceActive?"is-panning":""} ${K.shiftActive?"is-creating":""} ${J?"is-glance":""} ${F?"is-panel-maximized":""} ${Re?"is-companion-layout":""} ${S?"is-formation-view":""}`,onPointerDown:K.onPointerDown,onPointerMove:K.onPointerMove,onPointerUp:K.onPointerUp,onPointerCancel:K.onPointerCancel,onWheel:K.onWheel,onContextMenu:N,ref:g,tabIndex:-1,children:[c.jsx(LJ,{viewport:_.viewport}),c.jsx("div",{style:{transform:F||Re||S?"none":`translate(${Math.round(_.viewport.x)}px, ${Math.round(_.viewport.y)}px) scale(${_.viewport.zoom})`},className:"operations-canvas-world",children:Ue.map(le=>{const Ye=_.operations[le.id]??le.geometry??Rv(le),Pe=F===le.id,At=Re===le.id,Zt=(F!==null||Re!==null)&&!Pe&&!At,fn=Ie.get(le.id),wt=Pe?sQ($,dt):At?c5($,0,Je,dt):fn?{...Ye,...fn}:Ye,Kt=!Pe&&!At&&!fn&&_.viewport.y+wt.y*Qe<QJ*Qe;return lQ(le,{active:U===le.id,keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===le.id?e.keyboardFocusRequest.requestId:0,geometry:wt,topEdge:Kt,operationKindRegistry:B,status:e.operationStatus[le.id],theme:e.activeTheme,viewportZoom:Qe,minimized:D.has(le.id),maximized:Pe,companion:At,companions:At?ae:[],companionGeometries:At?ae.map((xt,Se)=>c5($,Se+1,Je,dt)):[],hiddenCompanionPanelIds:At?ke:[],formation:S,focusLayerHidden:Zt,onRenderHiddenFocus:()=>{const xt=g.current?.querySelector("[data-focus-layer-target='true']");if(xt){xt.focus();return}g.current?.focus()},accentKey:_.operationAccent[le.id]??d5(le),onActivate:()=>{Ii(le.id),!Pe&&!At&&!S&&ey(le.id,_.operations[le.id]??le.geometry??Rv(le))},onClose:()=>{e.activeOperationId===le.id&&Ii(null),F===le.id&&Ya(),Re===le.id&&Xs(),u(le.id)},onMinimize:()=>{e.activeOperationId===le.id&&Ii(null),pM(le.id),wT(le.id)},onMaximize:()=>{Pe?Ya():(Ii(le.id),c0(le.id))},onRename:xt=>{p(le.id,xt)},onSetAccent:xt=>{f(le.id,xt)},onGeometryChange:xt=>{!Pe&&!At&&!S&&ey(le.id,xt)},onGeometryCommit:xt=>{!Pe&&!At&&!S&&uQ(le.id,ur().operations[le.id]??xt)}})})}),Oe?null:c.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[c.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),c.jsx("p",{children:e.activeTheaterId?XJ:"Add a Theater from the top bar to start operations."})]}),K.rubberBand?c.jsx(HJ,{rect:K.rubberBand,viewport:_.viewport}):null,A?c.jsx(XT,{anchor:A.anchor,viewportBounds:tQ(g.current),placement:"cursor",catalog:t,canLaunch:n&&!S,renderKindIcon:i,onLaunchKind:M,onClose:()=>O(null)},`${A.anchor.x}:${A.anchor.y}`):null,c.jsx(EJ,{operations:j,pluginOperations:Object.fromEntries(T.filter(le=>!D.has(le.id)).map(le=>[le.id,{theaterId:le.theaterId,geometry:_.operations[le.id]??le.geometry??Rv(le)}])),accents:Object.fromEntries(T.flatMap(le=>{const Ye=_.operationAccent[le.id]??d5(le),Pe=Ye?Xa(Ye):null;return Pe?[[le.id,Pe]]:[]})),viewport:_.viewport,canvasSize:$,onJump:le=>Qv({x:$.width/2-le.x*_.viewport.zoom,y:$.height/2-le.y*_.viewport.zoom,zoom:_.viewport.zoom})})]})}function tQ(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function nQ(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Ii(null)}function iQ(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Rv(e){return e.geometry??{x:0,y:0,width:ZJ,height:JJ,zIndex:0}}function sQ(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function c5(e,t,n,i){const r=Math.max(1,n),o=8,u=Math.max(0,(e.width-o*(r-1))/r);return{x:t*(u+o),y:0,width:u,height:Math.max(0,e.height),zIndex:i}}function rQ(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function aQ(){const[e,t]=v.useState(!1),n=v.useRef(new Set);return v.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},r=h=>{!u5(h)||h.repeat||h.ctrlKey||h.metaKey||fM()||(n.current.add(h.code),t(!0))},o=h=>{u5(h)&&(n.current.delete(h.code),t(n.current.size>0))},u=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",r),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",u)}},[]),e}function u5(e){return e.code==="AltLeft"||e.code==="AltRight"}function oQ(e){const t=e.flatMap(n=>n.kinds.filter(i=>i.disabled!==!0).map(i=>({pluginId:n.id,kind:i})));return t.find(({kind:n})=>n.type==="shell")??t[0]??null}function d5(e){return typeof e.accent=="string"?e.accent:null}function lQ(e,t){const n=t.operationKindRegistry.find(h=>h.pluginId===e.pluginId&&h.type===e.type),i=t.geometry;if(!n?.render)return null;const r=om(()=>{Qi(null).then(fs).catch(()=>{})}),o=h=>{h?(Ii(e.id),xT(e.id)):SD()},u=(h,p)=>{hD(e.id,h,p)};return c.jsxs(v.Fragment,{children:[c.jsx(OJ,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:c.jsx(ep,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:c.jsx(h5,{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:n.render})})}),t.companions.map((h,p)=>c.jsx(cQ,{descriptor:h,geometry:t.companionGeometries[p],children:c.jsx(ep,{fallback:c.jsx("div",{className:"fc-plugin-error",children:"Plugin companion failed to render."}),children:c.jsx(h5,{active:t.active,capabilities:r,geometry:i,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:u,render:h.render})})},h.id))]},e.id)}function h5({active:e,keyboardFocusRequestId:t,capabilities:n,geometry:i,operation:r,theme:o,viewportZoom:u,onActivate:h,onClose:p,onGeometryChange:f,onRequestCompanions:g,companionsOpen:_,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S,render:w}){return w({operationId:r.id,theaterId:r.theaterId,pluginId:r.pluginId,type:r.type,operation:r,geometry:i,active:e,...t===void 0?{}:{keyboardFocusRequestId:t},zoom:u,theme:o,api:n.api,lifecycle:n.lifecycle,terminal:n.terminal,notifications:n.notifications,operations:n.operations,preferences:n.preferences,settings:n.settings,status:n.status,onActivate:h,onClose:p,onGeometryChange:f,onRequestCompanions:g,companionsOpen:_,hiddenCompanionPanelIds:b,onSetCompanionPanelVisible:S})}function cQ({descriptor:e,geometry:t,children:n}){const i={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return c.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:i,"data-canvas-operation":!0,"aria-label":`Companion ${e.title}`,children:[e.hideCaption?null:c.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[c.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),c.jsx("span",{className:"canvas-companion-caption-title",children:e.title})]}),c.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:r=>r.stopPropagation(),onWheel:r=>r.stopPropagation(),"data-canvas-blocker":!0,children:n})]})}async function uQ(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function yM(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(n=>n.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function bM(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function SM(e,t){const n=[],i=[];for(const r of e)t.has(r.operationId)?i.push(r):n.push(r);return{hidden:n,visible:i}}function $b(e){const t=new Map;for(const n of[...e].sort((i,r)=>r.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",r=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};r.notifications.push(n),t.set(i,r)}return[...t.values()].sort((n,i)=>{const r=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-r})}function wM(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}const dQ={ended:"Ended","input-waiting":"Waiting for input"},hQ={id:"alerts",title:"Alerts",icon:()=>c.jsx(pQ,{}),render:()=>c.jsx(fQ,{})};function fQ(){const e=Js(),t=_c(),[n,i]=v.useState(!1),r=v.useMemo(()=>bM(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=yM(e),u=SM(r,o).hidden,h=wM(u,e.notificationPreferences),p=$b(h),f=$b(u),g=zb(p,"input-waiting"),_=zb(p,"ended"),b=p.length===0,S=v.useCallback(w=>{lc(w.operationId),t("/operations")},[t]);return c.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[c.jsxs("div",{className:"alerts-panel-toolbar",children:[c.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[g>0?c.jsx("span",{className:"notification-tally is-input-waiting",children:g}):null,_>0?c.jsx("span",{className:"notification-tally is-ended",children:_}):null,b?c.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),c.jsx("button",{type:"button",className:`alerts-panel-settings-btn${n?" is-active":""}`,onClick:()=>i(w=>!w),"aria-expanded":n,"aria-label":"Notification settings",title:"Notification settings",children:c.jsx(vQ,{})})]}),n?c.jsx(mQ,{groups:f}):null,b?c.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):c.jsx("div",{className:"notification-dock-deck",children:p.map(w=>c.jsxs("section",{className:"notification-cluster-group",children:[c.jsxs("header",{className:"notification-cluster-group-head",children:[c.jsx("span",{className:"notification-cluster-theater",children:w.theaterLabel}),c.jsx("span",{className:"notification-cluster-group-count",children:w.notifications.length})]}),c.jsx("ul",{className:"notification-cluster-roster",children:w.notifications.map(C=>c.jsxs("li",{className:`notification-row is-${C.kind}`,children:[c.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),c.jsxs("span",{className:"notification-row-body",children:[c.jsx("span",{className:"notification-row-op",children:C.operationLabel}),c.jsx("span",{className:"notification-row-state",children:dQ[C.kind]})]}),c.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>S(C),"aria-label":`Open ${w.theaterLabel} ${C.operationLabel}`,children:"Open"})]},C.operationId))})]},w.theaterId??"__unknown__"))})]})}function pQ(){const e=Js();yA();const t=v.useMemo(()=>bM(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=yM(e),i=SM(t,n).hidden,r=wM(i,e.notificationPreferences),o=$b(r),u=o.reduce((f,g)=>f+g.notifications.length,0),h=zb(o,"input-waiting"),p=u===0?"muted":h>0?"awaiting":"ended";return c.jsxs("span",{className:`alerts-icon is-${p}`,"aria-hidden":"true",children:[c.jsx(_Q,{}),u>0?c.jsx("span",{className:"alerts-icon-badge",children:u}):null]})}function mQ({groups:e}){const t=Js(),n=gQ(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return c.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:i=>vI(i.currentTarget.checked)}),c.jsx("span",{children:"Mute all"})]}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:i=>yI(i.currentTarget.checked)}),c.jsx("span",{children:"Do not disturb"})]}),n.length>0?c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,n.map(i=>c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:i.theaterId?t.notificationPreferences.mutedTheaterIds[i.theaterId]===!0:!1,onChange:()=>{i.theaterId&&bI(i.theaterId)}}),c.jsx("span",{children:i.theaterLabel})]},i.theaterId))]})}function gQ(e,t,n){const i=new Map;for(const r of e)r.theaterId&&i.set(r.theaterId,r);for(const r of Object.keys(t))i.has(r)||i.set(r,{theaterId:r,theaterLabel:n.find(o=>o.id===r)?.label??r,notifications:[]});return[...i.values()]}function zb(e,t){let n=0;for(const i of e)for(const r of i.notifications)r.kind===t&&(n+=1);return n}function _Q(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[c.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function vQ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[c.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class L1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function yQ(e,t){const i=new URLSearchParams().toString();return Qa(Vn(e,`/search${i?`?${i}`:""}`))}async function bQ(e,t,n){return Qa(Vn(e,`/entry/${encodeURIComponent(t)}`))}async function xM(e,t="pending"){return Qa(Vn(e,`/drydock?status=${encodeURIComponent(t)}`))}async function SQ(e,t){return Qa(Vn(e,`/drydock/${encodeURIComponent(t)}`))}async function wQ(e){return Qa(Vn(e,"/schema"))}async function xQ(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Qa(Vn(e,n))}async function CQ(e,t,n,i){const r={action:n};return i!==void 0&&(r.reason=i),DQ(Vn(e,`/drydock/${encodeURIComponent(t)}/decision`),r)}async function kQ(e){return Qa(Vn(e,"/conflicts"))}async function EQ(e,t){return Qa(Vn(e,`/conflicts/${encodeURIComponent(t)}`))}async function TQ(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),CM(Vn(e,`/cowork/options?${i}`))}async function f5(e,t,n){return eo(Vn(e,"/cowork/sessions"),{entryId:t,...n})}async function AQ(e,t){try{return await CM(Vn(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof L1&&n.status===404)return null;throw n}}async function Nv(e,t,n){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function RQ(e,t,n){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function p5(e,t,n){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function NQ(e,t,n){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function LQ(e,t){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function MQ(e,t,n){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function jQ(e,t){return eo(Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function OQ(e,t,n,i){const r=new EventSource(`${Vn(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=u=>{try{const h=JSON.parse(u.data);if(!IQ(h))return;i(h,Number(u.lastEventId)||0)}catch{}};for(const u of["session","transcript","tool","done","error"])r.addEventListener(u,o);return()=>r.close()}function Vn(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function Qa(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await EM(e,t));return t.json()}async function DQ(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await EM(e,n));return n.json()}async function CM(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await kM(t);return t.json()}async function eo(e,t){const n=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await kM(n);return n.json()}async function kM(e){const t=await e.json().catch(()=>null);return new L1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function IQ(e){if(!e||typeof e!="object")return!1;const t=e;return["session","transcript","tool","done","error"].includes(t.type??"")&&(t.session===void 0||t.session!==null&&typeof t.session=="object")}async function EM(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Hb=new Set;let Gf=0;const nc={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function Hl(){return nc}function TM(e){return Hb.add(e),()=>Hb.delete(e)}function m5(e){Gf+=1,Kf({currentWorkspaceId:e,schemaCatalog:null})}async function jp(){const e=nc.currentWorkspaceId,t=Gf;Kf({loading:!0,error:null});try{const[n,i,r]=await Promise.all([yQ(e),xM(e,"pending").catch(()=>null),wQ(e).catch(()=>null)]);if(nc.currentWorkspaceId!==e||Gf!==t)return;Kf({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:r,loading:!1})}catch(n){if(nc.currentWorkspaceId!==e||Gf!==t)return;Kf({loading:!1,error:BQ(n)})}}function Kf(e){Object.assign(nc,e);for(const t of Hb)t(nc)}function BQ(e){return e instanceof Error?e.message:String(e)}const PQ=120;function Bi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function $Q(e,t){if(!t)return Bi(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?Bi(e):Bi(e.slice(0,n))+`<mark>${Bi(e.slice(n,n+t.length))}</mark>`+Bi(e.slice(n+t.length))}function zQ(e){return`<span class="codex-nav-tag">${Bi(e)}</span>`}function HQ(e,t,n){const i=t?e.tags.some(h=>h.toLowerCase().includes(t.toLowerCase())):!1,r=e.tags.slice(0,3).map(zQ).join(""),o=Bi(e.status??"current"),u=Bi(e.updated??"");return`<button
230
+ class="codex-nav-entry${n?" is-current":""}"
231
+ data-entry-id="${Bi(e.id)}"
232
+ type="button"
233
+ ${n?'aria-current="page"':""}
234
+ title="${Bi(e.title)}"
235
+ >
236
+ <span class="t">${$Q(e.title,i?"":t)}</span>
237
+ ${r?`<span class="tg">${r}</span>`:""}
238
+ <span class="meta">${o} · ${u}</span>
239
+ </button>`}function FQ(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(r=>r.toLowerCase().includes(n)))}function UQ(e,t){let n="",i=null,r="entries",o=null;e.innerHTML=`
240
+ <div class="codex-navigator">
241
+ <div class="codex-nav-modes" role="tablist" aria-label="Codex catalog">
242
+ <button type="button" role="tab" data-mode="entries" aria-selected="true">Entries</button>
243
+ <button type="button" role="tab" data-mode="schema" aria-selected="false">Schema</button>
244
+ </div>
245
+ <div class="codex-nav-search">
246
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
247
+ <input
248
+ class="codex-nav-search-input"
249
+ type="search"
250
+ placeholder="Search entries"
251
+ autocomplete="off"
252
+ spellcheck="false"
253
+ aria-label="Search Codex entries"
254
+ />
255
+ </div>
256
+ <div class="codex-nav-quick-row">
257
+ <button class="codex-nav-quick" data-action="drydock" type="button">
258
+ Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
259
+ </button>
260
+ <button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
261
+ </div>
262
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
263
+ <div class="codex-navigator-scroll">
264
+ <div class="codex-nav-list" id="codex-nav-list"></div>
265
+ </div>
266
+ </div>
267
+ `;const u=e.querySelector(".codex-nav-search-input"),h=e.querySelector("#codex-nav-list"),p=e.querySelector("#codex-nav-eyebrow"),f=e.querySelector("#codex-nav-drydock-badge");function g(w){if(e.querySelectorAll("[data-mode]").forEach(x=>x.setAttribute("aria-selected",String(x.dataset.mode===r))),u.hidden=r==="schema",r==="schema"){const x=w.schemaCatalog;p.textContent=`Schema · ${x?.templates.length??0} templates`,h.innerHTML=x?`
268
+ <button class="codex-nav-entry" type="button" ${x.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">Workspace schema</span><span class="meta">${x.schema.exists?Bi(x.schema.ref):"Unavailable"}</span></button>
269
+ ${x.templates.map(I=>`<button class="codex-nav-entry" type="button" data-template-id="${Bi(I.id)}"><span class="t">${Bi(I.id)}</span><span class="meta">${Bi(I.ref)}</span></button>`).join("")}`:'<div class="codex-nav-empty">Schema catalog unavailable.</div>',f.textContent=String(w.pendingPatchCount);return}const C=FQ(w.index,n);if(p.textContent=`Entries · ${C.length}`,f.textContent=String(w.pendingPatchCount),f.hidden=w.pendingPatchCount===0,w.loading&&w.index.length===0){h.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(w.error){h.innerHTML=`<div class="codex-nav-error" role="alert">${Bi(w.error)}</div>`;return}if(C.length===0){h.innerHTML=`<div class="codex-nav-empty">${n?"No entries match.":"No entries."}</div>`;return}h.innerHTML=C.map(x=>HQ(x,n,x.id===i)).join("")}function _(w){const C=w.target;if(!(C instanceof Element))return;const x=C.closest("[data-mode]");if(x?.dataset.mode==="entries"||x?.dataset.mode==="schema"){r=x.dataset.mode,g(Hl());return}if(C.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const z=C.closest("[data-template-id]");if(z?.dataset.templateId){t.onRequest({kind:"schema",templateId:z.dataset.templateId});return}const U=C.closest("[data-entry-id]");if(U?.dataset.entryId){i=U.dataset.entryId,g(Hl()),t.onRequest({kind:"entry",id:i});return}const A=C.closest("[data-action]");if(A?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(A?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function b(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=u.value,g(Hl())},PQ)}e.addEventListener("click",_),u.addEventListener("input",b);const S=TM(w=>g(w));return g(Hl()),{destroy(){S(),e.removeEventListener("click",_),u.removeEventListener("input",b),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(w){n="",i=null,u&&(u.value=""),g(Hl())}}}function WQ(e,t){t.initialTheaterId&&m5(t.initialTheaterId);const n=UQ(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=TM(()=>{});jp();const r=n.destroy.bind(n);return{destroy(){i(),r()},setTheater(o){m5(o),jp(),n.setTheater(o)}}}function Lt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zr(e){return Lt(e).replace(/"/g,"&quot;")}function qQ(e){const t=e.tags.map(i=>`<span class="chip chip-tag">${Lt(i)}</span>`).join(""),n=KQ(e);return`
270
+ <div class="meta-chips">
271
+ ${t}
272
+ ${n}
273
+ <span class="chip">Updated ${Lt(GQ(e.updated))}</span>
274
+ </div>
275
+ `}function AM(e){return e.map(t=>`<span class="chip chip-muted">${Lt(t)}</span>`).join("")}function GQ(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function KQ(e){const t=VQ(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Zr(t.title)}">${Lt(t.label)}</span>`:""}function VQ(e,t=new Date){const n=e.status,i=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return n==="deprecated"||n==="superseded"?{label:n,tone:"deprecated",title:i?`${n} · stale`:n}:i?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:n==="current"||n==="draft"?{label:n,tone:"neutral",title:n}:null}const YQ="active";function Lv(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Zr(t.id)}" data-toc-id="${Zr(t.id)}">${Lt(t.text)}</a>`).join("")}function g5(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],r=new Set(t.map(f=>f.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>r.has(f.id));if(i.length===0||o.length===0)return()=>{};const u=e.closest(".codex-reading-sheet-read"),h=new Set,p=new IntersectionObserver(f=>{for(const _ of f){const b=_.target instanceof HTMLElement?_.target.id:"";b&&(_.isIntersecting?h.add(b):h.delete(b))}const g=XQ(o,h)??ZQ(o,u)??o[0]?.id??null;_5(i,g)},{root:u,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of o)p.observe(f);return _5(i,o[0]?.id??null),()=>p.disconnect()}function XQ(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function ZQ(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const r of e)if(r.getBoundingClientRect().top-n<=80)i=r.id;else break;return i}function _5(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(YQ,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}function Op(e){return`/entry/${encodeURIComponent(e)}`}const RM=1<<20;function JQ(e,t){const n=e.replace(/\r\n/g,`
276
+ `).split(`
277
+ `),i=t.replace(/\r\n/g,`
278
+ `).split(`
279
+ `),r=n.length+1,o=i.length+1;if(r*o>RM)return i.map((g,_)=>({text:g,changed:n[_]!==g}));const u=Array.from({length:r},()=>new Uint16Array(o));for(let g=n.length-1;g>=0;g-=1)for(let _=i.length-1;_>=0;_-=1)u[g][_]=n[g]===i[_]?u[g+1][_+1]+1:Math.max(u[g+1][_],u[g][_+1]);const h=[];let p=0,f=0;for(;f<i.length;)p<n.length&&n[p]===i[f]?(h.push({text:i[f],changed:!1}),p+=1,f+=1):p<n.length&&u[p+1][f]>=u[p][f+1]?p+=1:(h.push({text:i[f],changed:!0}),f+=1);return h}function QQ(e,t){const n=v5(e),i=v5(t),r=n.length+1,o=i.length+1,u=[];if(r*o>RM){const g=Math.max(n.length,i.length);for(let _=0;_<g;_+=1){const b=n[_],S=i[_];S!==void 0&&S===b?u.push({markdown:S,kind:"same"}):(b!==void 0&&u.push({markdown:b,kind:"removed"}),S!==void 0&&u.push({markdown:S,kind:"added"}))}return y5(u)}const h=Array.from({length:r},()=>new Uint16Array(o));for(let g=n.length-1;g>=0;g-=1)for(let _=i.length-1;_>=0;_-=1)h[g][_]=n[g]===i[_]?h[g+1][_+1]+1:Math.max(h[g+1][_],h[g][_+1]);let p=0,f=0;for(;p<n.length||f<i.length;)p<n.length&&f<i.length&&n[p]===i[f]?(u.push({markdown:i[f],kind:"same"}),p+=1,f+=1):p<n.length&&(f>=i.length||h[p+1][f]>=h[p][f+1])?(u.push({markdown:n[p],kind:"removed"}),p+=1):(u.push({markdown:i[f],kind:"added"}),f+=1);return y5(u)}function v5(e){const t=[];let n=[],i=null;for(const r of e.replace(/\r\n/g,`
280
+ `).split(`
281
+ `)){const o=r.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
282
+ `)),n=[]);continue}if(n.push(r),i)o.startsWith(i)&&(i=null);else{const u=o.match(/^(`{3,}|~{3,})/);u&&(i=u[1])}}return n.length&&t.push(n.join(`
283
+ `)),t}function y5(e){const t=[];for(const n of e){const i=t[t.length-1];i&&i.kind===n.kind?t[t.length-1]={markdown:`${i.markdown}
284
+
285
+ ${n.markdown}`,kind:i.kind}:t.push(n)}return t}function Mv(e){return e.map(t=>({value:t,label:t}))}function eee({clis:e,models:t,efforts:n,cli:i,model:r,effort:o,onCliChange:u,onModelChange:h,onEffortChange:p}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"CLI"}),c.jsx(Ri,{label:"CLI",value:i,options:Mv(e),onChange:u,disabled:!e.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"Model"}),c.jsx(Ri,{label:"Model",value:r,options:Mv(t),onChange:h,disabled:!t.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:"Effort"}),c.jsx(Ri,{label:"Effort",value:o,options:Mv(n),onChange:p,disabled:!n.length,compact:!0})]})]})}const NM="fleet.codex.cowork.settings",tee="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",nee=32;function iee(e){let t=!1,n=null,i=null,r=0,o={clis:[],models:[],efforts:[]},u=lee(),h=[],p="",f="",g="",_=null,b="",S="idle",w=!1,C=null,x=!1,I=!1,z=!1,U=null,A=!1,O=!1,R=!1,$=null,H="",J="",Z="published",K=null,M=null,N=null;const D=()=>n?((!M||M.base!==n.baseDraft||M.draft!==n.draft)&&(M={base:n.baseDraft,draft:n.draft,lines:JQ(n.baseDraft,n.draft)}),M.lines):[],j=e.body.innerHTML,T=document.createElement("div");T.className="cowork-anchor";const B=document.createElement("div");B.className="cowork-dock-zone";const L=document.createElement("div");L.className="cowork-tip",L.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(T,B,L);const F=()=>{N?.unmount(),N=null},W=()=>{if(!z||t)return;const se=B.querySelector("[data-cowork-settings-host]");se&&(N||(N=I5.createRoot(se)),N.render(v.createElement(eee,{clis:o.clis,models:o.models,efforts:o.efforts,cli:u.cli,model:u.model,effort:u.effort,onCliChange:me=>E("cli",me),onModelChange:me=>E("model",me),onEffortChange:me=>E("effort",me)})))},E=(se,me)=>{if(u=se==="cli"?{cli:me,model:"",effort:""}:{...u,[se]:me},Ov(u),!n){se!=="effort"?Ye().then(()=>{re()}).catch(()=>{}):W();return}se!=="effort"?Ye().then(()=>We(()=>Nv(e.theaterId,n.id,u))).then(re).catch(et=>{J=et instanceof Error?et.message:"Cowork request failed.",re()}):We(()=>Nv(e.theaterId,n.id,u)).then(re).catch(()=>{})},G=()=>{if(t)return;const se=!!n&&n.state!=="closed",me=se?A?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(me!==Z){if(Z=me,!se){e.body.innerHTML=j;return}e.body.innerHTML=A?`<div class="cowork-rendered-diff" aria-label="Draft changes">${ree(jv(n.baseDraft),jv(n.draft))}</div>`:Bs(jv(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:et=>Op(et)}).html}},Y=()=>{if(t)return;if(!C){T.innerHTML="";return}const se=e.article.getBoundingClientRect().width||0,me=x?Math.min(340,se*.86)/2+8:56,et=Math.min(Math.max(C.left,me),Math.max(se-me,me)),Ne=`style="top:${C.top}px;left:${et}px"`;T.innerHTML=x?`<div class="cowork-composer" ${Ne} role="dialog" aria-label="Add a comment">
286
+ <blockquote>${Lt(S5(C.quote,140))}</blockquote>
287
+ <textarea class="cowork-composer-input" rows="2" placeholder="What should change here?" aria-label="Comment"></textarea>
288
+ <div class="cowork-composer-actions">
289
+ <button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">Cancel</button>
290
+ <button type="button" class="cowork-solid" data-cowork-action="add-comment">Add</button>
291
+ </div>
292
+ </div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${Ne}><span aria-hidden="true">✦</span>Comment</button>`,x&&T.querySelector(".cowork-composer-input")?.focus()},re=()=>{if(t)return;const se=!!n&&n.state!=="closed"&&n.state!=="applied";B.classList.add("is-open");const me=R||se&&n.state==="running"&&S!=="complete"&&S!=="stopped";e.body.classList.toggle("is-cowork-running",me);const et=se&&n.baseDraft!==n.draft,Ne=et?D().filter(Ge=>Ge.changed).length:0;Oe(`
293
+ ${he(me)}
294
+ ${I?Le():""}
295
+ ${z?we():""}
296
+ ${et&&!me?Ie(Ne):""}
297
+ <div class="cowork-bar${me?" is-running":""}" data-cowork-form>
298
+ ${me?'<span class="cowork-glow" aria-hidden="true"></span>':""}
299
+ <button type="button" class="cowork-chip${I?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${I}" aria-label="Annotations" ${me?"disabled":""}><span aria-hidden="true">✦</span>${h.length}</button>
300
+ <input class="cowork-dock-input" name="prompt" value="${Zr(H)}" placeholder="${h.length?"Add an instruction (optional)…":"Ask AI to revise this entry…"}" aria-label="Instruction" ${me?"disabled":""}>
301
+ <button type="button" class="cowork-chip cowork-chip--config${z?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${z}" aria-label="Agent settings" ${me?"disabled":""}>${Lt(u.cli||"agent")}</button>
302
+ ${me?'<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="Stop"><span aria-hidden="true"></span></button>':'<button type="button" class="cowork-send" data-cowork-action="send" aria-label="Send to AI">↑</button>'}
303
+ </div>
304
+ ${J?`<p class="cowork-error" role="alert">${Lt(J)}</p>`:""}`),W()},he=se=>{if(!(se||S!=="idle"))return"";const et=se?"running":S,Ne=se?"Editing entry":S==="complete"?"Revision complete":"Revision stopped",Ge=!!(b||p||se);return`<section class="cowork-revision-stream is-${et}${w?" is-collapsed":""}" aria-label="Cowork revision stream">
305
+ ${se?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
306
+ <header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${Ne}</small></span>${Ge?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!w}" aria-label="${w?"Expand":"Collapse"} Cowork stream"><span aria-hidden="true"></span></button>`:""}</header>
307
+ ${Ge?`<div class="cowork-revision-content" aria-hidden="${w}"><div class="cowork-revision-content-inner">
308
+ ${b||p?`<div class="cowork-revision-body">
309
+ ${b?`<p class="cowork-revision-instruction">${Lt(b)}</p>`:""}
310
+ ${p?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${g}</div></div>`:""}
311
+ </div>`:""}
312
+ ${se?'<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>Writing revision</strong></span></footer>':""}
313
+ </div></div>`:""}
314
+ </section>`},ae=()=>{_!==null&&window.clearTimeout(_),_=null},ke=()=>{f!==p&&(f=p,g=p?Bs(p).html:"")},Re=()=>{ke();const se=B.querySelector(".cowork-revision-output");if(!se){re();return}se.innerHTML=g;const me=se.closest(".cowork-revision-output-scroll");me&&(me.scrollTop=me.scrollHeight)},De=()=>{_===null&&(_=window.setTimeout(()=>{_=null,t||Re()},nee))},Ue=()=>{ae(),ke()},Oe=se=>{if(se===K)return;F(),K=se;const me=document.activeElement,et=me instanceof HTMLInputElement&&me.name==="prompt"&&B.contains(me)?"prompt":me instanceof HTMLTextAreaElement&&me.dataset.coworkComment&&B.contains(me)?`comment:${me.dataset.coworkComment}`:null;if(B.innerHTML=se,et==="prompt"){const Ne=B.querySelector(".cowork-dock-input");Ne?.focus(),Ne?.setSelectionRange(Ne.value.length,Ne.value.length)}else if(et?.startsWith("comment:")){const Ne=B.querySelector(`[data-cowork-comment="${CSS.escape(et.slice(8))}"]`);Ne?.focus(),Ne?.setSelectionRange(Ne.value.length,Ne.value.length)}},Le=()=>`
315
+ <div class="cowork-popover cowork-panel" role="region" aria-label="Annotations">
316
+ ${h.length===0?'<p class="cowork-empty">Select text in the document to add a comment.</p>':h.map(se=>`
317
+ <article class="cowork-card is-${se.status}">
318
+ <blockquote>${Lt(S5(se.quote,160))}</blockquote>
319
+ <textarea data-cowork-comment="${Zr(se.id)}" aria-label="Comment" placeholder="Add a comment" ${se.status==="sent"?"disabled":""}>${Lt(se.comment)}</textarea>
320
+ <footer><span class="cowork-card-status">${se.status==="sent"?"Sent":se.status==="done"?"Done":"Ready"}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${Zr(se.id)}" aria-label="Delete annotation">×</button></footer>
321
+ </article>`).join("")}
322
+ </div>`,we=()=>`
323
+ <div class="cowork-popover cowork-config" role="region" aria-label="Agent settings">
324
+ <div data-cowork-settings-host></div>
325
+ </div>`,Ie=se=>U?`<div class="cowork-review is-confirm"><span>${U==="apply"?"Apply these changes to the entry?":"Discard this draft?"}</span><button type="button" class="cowork-solid${U==="discard"?" cowork-solid--danger":""}" data-cowork-action="${U==="apply"?"apply-confirm":"discard-confirm"}">${U==="apply"?"Apply":"Discard"}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">Back</button></div>`:`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${se>0?`${se} changed line${se===1?"":"s"}`:"Removed content"}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${A?"View draft":"View diff"}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">Apply</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">Discard</button></div>`,Qe=()=>{if(!t){for(const se of[...e.body.querySelectorAll("mark.cowork-mark")]){const me=se.parentNode;if(me){for(;se.firstChild;)me.insertBefore(se.firstChild,se);me.removeChild(se)}}if(e.body.normalize(),!A)for(const se of h)se.quote&&dt(se)}},dt=se=>{const me=[],et=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let ue=et.nextNode();ue;ue=et.nextNode())me.push(ue);let Ne="";const Ge=[];for(const ue of me)Ge.push(Ne.length),Ne+=ue.data;const vt=Ne.indexOf(se.quote);if(vt<0)return;const V=vt+se.quote.length;for(let ue=0;ue<me.length;ue+=1){const be=Ge[ue],Ze=be+me[ue].data.length,Pt=Math.max(vt,be),gt=Math.min(V,Ze);if(Pt>=gt)continue;const je=document.createRange();je.setStart(me[ue],Pt-be),je.setEnd(me[ue],gt-be);const Me=document.createElement("mark");Me.className="cowork-mark",Me.dataset.annotationId=se.id;try{je.surroundContents(Me)}catch{}}},Je=se=>{const me=h.find(vt=>vt.id===se.dataset.annotationId);if(!me){L.hidden=!0;return}L.textContent=me.comment.trim()||"No comment yet",L.hidden=!1;const et=se.getBoundingClientRect(),Ne=e.article.getBoundingClientRect(),Ge=L.offsetWidth/2+8;L.style.top=`${Math.max(et.top-Ne.top-6,0)}px`,L.style.left=`${Math.min(Math.max(et.left+et.width/2-Ne.left,Ge),Math.max(Ne.width-Ge,Ge))}px`},le=()=>{G(),re(),Qe()},Ye=async()=>{o=await TQ(e.theaterId,u.cli,u.model||void 0);const se=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",me=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";u={cli:o.clis.includes(u.cli)?u.cli:o.clis[0]??"",model:o.models.includes(u.model)?u.model:se,effort:o.efforts.includes(u.effort)?u.effort:me},Ov(u)},Pe=async se=>{n=se;const me=se.annotations.map(aee),et=new Set(me.map(Ne=>Ne.id));h=[...me,...h.filter(Ne=>!et.has(Ne.id))],(se.cli||se.model||se.effort)&&(u={cli:se.cli??u.cli,model:se.model??u.model,effort:se.effort??u.effort},Ov(u));try{await Ye()}catch{}if(!t){if(n&&(n.cli!==u.cli||n.model!==u.model||n.effort!==u.effort))try{n=await Nv(e.theaterId,n.id,u)}catch{}t||(Zt(),le())}},At=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const se=await f5(e.theaterId,e.entryId,u);return await Pe(se),se};re(),Ye().then(re).catch(()=>{}),(async()=>{try{const se=await AQ(e.theaterId,e.entryId);!t&&se&&await Pe(se)}catch{}})();function Zt(){n&&(i?.(),i=OQ(e.theaterId,n.id,r,(se,me)=>{if(me&&me<=r)return;r=Math.max(r,me);const et=n?.state==="running";if(se.session&&(n=se.session),se.type==="transcript"&&se.text&&n?.state==="running"){p=S==="running"?p+se.text:se.text,S="running",De();return}se.type==="done"&&(Ue(),(!$?.cancelled||$.submitted)&&(S=et||O||S==="stopped"||!!p||!!b?"complete":"idle",h=h.map(Ge=>Ge.status==="sent"?{...Ge,status:"done"}:Ge),O&&(O=!1,n&&n.baseDraft!==n.draft&&(A=!0)))),(se.type==="error"||se.type==="session"&&et&&n?.state!=="running")&&(Ue(),S="stopped",O=!1,h=h.map(Ne=>Ne.status==="sent"?{...Ne,status:"pending"}:Ne)),se.type==="error"&&se.text&&(J=se.text),le()}))}async function fn(se,me){h=[...h,{id:oee(),quote:se,comment:me,status:"pending"}],C=null,x=!1,Y(),re(),Qe();try{await At(),await We(()=>RQ(e.theaterId,n.id,se)),await Kt()}catch{}}async function wt(se){h=h.filter(me=>me.id!==se),re(),Qe(),L.hidden=!0;try{await Kt()}catch{}}async function Kt(){n&&await We(()=>p5(e.theaterId,n.id,h.map(b5)))}async function xt(){if(R||n?.state==="running")return;const se=h.filter(Ge=>Ge.status!=="done"),me=H.trim(),et=me||(se.length?tee:"");if(!et)return;const Ne={cancelled:!1,submitted:!1};$=Ne,R=!0,h=se.map(Ge=>({...Ge,status:"sent"})),ae(),p="",f="",g="",b=me,S="running",w=!1,H="",I=!1,z=!1,re(),Qe();try{if(await At(),Ne.cancelled||$!==Ne||(await We(()=>p5(e.theaterId,n.id,h.map(b5))),Ne.cancelled||$!==Ne))return;Ne.submitted=!0,await We(()=>NQ(e.theaterId,n.id,et)),O=!0}catch{!Ne.cancelled&&$===Ne&&(O=!1,S="idle",h=h.map(Ge=>Ge.status==="sent"?{...Ge,status:"pending"}:Ge))}finally{!Ne.cancelled&&$===Ne&&(R=!1,$=null,re())}}async function Se(){if(!n)return;const se=n.id;try{J="",await jQ(e.theaterId,se)}catch(me){J=me instanceof Error?me.message:"Cowork request failed.",re();return}i?.(),i=null,r=0,h=[],ae(),p="",f="",g="",b="",S="idle",w=!1,U=null,A=!1;try{await Pe(await f5(e.theaterId,e.entryId,u))}catch{n=null,le()}}async function We(se){try{J="",n=await se(),le()}catch(me){throw J=me instanceof L1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(me.code)?"This entry changed or is busy. Your draft is safe; reopen the entry before applying.":me instanceof Error?me.message:"Cowork request failed.",le(),me}}const xn=se=>{if(x||n?.state==="running"||se.target instanceof Node&&T.contains(se.target))return;const me=window.getSelection(),et=me?.toString().trim()??"";if(!et||!me||me.rangeCount===0||!e.body.contains(me.anchorNode))return;const Ne=me.getRangeAt(0).getBoundingClientRect(),Ge=e.article.getBoundingClientRect();C={quote:et,top:Ne.bottom-Ge.top+8,left:Math.min(Math.max(Ne.left+Ne.width/2-Ge.left,0),Math.max(Ge.width,0))},Y()},$e=se=>{if(se.target instanceof Element){if(se.target.closest(".cowork-pill")){se.preventDefault();return}!T.contains(se.target)&&C&&(C=null,x=!1,Y())}},xe=se=>{if(se.target instanceof Element&&se.target.closest(".cowork-revision-output")){se.stopPropagation();return}if(se.key==="Escape"){C||x?(C=null,x=!1,Y()):(I||z||U)&&(I=!1,z=!1,U=null,re());return}const me=se.target;se.key==="Enter"&&!se.shiftKey&&me instanceof HTMLTextAreaElement&&me.classList.contains("cowork-composer-input")&&(se.preventDefault(),it()),se.key==="Enter"&&me instanceof HTMLInputElement&&me.name==="prompt"&&(se.preventDefault(),xt())},it=()=>{const se=T.querySelector(".cowork-composer-input")?.value.trim()??"";C&&fn(C.quote,se)},ht=se=>{if(!(se.target instanceof Element))return;const me=se.target.closest(".cowork-revision-output");me&&se.stopPropagation();const et=se.target.closest('[data-action="copy-code"]');if(et){const vt=et.closest("pre")?.getAttribute("data-code");if(!vt)return;see(et,vt);return}if(me)return;const Ne=se.target.closest("[data-cowork-action]");if(!Ne)return;const Ge=Ne.dataset.coworkAction;if(Ge==="comment"&&(x=!0,Y()),Ge==="cancel-comment"&&(C=null,x=!1,Y()),Ge==="add-comment"&&it(),Ge==="toggle-panel"&&(I=!I,z=!1,re()),Ge==="toggle-config"&&(z=!z,I=!1,re()),Ge==="toggle-revision"){w=!w;const vt=Ne.closest(".cowork-revision-stream");vt?.classList.toggle("is-collapsed",w),Ne.setAttribute("aria-expanded",String(!w)),Ne.setAttribute("aria-label",`${w?"Expand":"Collapse"} Cowork stream`),vt?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(w))}if(Ge==="send"&&xt(),Ge==="cancel-run"&&R&&$&&!$.submitted){$.cancelled=!0,R=!1,O=!1,S="stopped",h=h.map(vt=>vt.status==="sent"?{...vt,status:"pending"}:vt),re(),Qe();return}Ge==="toggle-diff"&&(A=!A,le()),Ge==="delete-annotation"&&Ne.dataset.annotationId&&wt(Ne.dataset.annotationId),Ge==="apply-arm"&&(U="apply",re()),Ge==="discard-arm"&&(U="discard",re()),Ge==="confirm-back"&&(U=null,re()),Ge==="apply-confirm"&&n&&(U=null,We(()=>MQ(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Ge==="discard-confirm"&&Se(),Ge==="cancel-run"&&n&&We(()=>LQ(e.theaterId,n.id)).then(()=>{S="stopped",h=h.map(vt=>vt.status==="sent"?{...vt,status:"pending"}:vt),re()}).catch(()=>{})},Dt=se=>{const me=se.target instanceof Element?se.target.closest("mark.cowork-mark"):null;me?Je(me):L.hidden||(L.hidden=!0)},Ct=()=>{L.hidden=!0},Bt=se=>{const me=se.target;if(me instanceof Element&&me.closest(".cowork-revision-output")){se.stopPropagation();return}if(me instanceof HTMLInputElement&&me.name==="prompt"){H=me.value;return}if(me instanceof HTMLTextAreaElement&&me.dataset.coworkComment){const et=me.dataset.coworkComment;h=h.map(Ne=>Ne.id===et?{...Ne,comment:me.value,status:"pending"}:Ne)}},Ni=se=>{const me=se.target;if(me instanceof Element&&me.closest(".cowork-revision-output")){se.stopPropagation();return}me instanceof HTMLTextAreaElement&&me.dataset.coworkComment&&Kt().catch(()=>{})};return e.article.addEventListener("mouseup",xn),e.article.addEventListener("mousedown",$e),e.article.addEventListener("keydown",xe),e.article.addEventListener("click",ht),e.article.addEventListener("input",Bt),e.article.addEventListener("change",Ni),e.article.addEventListener("mouseover",Dt),e.article.addEventListener("mouseleave",Ct),{destroy(){t=!0,ae(),F(),i?.(),e.article.removeEventListener("mouseup",xn),e.article.removeEventListener("mousedown",$e),e.article.removeEventListener("keydown",xe),e.article.removeEventListener("click",ht),e.article.removeEventListener("input",Bt),e.article.removeEventListener("change",Ni),e.article.removeEventListener("mouseover",Dt),e.article.removeEventListener("mouseleave",Ct),T.remove(),B.remove(),L.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function see(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const r=e.textContent;i.then(()=>{e.isConnected&&(e.textContent="Copied",window.setTimeout(()=>{e.isConnected&&(e.textContent=r)},1200))}).catch(()=>{})}function ree(e,t){return QQ(e,t).map(n=>{const i=Bs(n.markdown,{resolveWikiLink:r=>Op(r)}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function b5(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||"Please revise this passage."}}function aee(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function jv(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function S5(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function oee(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function lee(){try{const e=JSON.parse(localStorage.getItem(NM)??"{}");return{cli:typeof e.cli=="string"?e.cli:"claude",model:typeof e.model=="string"?e.model:"",effort:typeof e.effort=="string"?e.effort:"medium"}}catch{return{cli:"claude",model:"",effort:"medium"}}}function Ov(e){try{localStorage.setItem(NM,JSON.stringify(e))}catch{}}const LM={create_wiki:"+",update_wiki:"↻"},MM={create_wiki:"Create",update_wiki:"Update"};function cee(e,t){let n=!1,i=0,r=null,o=null,u=t,h="idle",p=null,f=null,g=null;nm(e);function _(A){const O=A.target;if(!(O instanceof Element))return;const R=O.closest("[data-patch-id]");if(R){A.preventDefault();const J=R.dataset.patchId||void 0;u.onPatchOpen?.(J);return}const $=O.closest("[data-entry-id]");if($?.dataset.entryId){A.preventDefault(),u.onRelatedClick($.dataset.entryId);return}const H=O.closest("[data-drydock-action]");if(H){A.preventDefault(),b(H.dataset.drydockAction);return}}function b(A){if(A){if(A==="back"){u.onPatchOpen?.(void 0);return}if(A==="approve"){h="approving",p=null,w();return}if(A==="approve-confirm"){S("approve",void 0);return}if(A==="reject"){h="rejecting",p=null,w();return}if(A==="reject-submit"){const O=e.querySelector("#queue-reject-reason")?.value.trim();if(!O){p="Rejection reason is required.",w();return}S("reject",O);return}if(A==="cancel"){h="idle",p=null,w();return}}}async function S(A,O){if(g){h="submitting",p=null,w();try{await CQ(u.theaterId,g,A,O),u.onDecided?.()}catch(R){h=A==="approve"?"approving":"rejecting",p=R instanceof Error?R.message:String(R),w()}}}function w(){const A=e.querySelector("[data-decision-bar-wrap]");A&&(A.innerHTML=jM(h,p))}e.addEventListener("click",_);function C(){o?.destroy(),o=null,r?.(),r=null}async function x(A){if(!n){xf(e,t.tocContainer),C();try{const O=await bQ(u.theaterId,A);if(n)return;const{index:R}=Hl(),{html:$,toc:H}=Bs(O.body,{omitDuplicateTitle:O.frontmatter.title,resolveWikiLink:K=>Op(K)});e.innerHTML=`
326
+ <article class="document">
327
+ <header class="document-header">
328
+ ${uee(O.frontmatter.title)}
329
+ <h1>${Lt(O.frontmatter.title)}</h1>
330
+ ${qQ(O.frontmatter)}
331
+ </header>
332
+ <div class="markdown-body" id="codex-reader-body">
333
+ ${$}
334
+ </div>
335
+ ${dee(O.frontmatter.id,O.frontmatter.tags,R)}
336
+ </article>
337
+ `,t.tocContainer.innerHTML=Lv(H);const J=e.querySelector("article");J&&H.length>0&&(r=g5(J,H,t.tocContainer));const Z=e.querySelector("#codex-reader-body");J&&Z&&(o=iee({theaterId:u.theaterId,entryId:A,title:O.frontmatter.title,article:J,body:Z,onApplied:()=>{x(A)}}))}catch(O){n||Cf(e,t.tocContainer,O)}}}async function I(A){if(!n){xf(e,t.tocContainer),C(),f=null,g=null,h="idle",p=null;try{if(A){const O=await SQ(u.theaterId,A);if(n)return;f=O.meta,g=A;const{html:R,toc:$}=Bs(O.wikiEntry.body,{omitDuplicateTitle:O.wikiEntry.title,resolveWikiLink:J=>Op(J)});e.innerHTML=pee(O,R),t.tocContainer.innerHTML=Lv($);const H=e.querySelector("article");H&&$.length>0&&(r=g5(H,$,t.tocContainer))}else{const O=await xM(u.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=hee(O.items,"Review queue — Pending patches")}}catch(O){n||Cf(e,t.tocContainer,O)}}}async function z(A){if(!n){xf(e,t.tocContainer),C();try{if(A){const O=await EQ(u.theaterId,A);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=_ee(O)}else{const O=await kQ(u.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=vee(O)}}catch(O){n||Cf(e,t.tocContainer,O)}}}async function U(A){const O=++i,R=u.theaterId;xf(e,t.tocContainer),C();try{const $=await xQ(R,A);if(n||O!==i||R!==u.theaterId)return;const{html:H,toc:J}=Bs($.content);e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>Schema</span></li><li><span aria-current="page">${Lt(A??"Workspace schema")}</span></li></ol></nav><h1>${Lt(A??"Workspace schema")}</h1><span class="queue-dl-mono">${Lt($.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${H}</div></article>`,t.tocContainer.innerHTML=Lv(J)}catch($){!n&&O===i&&R===u.theaterId&&Cf(e,t.tocContainer,$)}}return t.kind==="entry"&&t.initialEntryId?x(t.initialEntryId):t.kind==="drydock"?I(t.subId):t.kind==="conflicts"?z(t.subId):t.kind==="schema"&&U(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",_),C(),o?.destroy()},async setEntry(A){await x(A)},async navigateSub(A){t.kind==="drydock"?await I(A):t.kind==="conflicts"?await z(A):t.kind==="schema"&&await U(A)},refreshCallbacks(A){u={...u,...A}}}}function xf(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Cf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${Lt(i)}</div>`,t.innerHTML=""}function uee(e){return`
338
+ <nav class="breadcrumb" aria-label="Entry location">
339
+ <ol>
340
+ <li><span>Codex</span></li>
341
+ <li><span aria-current="page">${Lt(e)}</span></li>
342
+ </ol>
343
+ </nav>
344
+ `}function dee(e,t,n){const i=new Set(t),r=n.filter(o=>o.id!==e).map(o=>({entry:o,matchingTags:o.tags.filter(u=>i.has(u))})).filter(o=>o.matchingTags.length>0).sort((o,u)=>u.matchingTags.length-o.matchingTags.length||o.entry.title.localeCompare(u.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return r.length===0?"":`
345
+ <section class="related-list">
346
+ <h2>Related entries</h2>
347
+ <div class="related-items">
348
+ ${r.map(o=>`<button class="related-card" type="button" data-entry-id="${Zr(o.entry.id)}">
349
+ <strong>${Lt(o.entry.title)}</strong>
350
+ <span>${AM(o.matchingTags)}</span>
351
+ </button>`).join("")}
352
+ </div>
353
+ </section>
354
+ `}function hee(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
355
+ <article class="document">
356
+ <header class="document-header">
357
+ <nav class="breadcrumb" aria-label="Entry location">
358
+ <ol>
359
+ <li><span>Codex</span></li>
360
+ <li><span aria-current="page">Review queue</span></li>
361
+ </ol>
362
+ </nav>
363
+ <h1>${Lt(t)}</h1>
364
+ </header>
365
+ <div class="queue-row-list">
366
+ ${e.map(fee).join("")}
367
+ </div>
368
+ </article>
369
+ `}function fee(e){const t=e.op??"create_wiki",n=LM[t]??"?",i=MM[t]??"Patch",r=e.target??e.id,u=[yee(e.meta.createdAt)].filter(Boolean);return`
370
+ <button class="queue-row" type="button" data-patch-id="${Zr(e.id)}" aria-label="${Zr(i+": "+r)}">
371
+ <span class="queue-row-badge" aria-hidden="true">
372
+ <span class="op-badge">${n}</span>
373
+ </span>
374
+ <span class="queue-row-body">
375
+ <span class="queue-row-target">${Lt(r)}</span>
376
+ ${e.summary?`<span class="queue-row-summary">${Lt(e.summary)}</span>`:""}
377
+ ${u.length>0?`<span class="queue-row-meta">${u.map(Lt).join(" · ")}</span>`:""}
378
+ </span>
379
+ </button>
380
+ `}function pee(e,t){const{patch:n,meta:i,wikiEntry:r,targetExists:o}=e,u=n.frontmatter.op,h=LM[u]??"?",p=MM[u]??"Patch",f=o?"기존 문서 대체":"신규 문서 생성",g=i.status==="pending";return`
381
+ <article class="document">
382
+ <header class="document-header">
383
+ <nav class="breadcrumb" aria-label="Entry location">
384
+ <ol>
385
+ <li><span>Codex</span></li>
386
+ <li><span>Review queue</span></li>
387
+ <li><span aria-current="page">${Lt(p)}</span></li>
388
+ </ol>
389
+ </nav>
390
+ <button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
391
+ <h1><span class="op-badge">${h}</span> ${Lt(r.title)}</h1>
392
+ <p class="eyebrow">${Lt(n.frontmatter.target)} · v${r.version} · ${Lt(f)}</p>
393
+ ${mee(n.frontmatter.proposer,r.tags)}
394
+ </header>
395
+ <div class="markdown-body" id="codex-reader-body">
396
+ ${t}
397
+ </div>
398
+ <div class="queue-decision-section" data-decision-bar-wrap>
399
+ ${g?jM("idle",null):gee(i)}
400
+ </div>
401
+ </article>
402
+ `}function mee(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${Lt(e)}</span>`),t.length>0&&n.push(AM(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function jM(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
403
+ <p class="queue-decision-confirm">Apply this patch to the wiki?</p>
404
+ <div class="queue-action-buttons">
405
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
406
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
407
+ </div>
408
+ ${t?`<p class="queue-action-error">${Lt(t)}</p>`:""}
409
+ `:e==="rejecting"?`
410
+ <div class="queue-reject-form">
411
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
412
+ <div class="queue-action-buttons">
413
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
414
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
415
+ </div>
416
+ ${t?`<p class="queue-action-error">${Lt(t)}</p>`:""}
417
+ </div>
418
+ `:`
419
+ <div class="queue-action-buttons">
420
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
421
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
422
+ </div>
423
+ `}function gee(e){const t=e.status==="accepted",n=t?"✓ Approved":"✕ Rejected",i=t?"queue-decision-decided--approve":"queue-decision-decided--reject",r=e.reason?` · ${Lt(e.reason)}`:"";return`<p class="queue-decision-decided ${i}">${n}${r}</p>`}function _ee(e){return`
424
+ <article class="document">
425
+ <header class="document-header">
426
+ <nav class="breadcrumb" aria-label="Entry location">
427
+ <ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
428
+ </nav>
429
+ <h1>${Lt(e.id)}</h1>
430
+ <p class="eyebrow">Conflict · ${Lt(e.meta?.status??"open")}</p>
431
+ </header>
432
+ <div class="markdown-body">
433
+ ${e.current?`<h2>Current</h2><pre><code>${Lt(e.current)}</code></pre>`:""}
434
+ ${e.proposed?`<h2>Proposed</h2><pre><code>${Lt(e.proposed)}</code></pre>`:""}
435
+ </div>
436
+ </article>
437
+ `}function vee(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
438
+ <article class="document">
439
+ <header class="document-header">
440
+ <h1>Conflicts</h1>
441
+ </header>
442
+ <div class="markdown-body">
443
+ <ul class="queue-list">
444
+ ${e.map(t=>`<li class="queue-item">
445
+ <strong>${Lt(t.title||t.id)}</strong>
446
+ <span class="eyebrow">${Lt(t.status)}</span>
447
+ </li>`).join("")}
448
+ </ul>
449
+ </div>
450
+ </article>
451
+ `}function yee(e){try{const n=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(n<1)return"< 1h ago";if(n<24)return`${Math.floor(n)}h ago`;const i=n/24;return i<7?`${Math.floor(i)}d ago`:i<30?`${Math.floor(i/7)}w ago`:`${Math.floor(i/30)}mo ago`}catch{return""}}let Lo=null,xd=null,OM=null,Wa=null,Mo=null,za=null,Vf=null,Dv=null,Yf,Fb=0;function w5(e){OM=e}function bee(e,t){const n=xee();n.parentElement!==e&&e.appendChild(n),xd||(xd=WQ(n,{initialTheaterId:t,onRequest:i=>OM?.(i)}))}function See(e){xd?.setTheater(e)}function DM(e,t,n){const i=Cee(),r=kee(),o=i.parentElement,u=n.kind==="entry"&&Vf==="entry"&&n.initialEntryId===Dv;o&&o!==e&&(Fb=o.scrollTop),i.parentElement!==e&&e.appendChild(i),r.parentElement!==t&&t.appendChild(r),!za||Vf!==n.kind?(za?.destroy(),za=cee(i,{...n,tocContainer:r}),Vf=n.kind,Yf=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==Dv?za.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==Yf&&(Yf=n.subId,za.navigateSub(n.subId)),Dv=n.kind==="entry"?n.initialEntryId??null:null,za.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const h=u?Fb:0;requestAnimationFrame(()=>{e.scrollTop=h})}function wee(){const e=Wa?.parentElement;e&&(Fb=e.scrollTop)}function IM(){za?.destroy(),za=null,Vf=null,Yf=void 0,Wa?.parentElement&&Wa.parentElement.removeChild(Wa),Mo?.parentElement&&Mo.parentElement.removeChild(Mo)}function x5(){IM(),xd?.destroy(),xd=null,Lo?.parentElement&&Lo.parentElement.removeChild(Lo)}function xee(){return Lo||(Lo=document.createElement("div"),Lo.className="codex-host"),Lo}function Cee(){return Wa||(Wa=document.createElement("div"),Wa.className="codex-reader-host"),Wa}function kee(){return Mo||(Mo=document.createElement("div"),Mo.className="codex-toc-host"),Mo}const Eee={id:"codex",title:"Codex",icon:()=>c.jsx(Lee,{}),render:e=>c.jsx(Tee,{theaterId:e.theaterId})};function Tee({theaterId:e}){const t=Js(),n=v.useRef(null),i=v.useRef(null),r=v.useRef(null),o=v.useRef(""),[u,h]=v.useState(null),p=t.codexReader,f=p!==null,g=t.codexReaderExpanded,_=t.theaters.find(I=>I.id===t.activeTheaterId)??null,b=t.theaters.length>0,S=e??"",w=u?.contextKey===S&&u.hasWiki?u.id:null,C=w!==null,x=p?`${p.kind}:${p.kind==="entry"?p.entryId:p.kind==="drydock"?p.patchId??"":p.kind==="conflicts"?p.id??"":p.templateId??""}`:null;return v.useEffect(()=>{if(o.current=S,C_(),!e){h({contextKey:S,hasWiki:!1,id:null});return}Ree(e).then(I=>{o.current===S&&h({contextKey:S,...I})}).catch(()=>{o.current===S&&h({contextKey:S,hasWiki:!1,id:null})})},[S,e]),v.useEffect(()=>{u?.contextKey===S&&!u.hasWiki&&x5()},[S,u]),v.useEffect(()=>()=>x5(),[]),v.useEffect(()=>{if(!C||!w)return;const I=n.current;if(I)return bee(I,w),w5(z=>{z.kind==="entry"?cr({kind:"entry",entryId:z.id}):z.kind==="drydock"?cr({kind:"drydock",patchId:z.patchId}):z.kind==="conflicts"?cr({kind:"conflicts",id:z.id}):z.kind==="schema"&&cr({kind:"schema",templateId:z.templateId})}),()=>{w5(null)}},[C,w,f]),v.useEffect(()=>{C&&w&&See(w)},[C,w]),v.useEffect(()=>{if(!C||!w||!f||g||!i.current||!r.current||!p)return;const I=p.kind,z=I==="drydock"?p.patchId:I==="conflicts"?p.id:I==="schema"?p.templateId:void 0;DM(i.current,r.current,{initialEntryId:I==="entry"?p.entryId:"",kind:I,subId:z,theaterId:w,onRelatedClick:U=>cr({kind:"entry",entryId:U}),onClose:()=>C_(),onPatchOpen:U=>cr({kind:"drydock",patchId:U}),onDecided:()=>{jp(),cr({kind:"drydock",patchId:void 0})}})},[C,w,f,g,x]),v.useEffect(()=>{f||IM()},[f]),C?f?c.jsxs("div",{className:"codex-rail-host is-split",children:[c.jsxs("div",{className:"codex-doc-pane",children:[c.jsxs("div",{className:"codex-doc-pane-head",children:[c.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:Nf,children:"⤢ Expand"}),c.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:C_,children:"✕"})]}),c.jsx("div",{ref:i,className:"codex-doc-scroll"}),c.jsx("div",{ref:r,className:"codex-doc-toc-inline"})]}),c.jsx("div",{ref:n,className:"codex-nav-pane"})]}):c.jsx("div",{ref:n,className:"codex-rail-host"}):c.jsx(Aee,{activeTheater:_,hasTheaters:b})}function Aee({activeTheater:e,hasTheaters:t}){return t?c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),c.jsx("h1",{children:e?.label||"This Theater"}),c.jsx("p",{children:"Fleet Wiki data could not be loaded for this Theater."})]}):c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),c.jsx("h1",{children:"Add a Theater"}),c.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function Ree(e){const t=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!t.ok)throw new Error("codex_workspace_unavailable");return Nee(await t.json())}function Nee(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("invalid_codex_workspace");const t=e;if(Object.keys(t).length!==2||typeof t.hasWiki!="boolean")throw new Error("invalid_codex_workspace");if(t.hasWiki&&typeof t.id=="string"&&/^[0-9a-f]{12}$/.test(t.id))return{hasWiki:!0,id:t.id};if(!t.hasWiki&&t.id===null)return{hasWiki:!1,id:null};throw new Error("invalid_codex_workspace")}function Lee(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),c.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),c.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function Mee(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(r=>i===""||r.name.toLocaleLowerCase().includes(i)||r.title.toLocaleLowerCase().includes(i)?n==="all"?!0:r.tasksTotal<=0?!1:n==="complete"?r.tasksDone>=r.tasksTotal:r.tasksDone<r.tasksTotal:!1)}function jee(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function Ub(e){return e.replace(/\s+/g," ").trim()}function Oee(e,t){const n=i=>Ub(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function BM(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n))return"Unknown";const i=Math.max(0,Math.floor((t-n)/1e3));if(i<60)return"just now";const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Dee(e,t){return!Number.isFinite(t)||t<=0?null:Number.isFinite(e)?Math.round(Math.min(1,Math.max(0,e/t))*100):0}function Iee(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function Bee(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function Pee(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(Bee)?"ready":"blocked"}const $ee="plans-changed",zee=3e4;function Hee(e,t){let n=null,i=null,r=!1,o=!0;const u=()=>{const h=o;o=!1;let p=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener($ee,()=>{t()}),n.onopen=()=>{p+=1,h&&p===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(r||t(),i=setTimeout(()=>{i=null,r||u()},zee))}};return u(),()=>{r=!0,i!==null&&clearTimeout(i),n?.close()}}const Fee=360,Uee={id:"plans",title:"Plans",icon:Yee,render:e=>c.jsx(Wee,{...e})};function Wee(e){const t=e.theaterId;return c.jsx(qee,{...e},t)}function qee(e){const{requestExtraWidth:t,theaterId:n}=e,[i,r]=v.useState({kind:"no-theater"}),[o,u]=v.useState({kind:"loading"}),[h,p]=v.useState(null),[f,g]=v.useState(0),[_,b]=v.useState(0),[S,w]=v.useState(()=>new Set),C=v.useRef(0),x=v.useRef(0),I=v.useRef(null),z=v.useRef(o),U=v.useRef(null),A=v.useRef(!1),O=v.useRef(!1),R=v.useRef(null),$=v.useRef(null),H=h?.theaterId===n?h.name:null;v.useEffect(()=>{R.current=H},[H]),v.useEffect(()=>{const D=++C.current;if(!n){r({kind:"no-theater"});return}const j=I.current!==null,T=O.current;O.current=!1,j||r({kind:"loading"}),CO(n).then(B=>{if(D!==C.current)return;const L=new Map(B.plans.map(E=>[E.name,jee(E)])),F=I.current;if(F){const E=new Set(B.plans.filter(G=>F.get(G.name)!==L.get(G.name)).map(G=>G.name));E.size>0&&($.current&&clearTimeout($.current),w(E),$.current=setTimeout(()=>w(new Set),1200))}I.current=L,r({kind:"ready",plans:B.plans});const W=R.current;W&&(L.has(W)?L.get(W)!==U.current&&b(E=>E+1):(U.current=null,A.current=!0,b(E=>E+1)))}).catch(()=>{D===C.current&&(!j||T)&&r({kind:"error"})})},[n,f]),v.useEffect(()=>{const D=++x.current;if(!n||!H)return;const j=A.current;A.current=!1,!j&&z.current.kind==="ready"&&z.current.plan.name===H||(U.current=null,z.current={kind:"loading"},u({kind:"loading"})),kO(n,H).then(B=>{if(D===x.current){U.current=I.current?.get(B.name)??null;const L={kind:"ready",plan:B};z.current=L,u(L)}}).catch(()=>{D===x.current&&(z.current={kind:"error"},u({kind:"error"}))})},[_,H,n]),v.useEffect(()=>{if(n)return Hee(n,()=>{g(D=>D+1)})},[n]),v.useEffect(()=>()=>{$.current&&clearTimeout($.current)},[]),v.useLayoutEffect(()=>(t?.(H?Fee:null),()=>t?.(null)),[t,H]);const J=v.useCallback(D=>{n&&p({theaterId:n,name:D})},[n]),Z=v.useCallback(()=>{p(null),U.current=null,z.current={kind:"loading"},u({kind:"loading"})},[]),M=v.useCallback(()=>{O.current=!0,g(D=>D+1)},[]),N=v.useCallback(()=>b(D=>D+1),[]);return c.jsx("div",{className:"plans-panel-shell",children:c.jsxs("div",{className:`plans-root${H?" is-reader-open":""}`,onKeyDown:D=>{D.key==="Escape"&&H&&Z()},children:[H&&c.jsx(Kee,{state:o,onClose:Z,onRetry:N}),H&&c.jsx("div",{className:"plans-divider","aria-hidden":"true"}),c.jsx(Gee,{selectedName:H,state:i,onRetry:M,onSelect:J,pulsedNames:S})]})})}function Gee({selectedName:e,state:t,onRetry:n,onSelect:i,pulsedNames:r}){const[o,u]=v.useState(""),[h,p]=v.useState("all"),[f,g]=v.useState(null),_=v.useRef(new Map);if(t.kind==="no-theater")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Iv,{children:"Select a Theater to browse plans."})});if(t.kind==="loading")return c.jsx("div",{className:"plans-list-pane",children:c.jsx("div",{className:"plans-loading",children:"Loading plans…"})});if(t.kind==="error")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(PM,{message:"Unable to load plans.",onRetry:n})});if(t.plans.length===0)return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Iv,{detail:"Workspace-scoped Fleet Plans appear here.",children:"No plans yet."})});const b=Mee(t.plans,o,h),S=(x,I)=>{const z=(x+I+b.length)%b.length;_.current.get(b[z]?.name??"")?.focus()},w=(x,I)=>{(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),S(I,x.key==="ArrowDown"?1:-1))},C=(x,I)=>{x.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${I}`).then(()=>{g(I),window.setTimeout(()=>g(z=>z===I?null:z),1200)}).catch(()=>{})};return c.jsxs("div",{className:"plans-list-pane",children:[c.jsxs("div",{className:"plans-toolbar",children:[c.jsxs("label",{className:"plans-search-label",children:[c.jsx("span",{children:"Search plans"}),c.jsx("input",{className:"plans-search",value:o,onChange:x=>u(x.target.value)})]}),c.jsx("div",{className:"plans-filter-group","aria-label":"Plan status",children:["all","in-progress","complete"].map(x=>c.jsx("button",{type:"button",className:`plans-filter${h===x?" is-active":""}`,"aria-pressed":h===x,onClick:()=>p(x),children:x==="all"?"ALL":x==="in-progress"?"IN PROGRESS":"COMPLETE"},x))}),c.jsx("button",{type:"button",className:"plans-refresh",onClick:n,children:"REFRESH"})]}),c.jsxs("div",{className:"plans-list","aria-label":"Plans",children:[b.length===0&&c.jsx(Iv,{children:"No matching plans."}),b.map((x,I)=>{const z=Dee(x.tasksDone,x.tasksTotal),U=z===100;return c.jsxs("div",{className:`plans-row${e===x.name?" is-selected":""}${r.has(x.name)?" is-pulsing":""}`,children:[c.jsxs("button",{ref:A=>{A?_.current.set(x.name,A):_.current.delete(x.name)},type:"button",className:"plans-row-select",onClick:()=>i(x.name),onKeyDown:A=>w(A,I),children:[c.jsx("span",{className:"plans-row-name",children:x.name}),c.jsxs("span",{className:"plans-row-meta",children:[x.waveCount," waves · ",x.tasksDone,"/",x.tasksTotal," tasks · ",BM(x.updatedAt),x.executionMode==="parallel"?" · parallel":""]}),z!==null&&c.jsx("span",{className:"plans-progress-track","aria-label":`${z}% complete`,children:c.jsx("span",{className:`plans-progress-fill${U?" is-complete":""}`,style:{width:`${z}%`}})})]}),c.jsx("button",{type:"button",className:"plans-copy",onClick:A=>C(A,x.name),"aria-label":f===x.name?`Copied plans/${x.name}`:`Copy plans/${x.name}`,children:f===x.name?"COPIED":"COPY"})]},x.name)})]})]})}function Kee({state:e,onClose:t,onRetry:n}){return e.kind==="loading"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(Wb,{onClose:t})]}),c.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:"Plan"}),c.jsx(Wb,{onClose:t})]}),c.jsx(PM,{message:"Unable to load plan.",onRetry:n})]}):c.jsx(Vee,{plan:e.plan,onClose:t})}function Vee({plan:e,onClose:t}){const n=v.useMemo(()=>{const h=new DOMParser().parseFromString(Bs(e.content).html,"text/html");return Bv(h.body),h.body.innerHTML},[e.content]),i=v.useRef(null),r=v.useRef(null),o=v.useCallback((h,p)=>{const f=i.current;if(!f)return;const g=[...f.querySelectorAll(h)].find(b=>h==="h3"?Oee(b.textContent??"",p):Ub(b.textContent??"")===Ub(p));if(!g)return;const _=window.matchMedia("(prefers-reduced-motion: reduce)").matches;g.scrollIntoView({behavior:_?"auto":"smooth",block:"start"}),g.classList.remove("plans-heading-flash"),g.getBoundingClientRect(),g.classList.add("plans-heading-flash"),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>g.classList.remove("plans-heading-flash"),1200)},[]),u=v.useCallback(h=>{const p=h.target.closest('[data-action="copy-code"]');if(!p)return;const f=p.closest("pre")?.getAttribute("data-code");if(!f)return;navigator.clipboard?.writeText(f);const g=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=g},1200)},[]);return v.useEffect(()=>{const h=i.current;if(!h)return;nm(h),Bv(h);const p=new MutationObserver(()=>Bv(h));return p.observe(h,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>p.disconnect()},[n]),v.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsxs("div",{className:"plans-reader-heading",children:[c.jsx("h2",{className:"plans-reader-title",children:e.title}),c.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&c.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",BM(e.updatedAt)]})]}),c.jsx(Wb,{onClose:t})]}),c.jsxs("div",{className:"plans-reader-body",children:[c.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((h,p)=>{const f=Iee(h.tasksDone,h.tasksTotal);return c.jsxs("div",{className:`plans-wave is-${f}`,children:[c.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>o("h2",h.heading),children:h.heading}),h.tasksTotal>0&&c.jsxs("span",{className:"plans-wave-count",children:[h.tasksDone,"/",h.tasksTotal]}),h.lanes.length>0&&c.jsx("div",{className:"plans-lane-list",children:h.lanes.map((g,_)=>{const b=Pee(e.waves,p,g);return c.jsxs("div",{className:`plans-lane is-${b}`,children:[c.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>o("h3",g.heading),children:g.id??g.heading}),g.tasksTotal>0&&c.jsxs("span",{className:"plans-lane-count",children:[g.tasksDone,"/",g.tasksTotal]}),b==="ready"&&c.jsx("span",{className:"plans-lane-ready",children:"READY"})]},g.id??`${h.index}-${_}`)})})]},h.index)})}),c.jsx("div",{ref:i,className:"plans-markdown markdown-body",onClick:u,dangerouslySetInnerHTML:{__html:n}})]})]})}function Wb({onClose:e}){return c.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Iv({children:e,detail:t}){return c.jsxs("div",{className:"plans-empty",children:[c.jsx("span",{children:e}),t&&c.jsx("span",{className:"plans-empty-detail",children:t})]})}function PM({message:e,onRetry:t}){return c.jsxs("div",{className:"plans-error-state",children:[c.jsx("span",{children:e}),c.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Bv(e){for(const t of e.querySelectorAll("a[href]")){const n=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(n)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const n=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),i=t.tagName==="IMG"?"Image":"Media",r=t.ownerDocument.createElement("span");r.className="plans-md-blocked-image",r.textContent=n?`${i} blocked: ${n}`:`${i} blocked`,t.replaceWith(r)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const n=t.getAttribute("href")??t.getAttribute("xlink:href")??"";n!==""&&!n.startsWith("#")&&t.remove()}}function Yee(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const $M=[hQ,Eee,Uee];function Xee(e="right"){const{railPanels:t}=xc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const Zee=360;function Jee(e){const{codexReader:t}=Js();return e==="codex"&&t!==null?Zee:0}const zM=240,Qee=312,HM="fleet-console.rail.panelWidth",C5="Theater";function ete(){try{const e=localStorage.getItem(HM);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=zM)return t}}catch{}return Qee}function tte({theaterId:e,api:t}){const n=v.useSyncExternalStore($T,()=>Fo().theaters.find(R=>R.id===e)?.label??C5,()=>C5),i=v.useRef(null),r=yA(),o=bA(),u=R7(),h=v.useRef(o),p=Xee(),f=$M,_=[...f,...p].find(R=>R.id===r)??null,b=_!==null,S=Jee(r)+(_?.preferredExtraWidth??0)+A7(),w=v.useRef(S);w.current=S;const[C,x]=v.useState(ete),I=v.useRef(C),[z,U]=v.useState(!1);v.useLayoutEffect(()=>{h.current&&!o&&ZT(i.current,".command-band-rail-toggle"),h.current=o},[o]);const A=v.useCallback(R=>{R.preventDefault();const $=R.clientX,H=I.current;U(!0);const J=K=>{const M=$-K.clientX,N=window.innerWidth-148-w.current,D=Math.max(zM,Math.min(N,H+M));I.current=D,x(D)},Z=()=>{document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",Z),U(!1);try{localStorage.setItem(HM,String(I.current))}catch{}};document.addEventListener("pointermove",J),document.addEventListener("pointerup",Z)},[]),O=v.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:n},api:t,requestExtraWidth:R=>{r!==null&&T7(r,R)}}),[e,n,t,r]);return c.jsxs("div",{ref:i,className:`right-rail${b?" is-open":""}${o?" is-expanded":" is-closed"}${z?" is-dragging":""}${u==="overlay"?" is-overlay":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${b?C+S:0}px`},children:[c.jsxs("div",{className:"right-rail-panel-slot",children:[b&&c.jsx("div",{className:"right-rail-resize-handle",onPointerDown:A,"aria-hidden":"true"}),_&&c.jsx(nte,{activePanel:_,activeId:r,ctx:O,panelBehavior:u})]}),c.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:c.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[f.map(R=>c.jsx(k5,{panel:R,isActive:r===R.id},R.id)),f.length>0&&p.length>0?c.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,p.map(R=>c.jsx(k5,{panel:R,isActive:r===R.id},R.id))]})})]})}const nte=v.memo(function({activePanel:t,activeId:n,ctx:i,panelBehavior:r}){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"right-rail-panel-head",children:[c.jsx("span",{className:"right-rail-panel-title",children:t.title}),c.jsx("button",{className:`right-rail-float-toggle${r==="overlay"?" is-active":""}`,type:"button","aria-pressed":r==="overlay","aria-label":"Float panel over the Map",onClick:E7,children:"Float over Map"}),c.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:C7,children:"✕"})]}),c.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${n}`,children:t.render(i)})]})});function k5({panel:e,isActive:t}){const n=v.useCallback(()=>w7(e.id),[e.id]),i=typeof e.icon=="function"?e.icon():e.icon;return c.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:n,children:i})}const ite='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function ste(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:n}=Js(),i=v.useRef(null),r=v.useRef(null),o=v.useRef(null),u=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.kind==="conflicts"?e.id??"":e.templateId??""}`:null,h=e!==null&&t,p=v.useCallback(()=>{wee(),gI()},[]);return v.useEffect(()=>{if(!h)return;const f=e;document.body.setAttribute("data-codex-reading","true");const g=document.querySelector(".operations-canvas"),_=document.querySelector(".operations-side-bar");g?.setAttribute("inert",""),_?.setAttribute("inert","");const b=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&rte(i.current,S)};return window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0),document.body.removeAttribute("data-codex-reading"),g?.removeAttribute("inert"),_?.removeAttribute("inert");const S=f?.kind==="entry"?f.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(S?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${S}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[h]),v.useEffect(()=>{if(!h||!r.current||!o.current||!e)return;const f=e.kind,g=f==="drydock"?e.patchId:f==="conflicts"?e.id:f==="schema"?e.templateId:void 0;DM(r.current,o.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:g,theaterId:n,onRelatedClick:_=>{cr({kind:"entry",entryId:_}),Nf()},onClose:p,onPatchOpen:_=>{cr({kind:"drydock",patchId:_}),Nf()},onDecided:()=>{jp(),cr({kind:"drydock",patchId:void 0}),Nf()}}),requestAnimationFrame(()=>{i.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[h,u]),h?Qr.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),c.jsxs("div",{ref:i,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[c.jsxs("div",{className:"codex-reading-sheet-head",children:[c.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),c.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:p,children:"✕"})]}),c.jsxs("div",{className:"codex-reading-sheet-body",children:[c.jsx("div",{ref:r,className:"codex-reading-sheet-read"}),c.jsx("aside",{ref:o,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function rte(e,t){if(!e)return;const n=[...e.querySelectorAll(ite)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],r=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),r.focus()):document.activeElement===r&&(t.preventDefault(),i.focus())}const kf=om().api,qb=560,Gb=360,Xf=new Set;function ate({state:e,claimBootPanelMinimization:t}){const n=v.useRef(null),i=gT(),r=_T(),o=$p(),u=yT(),h=xc(),[p,f]=v.useState([]),g=v.useMemo(()=>ote(e).map(L=>L.id),[e.operations,e.activeTheaterId]),_=v.useRef(e),b=v.useRef(0);_.current=e,v.useEffect(()=>{yD(e.activeTheaterId)},[e.activeTheaterId]),v.useEffect(()=>{if(!e.activeTheaterId){f([]);return}R5().then(f).catch(()=>{})},[e.activeTheaterId]),v.useEffect(()=>{const L=F=>{if(!s8()||!F.altKey||F.metaKey||F.ctrlKey)return;const W=document.activeElement;if(W instanceof HTMLElement&&W.matches("input, textarea, [contenteditable='true']")&&!W.closest(".xterm"))return;if(F.code==="KeyF"&&!F.shiftKey){F.preventDefault(),F.stopImmediatePropagation(),wD();return}if(F.shiftKey||F.key!=="ArrowLeft"&&F.key!=="ArrowRight")return;const E=_.current,G=ur(),Y=mI(E.operations.filter(ae=>ae.theaterId===E.activeTheaterId),E.groups.filter(ae=>ae.theaterId===E.activeTheaterId),G.operationOrder,G.collapsedGroups,G.minimized);if(F.preventDefault(),F.stopImmediatePropagation(),Y.length===0)return;const re=Ds()??fr()??_.current.activeOperationId,he=pI(Y,re,F.key==="ArrowRight"?1:-1);he&&Pv(he,h.operationKinds,kf,b,()=>lc(he))};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[r,o,i,h.operationKinds]),v.useEffect(()=>{for(const W of g)_D(W);if(!e.operationsHydrated||(vD(g),!e.activeTheaterId))return;const L=t(e.activeTheaterId);if(L===null)return;const F=new Set([_.current.pendingOperationFocus,Ds(),fr()].filter(W=>W!==null));gD(L.filter(W=>!F.has(W)))},[t,g,e.activeTheaterId,e.operationsHydrated]);const S=v.useCallback(L=>{const F=_.current.operations.find(re=>re.id===L);if(!F)return;const W=ur(),E=W.operations[L]??F.geometry??cte(F);W.operations[L]||ey(L,E),W.minimized.includes(L)&&Pb(L),ty(L),Ii(L);const Y=lte(n.current);Y&&bD(L,Y)},[]);v.useEffect(()=>{const L=e.pendingOperationFocus;L!==null&&(Pv(L,h.operationKinds,kf,b,()=>S(L)),aI())},[S,h.operationKinds,e.pendingOperationFocus]);const w=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(L=>L.theaterId===e.activeTheaterId);const C=v.useCallback((L,F)=>h.plugins.find(E=>E.id===L)?.renderLaunchIcon?.(F)??null,[h.plugins]),x=v.useCallback((L,F,W)=>{if(!_.current.activeTheaterId)return;const E={...E5(W),zIndex:Ho()};$v(L,F,E,_.current.activeTheaterId,h.plugins)},[h.plugins]),I=v.useCallback((L,F)=>{if(!_.current.activeTheaterId)return;const W=ute(n.current),E={...E5(W),zIndex:Ho()};$v(L,F,E,_.current.activeTheaterId,h.plugins)},[h.plugins]),z=v.useCallback((L,F,W)=>{_.current.activeTheaterId&&$v(L,F,W,_.current.activeTheaterId,h.plugins)},[h.plugins]),U=v.useCallback(()=>{ST({x:0,y:0,zoom:1})},[]),A=v.useCallback(L=>{const F=_.current.operations.find(W=>W.id===L);if(F){if(F.theaterId!==_.current.activeTheaterId){b.current+=1,lc(L);return}Pv(L,h.operationKinds,kf,b,()=>S(L))}},[S,h.operationKinds]),O=v.useCallback(L=>{_.current.activeOperationId===L&&Ii(null),pM(L),wT(L)},[]),R=v.useCallback((L,F)=>{Rf(L,{accent:F}).then(()=>Qi(null)).then(fs).catch(()=>{})},[]),$=v.useCallback((L,F)=>{sT(L,F).then(()=>Qi(null)).then(fs).catch(()=>{})},[]),H=v.useCallback((L,F)=>{Rf(L,{groupId:F}).then(()=>Qi(null)).then(fs).catch(()=>{})},[]),J=v.useCallback((L,F,W)=>{TO({theaterId:L,name:F,color:"blue"}).then(E=>W?Rf(W,{groupId:E.id}).then(()=>{}):void 0).then(()=>Promise.all([Qi(null).then(fs),ko().then(Eo)])).catch(()=>{})},[]),Z=v.useCallback((L,F)=>{F&&b_(L,{color:F}).then(()=>ko()).then(Eo).catch(()=>{})},[]),K=v.useCallback((L,F)=>{b_(L,{name:F}).then(()=>ko()).then(Eo).catch(()=>{})},[]),M=v.useCallback(L=>{const F=new Map(_.current.groups.map(E=>[E.id,E])),W=L.flatMap((E,G)=>{const Y=F.get(E);return!Y||Y.order===G?[]:[b_(E,{order:G})]});W.length!==0&&Promise.allSettled(W).then(()=>ko()).then(Eo).catch(()=>{})},[]),N=v.useCallback(L=>{const F=new Map(_.current.theaters.map(E=>[E.id,E])),W=L.flatMap((E,G)=>{const Y=F.get(E);return!Y||Y.order===G?[]:[wO(E,G)]});W.length!==0&&Promise.allSettled(W).then(()=>EC(null)).then(oy).catch(()=>{})},[]),D=v.useCallback(L=>{AO(L).then(()=>Promise.all([Qi(null).then(fs),ko().then(Eo)])).catch(()=>{})},[]),j=v.useCallback(L=>{if(Xf.has(L))return;Ds()===L&&Xs(),Xf.add(L);const F=_.current.operations.find(E=>E.id===L)?.pluginId,W=(F?h.plugins.find(E=>E.id===F):null)??null;dte(L,W).finally(()=>Xf.delete(L))},[h.plugins]),T=v.useCallback(async L=>{HT();try{const F=await iT(L),W=await nT(F);FT(W),EC(null).then(oy).catch(()=>{})}catch(F){ly(F instanceof Error?F.message:String(F))}},[]),B=v.useCallback(async L=>{const F=()=>Promise.all([Qi(null).then(fs),ko().then(Eo)]).then(()=>{}).catch(()=>{});try{await EO(L),HC(L),await F()}catch(W){if(W instanceof hn&&W.status===404){HC(L),await F();return}ly(W instanceof Error?W.message:String(W))}},[]);return c.jsxs("div",{className:"console-body is-canvas",children:[c.jsx(i7,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:u,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:p,canLaunch:w,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:C,onLaunchKind:I,onResetView:U,onClose:j,onMinimize:O,onFocus:A,onSetAccent:R,onRename:$,onSetGroupId:H,onCreateGroup:J,onSetGroupColor:Z,onRenameGroup:K,onReorderGroups:M,onReorderTheaters:N,onUngroupAll:D,onSelectTheater:v0,onAddTheater:T,onCancelAddTheater:rI,onForgetTheater:B}),c.jsx("div",{className:"operations-center-stage",ref:n,children:c.jsx(eQ,{state:e,catalog:p,canLaunch:w,renderKindIcon:C,onLaunchKind:x,onLaunchAtGeometry:z,onClose:j,onFocus:A,onRename:$,onSetAccent:R})}),c.jsx(tte,{theaterId:e.activeTheaterId,api:kf}),c.jsx(ste,{})]})}async function Pv(e,t,n,i,r){const o=++i.current,u=LC(),h=Ds();if(h!==null){if(h===e){Ii(e),bo(e);return}const p=Fo().operations.find(b=>b.id===e),f=ur().minimized.includes(e),g=p&&t.find(b=>b.pluginId===p.pluginId&&b.type===p.type);let _=!0;if(p&&g?.companions?.length&&g.canOpenCompanions){try{_=await g.canOpenCompanions({api:n,operation:p})}catch{_=!1}const b=Fo(),S=b.operations.find(C=>C.id===e),w=!f&&ur().minimized.includes(e);if(i.current!==o||LC()!==u||Ds()!==h||b.activeTheaterId!==p.theaterId||mT()!==p.theaterId||w||Xf.has(e)||!S||S.pluginId!==p.pluginId||S.type!==p.type||S.theaterId!==p.theaterId)return}if(p&&(!g||!g.companions?.length||!_)){if(Xs(),ap()){ur().minimized.includes(e)&&Pb(e),ty(e),Ii(e),bo(e);return}r(),bo(e);return}Ii(e),xT(e),bo(e);return}if(fr()!==null){Ii(e),c0(e),bo(e);return}if(ap()){ur().minimized.includes(e)&&Pb(e),ty(e),Ii(e),bo(e);return}r(),bo(e)}function ote(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(cy)}function lte(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function cte(e){return e.geometry??{x:0,y:0,width:qb,height:Gb,zIndex:0}}function ute(e){const t=ur(),n=e?.clientWidth??800,i=e?.clientHeight??600;return wd({x:n/2,y:i/2},t.viewport)}function E5(e){return{x:e.x-qb/2,y:e.y-Gb/2,width:qb,height:Gb}}async function $v(e,t,n,i,r){const o=r.find(_=>_.id===e),h=om(()=>{Qi(null).then(fs).catch(()=>{})});let p=null;if(o?.launch?p=(await o.launch({theaterId:i,kind:t,geometry:n,operations:h.operations})).id:p=(await h.operations.create({theaterId:i,type:t.type,pluginId:e,title:t.title,geometry:n})).id,await Qi(null).then(fs).catch(()=>{}),!p)return;const f=mT()===i,g=Fo().operations.some(_=>_.id===p);uD(i)===null&&(f&&g&&fr()!==null?(Ii(p),c0(p)):lc(p))}async function dte(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Qi(null).then(fs).catch(()=>{})}const hte=3e4;let Ef=1e3,Hu=null,zv=null,Hv=!1;function FM(){Hu!==null&&(clearTimeout(Hu),Hu=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);fte(i.operation)&&nI(i.operation)}catch{}}),e.addEventListener("update:available",()=>{Cd()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{aM(JSON.parse(n.data))}catch{qE()}}),e.onopen=()=>{Ef=1e3,Cd()},e.onerror=()=>{e.close(),qE(),Hu=setTimeout(()=>{Hu=null,Ef=Math.min(Ef*2,hte),Qi().then(fs).catch(()=>{}).finally(FM)},Ef)}}function Cd(){if(zv){Hv=!0;return}zv=vO(Fo().activeTheaterId).then(KD).catch(()=>{}).finally(()=>{zv=null,Hv&&(Hv=!1,Cd())})}function fte(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const pte=6e3;function mte(){const e=Js(),t=v.useRef(new Set),n=v.useRef(null),i=gs(),r=xc(),o=r0(),u=uM(o.state?.language??"auto"),p=i.pathname.startsWith("/operations"),f=v.useMemo(()=>[...$M,...r.railPanels.filter(b=>(b.side??"right")==="right")].map(b=>({id:b.id,title:b.title})),[r.railPanels]),g=v.useCallback(b=>n.current===null||t.current.has(b)?null:(t.current.add(b),n.current),[]);v.useEffect(()=>{const b=om(()=>{Qi().then(fs).catch(()=>{})}),S=r.plugins.map(w=>w.install?.(b)).filter(w=>typeof w=="function");return()=>{for(const w of S)w()}},[r.plugins]),v.useEffect(()=>{GD(p)},[p]),v.useEffect(()=>{const b=new AbortController;tT(b.signal).then(C=>{eI(C),zC()}).catch(C=>{b.signal.aborted||(ct({theaterError:C instanceof Error?C.message:String(C)}),zC())});const S=Date.now();Qi(null,b.signal).then(C=>{n.current=C.filter(x=>x.ts.createdAt<S).map(x=>x.id),tI(C)}).catch(()=>{}),ko(null,b.signal).then(Eo).catch(()=>{}),Cd();const w=window.setTimeout(Cd,pte);return()=>{window.clearTimeout(w),b.abort()}},[]),v.useEffect(()=>(cM({locale:u}),TZ),[u]);const _=v.useRef(null);return v.useLayoutEffect(()=>{e.keyboardShortcutsOpen&&(_.current=pZ()??(document.activeElement instanceof HTMLElement?document.activeElement:null))},[e.keyboardShortcutsOpen]),v.useEffect(()=>{if(e.keyboardShortcutsOpen)return;const b=_.current;_.current=null,b?.isConnected&&b.focus()},[e.keyboardShortcutsOpen]),v.useEffect(()=>UZ({getSideBarCollapsed:()=>op().collapsed,setSideBarCollapsed:Xl,toggleOperationSearch:UT,toggleRailChrome:R0}),[]),c.jsxs("div",{className:"console-shell",children:[c.jsx(rZ,{operationsViewVisible:p}),c.jsx("main",{className:"console-route-content",children:c.jsxs(Bj,{children:[c.jsx(Dl,{path:"/",element:c.jsx(v_,{to:"/operations",replace:!0})}),c.jsx(Dl,{path:"/operations",element:c.jsx(ate,{state:e,claimBootPanelMinimization:g})}),c.jsx(Dl,{path:"/carrier-settings",element:c.jsx(v_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),c.jsx(Dl,{path:"/settings",element:c.jsx(oJ,{})}),c.jsx(Dl,{path:"*",element:c.jsx(v_,{to:"/operations",replace:!0})})]})}),c.jsx(bZ,{state:e,railPanels:f}),e.keyboardShortcutsOpen?c.jsx(tA,{onClose:fI}):null,c.jsx(DZ,{state:e}),c.jsx(dZ,{state:e}),c.jsx(EZ,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Zf,"react/jsx-runtime":Y6,"@fleet-console/sdk/plugin/browser":m4,"@fleet-console/sdk/settings/browser":L4,"@fleet-console/sdk/operations/browser":i4,"@fleet-console/sdk/notifications/browser":j4,"@fleet-console/sdk/react/browser":D4};oc("instrument");JD();const UM=()=>{document.documentElement.classList.toggle("reduce-panel-motion",ic().state?.reducePanelMotion===!0)};dT(UM);UM();try{const e=await lT();oc(e.theme),ay(e.uiFont),JO(e)}catch{}const gte=await GX();FM();const T5=document.querySelector("#app");T5&&I5.createRoot(T5).render(c.jsx(v.StrictMode,{children:c.jsx(oO,{basename:"/console",children:c.jsx(qX,{value:gte,children:c.jsx(mte,{})})})}));export{PF as _,_te as a,Kb as g,an as k,rd as p};