@dotobokuri/fleet-console 1.20.0 → 1.22.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 (63) hide show
  1. package/AGENTS.md +14 -12
  2. package/dist/cli.mjs +35 -19
  3. package/dist/client/assets/{_baseUniq-DuBqUdt5.js → _baseUniq-cap0P4FK.js} +1 -1
  4. package/dist/client/assets/{arc-Cu0mS4Rh.js → arc-yBqa09aK.js} +1 -1
  5. package/dist/client/assets/{architectureDiagram-Q4EWVU46-CXg6Ah4M.js → architectureDiagram-Q4EWVU46-Bug4qdr-.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-DXYQGD6D-BY8CIrjE.js → blockDiagram-DXYQGD6D-BkiIL2xt.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-AHTNJAMY-D4JbTs-7.js → c4Diagram-AHTNJAMY-DYY200Al.js} +1 -1
  8. package/dist/client/assets/channel-B3EqY8ya.js +1 -0
  9. package/dist/client/assets/{chunk-4BX2VUAB-BTO6mLsp.js → chunk-4BX2VUAB-DQKmhVxn.js} +1 -1
  10. package/dist/client/assets/{chunk-4TB4RGXK-C6Fnl7zd.js → chunk-4TB4RGXK-DHpmA3Zl.js} +1 -1
  11. package/dist/client/assets/{chunk-55IACEB6-B13wgLIz.js → chunk-55IACEB6-DeRDuQXE.js} +1 -1
  12. package/dist/client/assets/{chunk-EDXVE4YY-7-iC3e7j.js → chunk-EDXVE4YY-CNpnhSJm.js} +1 -1
  13. package/dist/client/assets/{chunk-FMBD7UC4-Dhpf1rPA.js → chunk-FMBD7UC4-BXGVABL-.js} +1 -1
  14. package/dist/client/assets/{chunk-OYMX7WX6-D2aEd21z.js → chunk-OYMX7WX6-WbJs4VwZ.js} +1 -1
  15. package/dist/client/assets/{chunk-QZHKN3VN-K-8aUXP6.js → chunk-QZHKN3VN-u3BLl6Sl.js} +1 -1
  16. package/dist/client/assets/{chunk-YZCP3GAM-COCKMROt.js → chunk-YZCP3GAM-BFESuhuJ.js} +1 -1
  17. package/dist/client/assets/classDiagram-6PBFFD2Q-BekEZLVJ.js +1 -0
  18. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BekEZLVJ.js +1 -0
  19. package/dist/client/assets/clone-CsVi9-Ni.js +1 -0
  20. package/dist/client/assets/{cose-bilkent-S5V4N54A-CQfKdtka.js → cose-bilkent-S5V4N54A-rouOsZjT.js} +1 -1
  21. package/dist/client/assets/{dagre-KV5264BT-BIgQcK4J.js → dagre-KV5264BT-QCUeCVpM.js} +1 -1
  22. package/dist/client/assets/{diagram-5BDNPKRD-D-Y1duEc.js → diagram-5BDNPKRD-DqerlFb_.js} +1 -1
  23. package/dist/client/assets/{diagram-G4DWMVQ6-BxBM0Lq2.js → diagram-G4DWMVQ6-BS3a1YGN.js} +1 -1
  24. package/dist/client/assets/{diagram-MMDJMWI5-DFEVkQuS.js → diagram-MMDJMWI5-BeauTcSV.js} +1 -1
  25. package/dist/client/assets/{diagram-TYMM5635-QUGnvkyH.js → diagram-TYMM5635-Ci2wLUUE.js} +1 -1
  26. package/dist/client/assets/{erDiagram-SMLLAGMA-BIdCiDyA.js → erDiagram-SMLLAGMA-9MnmiKch.js} +1 -1
  27. package/dist/client/assets/{flowDiagram-DWJPFMVM-C5-H9nJM.js → flowDiagram-DWJPFMVM-CiV9p5EU.js} +1 -1
  28. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CtEhaGN5.js → ganttDiagram-T4ZO3ILL-D6oNoENl.js} +1 -1
  29. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-DME3M-OV.js → gitGraphDiagram-UUTBAWPF-DESO385F.js} +1 -1
  30. package/dist/client/assets/{graph-G8vxctrf.js → graph-BZdl-RHy.js} +1 -1
  31. package/dist/client/assets/index-BKpCMFrm.js +380 -0
  32. package/dist/client/assets/index-cg8Uxys9.css +1 -0
  33. package/dist/client/assets/{infoDiagram-42DDH7IO-BDgcbpcl.js → infoDiagram-42DDH7IO-lc8vZnyi.js} +1 -1
  34. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-BvyDjOaY.js → ishikawaDiagram-UXIWVN3A-BfzvQXhn.js} +1 -1
  35. package/dist/client/assets/{journeyDiagram-VCZTEJTY-Bl3ma4Jh.js → journeyDiagram-VCZTEJTY-BS_Dr0EV.js} +1 -1
  36. package/dist/client/assets/{kanban-definition-6JOO6SKY-DDfQy5MY.js → kanban-definition-6JOO6SKY-Cw7oTQJN.js} +1 -1
  37. package/dist/client/assets/{layout-CJ_GouLh.js → layout-ChwcDQm8.js} +1 -1
  38. package/dist/client/assets/{linear-BYcESPB3.js → linear-C7GLbmND.js} +1 -1
  39. package/dist/client/assets/{mermaid.core-H_nCcZgd.js → mermaid.core-D9phfpQo.js} +4 -4
  40. package/dist/client/assets/{min-Dqa4snAF.js → min-p7Whc_Wi.js} +1 -1
  41. package/dist/client/assets/{mindmap-definition-QFDTVHPH-BdBfgYSw.js → mindmap-definition-QFDTVHPH-fl_SJKrw.js} +1 -1
  42. package/dist/client/assets/{pieDiagram-DEJITSTG-F6w3ulj-.js → pieDiagram-DEJITSTG-Btw7ckA5.js} +1 -1
  43. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-DjioXrlU.js → quadrantDiagram-34T5L4WZ-DB4iJlTI.js} +1 -1
  44. package/dist/client/assets/{requirementDiagram-MS252O5E-DCVw1H_U.js → requirementDiagram-MS252O5E-hXwV5Nhy.js} +1 -1
  45. package/dist/client/assets/{sankeyDiagram-XADWPNL6-KQYKD6-y.js → sankeyDiagram-XADWPNL6-DC-fizCk.js} +1 -1
  46. package/dist/client/assets/{sequenceDiagram-FGHM5R23-DjzGSEIS.js → sequenceDiagram-FGHM5R23-RrfrroR5.js} +1 -1
  47. package/dist/client/assets/{stateDiagram-FHFEXIEX-CVylZcMS.js → stateDiagram-FHFEXIEX-q8FUPV_e.js} +1 -1
  48. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-BErzXGq7.js +1 -0
  49. package/dist/client/assets/{timeline-definition-GMOUNBTQ-ChqpnE67.js → timeline-definition-GMOUNBTQ-tegMd8Od.js} +1 -1
  50. package/dist/client/assets/{vennDiagram-DHZGUBPP-DLzIQLVa.js → vennDiagram-DHZGUBPP-CXx5oN2X.js} +1 -1
  51. package/dist/client/assets/{wardley-RL74JXVD-1W-QRTwp.js → wardley-RL74JXVD-CxSJ3P_7.js} +1 -1
  52. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-noSoHkHg.js → wardleyDiagram-NUSXRM2D-DN1P180Z.js} +1 -1
  53. package/dist/client/assets/{xychartDiagram-5P7HB3ND-iHEYHXFI.js → xychartDiagram-5P7HB3ND-Dcn9ukv5.js} +1 -1
  54. package/dist/client/index.html +2 -2
  55. package/dist/fleet-plugins/terminal/routes.mjs +127 -111
  56. package/package.json +1 -1
  57. package/dist/client/assets/channel-BA4bj6Rn.js +0 -1
  58. package/dist/client/assets/classDiagram-6PBFFD2Q-DQxI6Hb4.js +0 -1
  59. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DQxI6Hb4.js +0 -1
  60. package/dist/client/assets/clone-Bfh7HIaB.js +0 -1
  61. package/dist/client/assets/index-Bjyh5AjN.css +0 -1
  62. package/dist/client/assets/index-UoTD8YUw.js +0 -404
  63. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CvMRv0mx.js +0 -1
@@ -0,0 +1,380 @@
1
+ function YS(e,t){for(var i=0;i<t.length;i++){const s=t[i];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const f=Object.getOwnPropertyDescriptor(s,o);f&&Object.defineProperty(e,o,f.get?f:{enumerable:!0,get:()=>s[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const f of o)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(o){const f={};return o.integrity&&(f.integrity=o.integrity),o.referrerPolicy&&(f.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?f.credentials="include":o.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function s(o){if(o.ep)return;o.ep=!0;const f=i(o);fetch(o.href,f)}})();function fm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $P(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var i=function s(){var o=!1;try{o=this instanceof s}catch{}return o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})}),i}var Yf={exports:{}},_l={};var $1;function Y5(){if($1)return _l;$1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(s,o,f){var p=null;if(f!==void 0&&(p=""+f),o.key!==void 0&&(p=""+o.key),"key"in o){f={};for(var c in o)c!=="key"&&(f[c]=o[c])}else f=o;return o=f.ref,{$$typeof:e,type:s,key:p,ref:o!==void 0?o:null,props:f}}return _l.Fragment=t,_l.jsx=i,_l.jsxs=i,_l}var U1;function X5(){return U1||(U1=1,Yf.exports=Y5()),Yf.exports}var u=X5();const Z5=fm(u),J5=YS({__proto__:null,default:Z5},[u]);var Xf={exports:{}},qe={};var F1;function Q5(){if(F1)return qe;F1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),S=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,m={};function b(D,U,q){this.props=D,this.context=U,this.refs=m,this.updater=q||T}b.prototype.isReactComponent={},b.prototype.setState=function(D,U){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,U,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function v(){}v.prototype=b.prototype;function x(D,U,q){this.props=D,this.context=U,this.refs=m,this.updater=q||T}var k=x.prototype=new v;k.constructor=x,w(k,b.prototype),k.isPureReactComponent=!0;var L=Array.isArray;function R(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(D,U,q){var Q=q.ref;return{$$typeof:e,type:D,key:U,ref:Q!==void 0?Q:null,props:q}}function K(D,U){return I(D.type,U,D.props)}function F(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function G(D){var U={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(q){return U[q]})}var B=/\/+/g;function Y(D,U){return typeof D=="object"&&D!==null&&D.key!=null?G(""+D.key):U.toString(36)}function W(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(R,R):(D.status="pending",D.then(function(U){D.status==="pending"&&(D.status="fulfilled",D.value=U)},function(U){D.status==="pending"&&(D.status="rejected",D.reason=U)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function z(D,U,q,Q,re){var ie=typeof D;(ie==="undefined"||ie==="boolean")&&(D=null);var Z=!1;if(D===null)Z=!0;else switch(ie){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(D.$$typeof){case e:case t:Z=!0;break;case _:return Z=D._init,z(Z(D._payload),U,q,Q,re)}}if(Z)return re=re(D),Z=Q===""?"."+Y(D,0):Q,L(re)?(q="",Z!=null&&(q=Z.replace(B,"$&/")+"/"),z(re,U,q,"",function(fe){return fe})):re!=null&&(F(re)&&(re=K(re,q+(re.key==null||D&&D.key===re.key?"":(""+re.key).replace(B,"$&/")+"/")+Z)),U.push(re)),1;Z=0;var H=Q===""?".":Q+":";if(L(D))for(var oe=0;oe<D.length;oe++)Q=D[oe],ie=H+Y(Q,oe),Z+=z(Q,U,q,ie,re);else if(oe=C(D),typeof oe=="function")for(D=oe.call(D),oe=0;!(Q=D.next()).done;)Q=Q.value,ie=H+Y(Q,oe++),Z+=z(Q,U,q,ie,re);else if(ie==="object"){if(typeof D.then=="function")return z(W(D),U,q,Q,re);throw U=String(D),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return Z}function V(D,U,q){if(D==null)return D;var Q=[],re=0;return z(D,Q,"","",function(ie){return U.call(q,ie,re++)}),Q}function X(D){if(D._status===-1){var U=D._result;U=U(),U.then(function(q){(D._status===0||D._status===-1)&&(D._status=1,D._result=q)},function(q){(D._status===0||D._status===-1)&&(D._status=2,D._result=q)}),D._status===-1&&(D._status=0,D._result=U)}if(D._status===1)return D._result.default;throw D._result}var j=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},P={map:V,forEach:function(D,U,q){V(D,function(){U.apply(this,arguments)},q)},count:function(D){var U=0;return V(D,function(){U++}),U},toArray:function(D){return V(D,function(U){return U})||[]},only:function(D){if(!F(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return qe.Activity=g,qe.Children=P,qe.Component=b,qe.Fragment=i,qe.Profiler=o,qe.PureComponent=x,qe.StrictMode=s,qe.Suspense=h,qe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,qe.__COMPILER_RUNTIME={__proto__:null,c:function(D){return N.H.useMemoCache(D)}},qe.cache=function(D){return function(){return D.apply(null,arguments)}},qe.cacheSignal=function(){return null},qe.cloneElement=function(D,U,q){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var Q=w({},D.props),re=D.key;if(U!=null)for(ie in U.key!==void 0&&(re=""+U.key),U)!A.call(U,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&U.ref===void 0||(Q[ie]=U[ie]);var ie=arguments.length-2;if(ie===1)Q.children=q;else if(1<ie){for(var Z=Array(ie),H=0;H<ie;H++)Z[H]=arguments[H+2];Q.children=Z}return I(D.type,re,Q)},qe.createContext=function(D){return D={$$typeof:p,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:f,_context:D},D},qe.createElement=function(D,U,q){var Q,re={},ie=null;if(U!=null)for(Q in U.key!==void 0&&(ie=""+U.key),U)A.call(U,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(re[Q]=U[Q]);var Z=arguments.length-2;if(Z===1)re.children=q;else if(1<Z){for(var H=Array(Z),oe=0;oe<Z;oe++)H[oe]=arguments[oe+2];re.children=H}if(D&&D.defaultProps)for(Q in Z=D.defaultProps,Z)re[Q]===void 0&&(re[Q]=Z[Q]);return I(D,ie,re)},qe.createRef=function(){return{current:null}},qe.forwardRef=function(D){return{$$typeof:c,render:D}},qe.isValidElement=F,qe.lazy=function(D){return{$$typeof:_,_payload:{_status:-1,_result:D},_init:X}},qe.memo=function(D,U){return{$$typeof:d,type:D,compare:U===void 0?null:U}},qe.startTransition=function(D){var U=N.T,q={};N.T=q;try{var Q=D(),re=N.S;re!==null&&re(q,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(R,j)}catch(ie){j(ie)}finally{U!==null&&q.types!==null&&(U.types=q.types),N.T=U}},qe.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},qe.use=function(D){return N.H.use(D)},qe.useActionState=function(D,U,q){return N.H.useActionState(D,U,q)},qe.useCallback=function(D,U){return N.H.useCallback(D,U)},qe.useContext=function(D){return N.H.useContext(D)},qe.useDebugValue=function(){},qe.useDeferredValue=function(D,U){return N.H.useDeferredValue(D,U)},qe.useEffect=function(D,U){return N.H.useEffect(D,U)},qe.useEffectEvent=function(D){return N.H.useEffectEvent(D)},qe.useId=function(){return N.H.useId()},qe.useImperativeHandle=function(D,U,q){return N.H.useImperativeHandle(D,U,q)},qe.useInsertionEffect=function(D,U){return N.H.useInsertionEffect(D,U)},qe.useLayoutEffect=function(D,U){return N.H.useLayoutEffect(D,U)},qe.useMemo=function(D,U){return N.H.useMemo(D,U)},qe.useOptimistic=function(D,U){return N.H.useOptimistic(D,U)},qe.useReducer=function(D,U,q){return N.H.useReducer(D,U,q)},qe.useRef=function(D){return N.H.useRef(D)},qe.useState=function(D){return N.H.useState(D)},qe.useSyncExternalStore=function(D,U,q){return N.H.useSyncExternalStore(D,U,q)},qe.useTransition=function(){return N.H.useTransition()},qe.version="19.2.7",qe}var W1;function pm(){return W1||(W1=1,Xf.exports=Q5()),Xf.exports}var M=pm();const ek=fm(M),ah=YS({__proto__:null,default:ek},[M]),tk="fc-operation-body";let Xn=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function XS(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Xn(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(ik).filter(s=>s!==null):[]}function oh(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)||ZS(t))throw new Xn(500,"Invalid operation response");return t}function ZS(e){return ig(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function nk({children:e,className:t}){return u.jsx("div",{className:sk(tk,t),children:e})}function ik(e){if(!JS(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(rk).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function rk(e){return!JS(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 JS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ig(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>ig(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||ig(s,t))}function sk(...e){return e.filter(t=>!!t).join(" ")}const ak=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Xn,OperationBody:nk,assertOperationNode:oh,fetchOperationCatalog:XS,hasForbiddenBrowserPayloadKey:ZS},Symbol.toStringTag,{value:"Module"}));function ok(e){return e}function lk(e){return e}function QS(e=()=>{}){const t=new Set;return{api:{fetch:(i,s,o)=>fetch(Zf(i,s),o).then(pk),subscribe:(i,s,o)=>{const f=new EventSource(Zf(i,s));f.onmessage=o;const p=()=>f.close();return t.add(p),()=>{p(),t.delete(p)}},resync:e},lifecycle:{onDispose:i=>(t.add(i),()=>t.delete(i))},terminal:{requestTicket:async(i,s,o,f)=>{const p=await fetch(Zf(i,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:o}),signal:f});if(!p.ok)throw new Xn(p.status,`Terminal ticket request failed: ${p.status}`);const c=await p.json();if(typeof c.ticket!="string"||typeof c.ttlMs!="number")throw new Xn(p.status,"Invalid terminal ticket response");return{ticket:c.ticket,ttlMs:c.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async i=>{const s=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new Xn(s.status,`Operation create failed: ${s.status}`);const o=await s.json();return oh(o.operation)},rename:async(i,s)=>{const o=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!o.ok)throw new Xn(o.status,`Operation rename failed: ${o.status}`);const f=await o.json();return oh(f.operation)},remove:async i=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!s.ok)throw new Xn(s.status,`Operation remove failed: ${s.status}`)}},preferences:{read:(i,s)=>mk(i,s),write:(i,s)=>_k(i,s)},settings:{read:async i=>{const s=await fetch(G1(i));if(!s.ok)throw new Xn(s.status,`Plugin settings read failed: ${s.status}`);const f=(await s.json()).value;return typeof f=="object"&&f!==null&&!Array.isArray(f)?f:null},write:async(i,s)=>{const o=await fetch(G1(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Xn(o.status,`Plugin settings write failed: ${o.status}`)}},status:{set:()=>{},clear:()=>{}}}}function ex(e,t){return M.useSyncExternalStore(e,t,t)}function ck(){const[e,t]=M.useState([]),i=M.useCallback(async()=>{const s=await fetch("/api/v1/operations");if(!s.ok)throw new Xn(s.status,`Operations request failed: ${s.status}`);const o=await s.json();t(Array.isArray(o.operations)?o.operations.map(oh):[])},[]);return M.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function uk(e,t){return M.useMemo(()=>({fetch:(i,s)=>e.fetch(t,i,s),subscribe:(i,s)=>e.subscribe(t,i,s)}),[e,t])}function hk(e,t){return M.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function dk(e,t,i){const[s,o]=M.useState(()=>e.read(t,i)),f=M.useCallback(p=>{o(p),e.write(t,p)},[e,t]);return[s,f]}function fk(e,t){return M.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function pk(e){if(!e.ok)throw new Xn(e.status,`Plugin request failed: ${e.status}`);return e}function Zf(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Xn(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new Xn(400,"Invalid plugin path");return`/plugins/${e}${i}`}const gk=/^[a-z0-9][a-z0-9._-]*$/;function G1(e){if(!gk.test(e))throw new Xn(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function mk(e,t){if(typeof window>"u")return t;try{const i=window.localStorage.getItem(`fleet-plugin.${e}`);return i===null?t:JSON.parse(i)}catch{return t}}function _k(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const vk=Object.freeze(Object.defineProperty({__proto__:null,React:ah,createClientCapabilities:QS,defineOperationKind:lk,definePlugin:ok,useOperationStatus:fk,useOperations:ck,usePluginApi:uk,usePluginSettings:hk,usePluginStorage:dk,useStoreSnapshot:ex},Symbol.toStringTag,{value:"Module"}));function bk(e){return e}function yk({title:e,description:t,children:i}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:i})]})}function Sk({label:e,hint:t,children:i}){const s=M.useId(),o=M.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":s,"aria-describedby":t?o:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:s,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:o,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:i})]})}function xk({checked:e,onChange:t,label:i,disabled:s=!1}){const o=M.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:o,children:[u.jsx("input",{id:o,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:s,"aria-label":i?void 0:"Toggle setting",onChange:f=>t(f.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),i?u.jsx("span",{className:"fc-settings-toggle__label",children:i}):null]})}function wk({value:e,options:t,onChange:i,label:s,disabled:o=!1}){const f=M.useId(),p=u.jsx("select",{id:f,className:"fc-settings-select__control",value:e,disabled:o,"aria-label":s?void 0:"Select setting",onChange:c=>i(c.currentTarget.value),children:t.map(c=>u.jsx("option",{value:c.value,children:c.label},c.value))});return s?u.jsxs("label",{className:"fc-settings-select",htmlFor:f,children:[u.jsx("span",{className:"fc-settings-select__label",children:s}),p]}):u.jsx("div",{className:"fc-settings-select",children:p})}function Ck({label:e,hint:t,children:i}){const s=M.useId(),o=M.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":s,"aria-describedby":t?o:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:s,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:o,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:i})]})}const Ek=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:yk,SettingsField:Ck,SettingsRow:Sk,SettingsSelect:wk,SettingsToggle:xk,defineSettingsSection:bk},Symbol.toStringTag,{value:"Module"}));function kk(e){return e}const Tk=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:kk},Symbol.toStringTag,{value:"Module"})),Ak=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class gm extends M.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??Ak:this.props.children}}const Rk=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:gm,React:ah,default:ah},Symbol.toStringTag,{value:"Module"}));var Jf={exports:{}},vl={},Qf={exports:{}},ep={};var q1;function Lk(){return q1||(q1=1,(function(e){function t(z,V){var X=z.length;z.push(V);e:for(;0<X;){var j=X-1>>>1,P=z[j];if(0<o(P,V))z[j]=V,z[X]=P,X=j;else break e}}function i(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var V=z[0],X=z.pop();if(X!==V){z[0]=X;e:for(var j=0,P=z.length,D=P>>>1;j<D;){var U=2*(j+1)-1,q=z[U],Q=U+1,re=z[Q];if(0>o(q,X))Q<P&&0>o(re,q)?(z[j]=re,z[Q]=X,j=Q):(z[j]=q,z[U]=X,j=U);else if(Q<P&&0>o(re,X))z[j]=re,z[Q]=X,j=Q;else break e}}return V}function o(z,V){var X=z.sortIndex-V.sortIndex;return X!==0?X:z.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var p=Date,c=p.now();e.unstable_now=function(){return p.now()-c}}var h=[],d=[],_=1,g=null,S=3,C=!1,T=!1,w=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(z){for(var V=i(d);V!==null;){if(V.callback===null)s(d);else if(V.startTime<=z)s(d),V.sortIndex=V.expirationTime,t(h,V);else break;V=i(d)}}function L(z){if(w=!1,k(z),!T)if(i(h)!==null)T=!0,R||(R=!0,G());else{var V=i(d);V!==null&&W(L,V.startTime-z)}}var R=!1,N=-1,A=5,I=-1;function K(){return m?!0:!(e.unstable_now()-I<A)}function F(){if(m=!1,R){var z=e.unstable_now();I=z;var V=!0;try{e:{T=!1,w&&(w=!1,v(N),N=-1),C=!0;var X=S;try{t:{for(k(z),g=i(h);g!==null&&!(g.expirationTime>z&&K());){var j=g.callback;if(typeof j=="function"){g.callback=null,S=g.priorityLevel;var P=j(g.expirationTime<=z);if(z=e.unstable_now(),typeof P=="function"){g.callback=P,k(z),V=!0;break t}g===i(h)&&s(h),k(z)}else s(h);g=i(h)}if(g!==null)V=!0;else{var D=i(d);D!==null&&W(L,D.startTime-z),V=!1}}break e}finally{g=null,S=X,C=!1}V=void 0}}finally{V?G():R=!1}}}var G;if(typeof x=="function")G=function(){x(F)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,Y=B.port2;B.port1.onmessage=F,G=function(){Y.postMessage(null)}}else G=function(){b(F,0)};function W(z,V){N=b(function(){z(e.unstable_now())},V)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(z){switch(S){case 1:case 2:case 3:var V=3;break;default:V=S}var X=S;S=V;try{return z()}finally{S=X}},e.unstable_requestPaint=function(){m=!0},e.unstable_runWithPriority=function(z,V){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var X=S;S=z;try{return V()}finally{S=X}},e.unstable_scheduleCallback=function(z,V,X){var j=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?j+X:j):X=j,z){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=X+P,z={id:_++,callback:V,priorityLevel:z,startTime:X,expirationTime:P,sortIndex:-1},X>j?(z.sortIndex=X,t(d,z),i(h)===null&&z===i(d)&&(w?(v(N),N=-1):w=!0,W(L,X-j))):(z.sortIndex=P,t(h,z),T||C||(T=!0,R||(R=!0,G()))),z},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(z){var V=S;return function(){var X=S;S=V;try{return z.apply(this,arguments)}finally{S=X}}}})(ep)),ep}var K1;function Mk(){return K1||(K1=1,Qf.exports=Lk()),Qf.exports}var tp={exports:{}},Fn={};var V1;function Nk(){if(V1)return Fn;V1=1;var e=pm();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)d+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function f(h,d,_){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:d,implementation:_}}var p=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Fn.createPortal=function(h,d){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return f(h,d,null,_)},Fn.flushSync=function(h){var d=p.T,_=s.p;try{if(p.T=null,s.p=2,h)return h()}finally{p.T=d,s.p=_,s.d.f()}},Fn.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,s.d.C(h,d))},Fn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Fn.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var _=d.as,g=c(_,d.crossOrigin),S=typeof d.integrity=="string"?d.integrity:void 0,C=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;_==="style"?s.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:S,fetchPriority:C}):_==="script"&&s.d.X(h,{crossOrigin:g,integrity:S,fetchPriority:C,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Fn.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var _=c(d.as,d.crossOrigin);s.d.M(h,{crossOrigin:_,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&s.d.M(h)},Fn.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var _=d.as,g=c(_,d.crossOrigin);s.d.L(h,_,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Fn.preloadModule=function(h,d){if(typeof h=="string")if(d){var _=c(d.as,d.crossOrigin);s.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:_,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(h)},Fn.requestFormReset=function(h){s.d.r(h)},Fn.unstable_batchedUpdates=function(h,d){return h(d)},Fn.useFormState=function(h,d,_){return p.H.useFormState(h,d,_)},Fn.useFormStatus=function(){return p.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var Y1;function tx(){if(Y1)return tp.exports;Y1=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(),tp.exports=Nk(),tp.exports}var X1;function Ok(){if(X1)return vl;X1=1;var e=Mk(),t=pm(),i=tx();function s(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function f(n){var r=n,a=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(a=r.return),n=r.return;while(n)}return r.tag===3?a:null}function p(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function c(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function h(n){if(f(n)!==n)throw Error(s(188))}function d(n){var r=n.alternate;if(!r){if(r=f(n),r===null)throw Error(s(188));return r!==n?null:n}for(var a=n,l=r;;){var y=a.return;if(y===null)break;var E=y.alternate;if(E===null){if(l=y.return,l!==null){a=l;continue}break}if(y.child===E.child){for(E=y.child;E;){if(E===a)return h(y),n;if(E===l)return h(y),r;E=E.sibling}throw Error(s(188))}if(a.return!==l.return)a=y,l=E;else{for(var O=!1,$=y.child;$;){if($===a){O=!0,a=y,l=E;break}if($===l){O=!0,l=y,a=E;break}$=$.sibling}if(!O){for($=E.child;$;){if($===a){O=!0,a=E,l=y;break}if($===l){O=!0,l=E,a=y;break}$=$.sibling}if(!O)throw Error(s(189))}}if(a.alternate!==l)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:r}function _(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=_(n),r!==null)return r;n=n.sibling}return null}var g=Object.assign,S=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),x=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function G(n){return n===null||typeof n!="object"?null:(n=F&&n[F]||n["@@iterator"],typeof n=="function"?n:null)}var B=Symbol.for("react.client.reference");function Y(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===B?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case b:return"Profiler";case m:return"StrictMode";case L:return"Suspense";case R:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case x:return n.displayName||"Context";case v:return(n._context.displayName||"Context")+".Consumer";case k:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case N:return r=n.displayName||null,r!==null?r:Y(n.type)||"Memo";case A:r=n._payload,n=n._init;try{return Y(n(r))}catch{}}return null}var W=Array.isArray,z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},j=[],P=-1;function D(n){return{current:n}}function U(n){0>P||(n.current=j[P],j[P]=null,P--)}function q(n,r){P++,j[P]=n.current,n.current=r}var Q=D(null),re=D(null),ie=D(null),Z=D(null);function H(n,r){switch(q(ie,r),q(re,n),q(Q,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?u1(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=u1(r),n=h1(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}U(Q),q(Q,n)}function oe(){U(Q),U(re),U(ie)}function fe(n){n.memoizedState!==null&&q(Z,n);var r=Q.current,a=h1(r,n.type);r!==a&&(q(re,n),q(Q,a))}function Se(n){re.current===n&&(U(Q),U(re)),Z.current===n&&(U(Z),fl._currentValue=X)}var ye,De;function Fe(n){if(ye===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);ye=r&&r[1]||"",De=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+ye+n+De}var Be=!1;function Ke(n,r){if(!n||Be)return"";Be=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var ve=function(){throw Error()};if(Object.defineProperty(ve.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ve,[])}catch(he){var ue=he}Reflect.construct(n,[],ve)}else{try{ve.call()}catch(he){ue=he}n.call(ve.prototype)}}else{try{throw Error()}catch(he){ue=he}(ve=n())&&typeof ve.catch=="function"&&ve.catch(function(){})}}catch(he){if(he&&ue&&typeof he.stack=="string")return[he.stack,ue.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=l.DetermineComponentFrameRoot(),O=E[0],$=E[1];if(O&&$){var te=O.split(`
4
+ `),ce=$.split(`
5
+ `);for(y=l=0;l<te.length&&!te[l].includes("DetermineComponentFrameRoot");)l++;for(;y<ce.length&&!ce[y].includes("DetermineComponentFrameRoot");)y++;if(l===te.length||y===ce.length)for(l=te.length-1,y=ce.length-1;1<=l&&0<=y&&te[l]!==ce[y];)y--;for(;1<=l&&0<=y;l--,y--)if(te[l]!==ce[y]){if(l!==1||y!==1)do if(l--,y--,0>y||te[l]!==ce[y]){var ge=`
6
+ `+te[l].replace(" at new "," at ");return n.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",n.displayName)),ge}while(1<=l&&0<=y);break}}}finally{Be=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Fe(a):""}function ke(n,r){switch(n.tag){case 26:case 27:case 5:return Fe(n.type);case 16:return Fe("Lazy");case 13:return n.child!==r&&r!==null?Fe("Suspense Fallback"):Fe("Suspense");case 19:return Fe("SuspenseList");case 0:case 15:return Ke(n.type,!1);case 11:return Ke(n.type.render,!1);case 1:return Ke(n.type,!0);case 31:return Fe("Activity");default:return""}}function dt(n){try{var r="",a=null;do r+=ke(n,a),a=n,n=n.return;while(n);return r}catch(l){return`
7
+ Error generating stack: `+l.message+`
8
+ `+l.stack}}var Pt=Object.prototype.hasOwnProperty,Ct=e.unstable_scheduleCallback,Gn=e.unstable_cancelCallback,qn=e.unstable_shouldYield,Zt=e.unstable_requestPaint,ht=e.unstable_now,Jt=e.unstable_getCurrentPriorityLevel,zt=e.unstable_ImmediatePriority,Kt=e.unstable_UserBlockingPriority,nn=e.unstable_NormalPriority,ni=e.unstable_LowPriority,xn=e.unstable_IdlePriority,Qt=e.log,lt=e.unstable_setDisableYieldValue,hn=null,Ht=null;function $t(n){if(typeof Qt=="function"&&lt(n),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(hn,n)}catch{}}var Et=Math.clz32?Math.clz32:Hn,mi=Math.log,Yi=Math.LN2;function Hn(n){return n>>>=0,n===0?32:31-(mi(n)/Yi|0)|0}var Ln=256,$n=262144,Xi=4194304;function rn(n){var r=n&42;if(r!==0)return r;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ee(n,r,a){var l=n.pendingLanes;if(l===0)return 0;var y=0,E=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var $=l&134217727;return $!==0?(l=$&~E,l!==0?y=rn(l):(O&=$,O!==0?y=rn(O):a||(a=$&~n,a!==0&&(y=rn(a))))):($=l&~E,$!==0?y=rn($):O!==0?y=rn(O):a||(a=l&~n,a!==0&&(y=rn(a)))),y===0?0:r!==0&&r!==y&&(r&E)===0&&(E=y&-y,a=r&-r,E>=a||E===32&&(a&4194048)!==0)?r:y}function pe(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function xe(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 Pe(){var n=Xi;return Xi<<=1,(Xi&62914560)===0&&(Xi=4194304),n}function xt(n){for(var r=[],a=0;31>a;a++)r.push(n);return r}function ft(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Te(n,r,a,l,y,E){var O=n.pendingLanes;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=a,n.entangledLanes&=a,n.errorRecoveryDisabledLanes&=a,n.shellSuspendCounter=0;var $=n.entanglements,te=n.expirationTimes,ce=n.hiddenUpdates;for(a=O&~a;0<a;){var ge=31-Et(a),ve=1<<ge;$[ge]=0,te[ge]=-1;var ue=ce[ge];if(ue!==null)for(ce[ge]=null,ge=0;ge<ue.length;ge++){var he=ue[ge];he!==null&&(he.lane&=-536870913)}a&=~ve}l!==0&&Ce(n,l,0),E!==0&&y===0&&n.tag!==0&&(n.suspendedLanes|=E&~(O&~r))}function Ce(n,r,a){n.pendingLanes|=r,n.suspendedLanes&=~r;var l=31-Et(r);n.entangledLanes|=r,n.entanglements[l]=n.entanglements[l]|1073741824|a&261930}function ze(n,r){var a=n.entangledLanes|=r;for(n=n.entanglements;a;){var l=31-Et(a),y=1<<l;y&r|n[l]&r&&(n[l]|=r),a&=~y}}function It(n,r){var a=r&-r;return a=(a&42)!==0?1:et(a),(a&(n.suspendedLanes|r))!==0?0:a}function et(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function dn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Mi(){var n=V.p;return n!==0?n:(n=window.event,n===void 0?32:D1(n.type))}function Ni(n,r){var a=V.p;try{return V.p=n,r()}finally{V.p=a}}var Mn=Math.random().toString(36).slice(2),de="__reactFiber$"+Mn,je="__reactProps$"+Mn,vt="__reactContainer$"+Mn,nt="__reactEvents$"+Mn,Ae="__reactListeners$"+Mn,bt="__reactHandles$"+Mn,en="__reactResources$"+Mn,wn="__reactMarker$"+Mn;function Re(n){delete n[de],delete n[je],delete n[nt],delete n[Ae],delete n[bt]}function J(n){var r=n[de];if(r)return r;for(var a=n.parentNode;a;){if(r=a[vt]||a[de]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(n=v1(n);n!==null;){if(a=n[de])return a;n=v1(n)}return r}n=a,a=n.parentNode}return null}function me(n){if(n=n[de]||n[vt]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function Ee(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(s(33))}function Qe(n){var r=n[en];return r||(r=n[en]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function $e(n){n[wn]=!0}var yt=new Set,wt={};function Dt(n,r){be(n,r),be(n+"Capture",r)}function be(n,r){for(wt[n]=r,n=0;n<r.length;n++)yt.add(r[n])}var Me=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]*$"),Ie={},pt={};function Vt(n){return Pt.call(pt,n)?!0:Pt.call(Ie,n)?!1:Me.test(n)?pt[n]=!0:(Ie[n]=!0,!1)}function Un(n,r,a){if(Vt(r))if(a===null)n.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var l=r.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+a)}}function _i(n,r,a){if(a===null)n.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+a)}}function ii(n,r,a,l){if(l===null)n.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(r,a,""+l)}}function Bt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function vi(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function cc(n,r,a){var l=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var y=l.get,E=l.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return y.call(this)},set:function(O){a=""+O,E.call(this,O)}}),Object.defineProperty(n,r,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(O){a=""+O},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function da(n){if(!n._valueTracker){var r=vi(n)?"checked":"value";n._valueTracker=cc(n,r,""+n[r])}}function ko(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return n&&(l=vi(n)?n.checked?"true":"false":n.value),n=l,n!==a?(r.setValue(n),!0):!1}function fa(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Kh=/[\n"\\]/g;function ri(n){return n.replace(Kh,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function To(n,r,a,l,y,E,O,$){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),r!=null?O==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Bt(r)):n.value!==""+Bt(r)&&(n.value=""+Bt(r)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),r!=null?pa(n,O,Bt(r)):a!=null?pa(n,O,Bt(a)):l!=null&&n.removeAttribute("value"),y==null&&E!=null&&(n.defaultChecked=!!E),y!=null&&(n.checked=y&&typeof y!="function"&&typeof y!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?n.name=""+Bt($):n.removeAttribute("name")}function Ms(n,r,a,l,y,E,O,$){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.type=E),r!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||r!=null)){da(n);return}a=a!=null?""+Bt(a):"",r=r!=null?""+Bt(r):a,$||r===n.value||(n.value=r),n.defaultValue=r}l=l??y,l=typeof l!="function"&&typeof l!="symbol"&&!!l,n.checked=$?n.checked:!!l,n.defaultChecked=!!l,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),da(n)}function pa(n,r,a){r==="number"&&fa(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function Nn(n,r,a,l){if(n=n.options,r){r={};for(var y=0;y<a.length;y++)r["$"+a[y]]=!0;for(a=0;a<n.length;a++)y=r.hasOwnProperty("$"+n[a].value),n[a].selected!==y&&(n[a].selected=y),y&&l&&(n[a].defaultSelected=!0)}else{for(a=""+Bt(a),r=null,y=0;y<n.length;y++){if(n[y].value===a){n[y].selected=!0,l&&(n[y].defaultSelected=!0);return}r!==null||n[y].disabled||(r=n[y])}r!==null&&(r.selected=!0)}}function uc(n,r,a){if(r!=null&&(r=""+Bt(r),r!==n.value&&(n.value=r),a==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=a!=null?""+Bt(a):""}function ga(n,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(s(92));if(W(l)){if(1<l.length)throw Error(s(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Bt(r),n.defaultValue=a,l=n.textContent,l===a&&l!==""&&l!==null&&(n.value=l),da(n)}function Ge(n,r){if(r){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=r;return}}n.textContent=r}var hc=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 gn(n,r,a){var l=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":l?n.setProperty(r,a):typeof a!="number"||a===0||hc.has(r)?r==="float"?n.cssFloat=a:n[r]=(""+a).trim():n[r]=a+"px"}function kt(n,r,a){if(r!=null&&typeof r!="object")throw Error(s(62));if(n=n.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||r!=null&&r.hasOwnProperty(l)||(l.indexOf("--")===0?n.setProperty(l,""):l==="float"?n.cssFloat="":n[l]="");for(var y in r)l=r[y],r.hasOwnProperty(y)&&a[y]!==l&&gn(n,y,l)}else for(var E in r)r.hasOwnProperty(E)&&gn(n,E,r[E])}function Kr(n){if(n.indexOf("-")===-1)return!1;switch(n){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 br=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"]]),Ao=/^[\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 Vr(n){return Ao.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function we(){}var Ne=null;function Ve(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var st=null,tn=null;function Oi(n){var r=me(n);if(r&&(n=r.stateNode)){var a=n[je]||null;e:switch(n=r.stateNode,r.type){case"input":if(To(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+ri(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==n&&l.form===n.form){var y=l[je]||null;if(!y)throw Error(s(90));To(l,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(r=0;r<a.length;r++)l=a[r],l.form===n.form&&ko(l)}break e;case"textarea":uc(n,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&Nn(n,!!a.multiple,r,!1)}}}var Ro=!1;function dc(n,r,a){if(Ro)return n(r,a);Ro=!0;try{var l=n(r);return l}finally{if(Ro=!1,(st!==null||tn!==null)&&(Qc(),st&&(r=st,n=tn,tn=st=null,Oi(r),n)))for(r=0;r<n.length;r++)Oi(n[r])}}function Lo(n,r){var a=n.stateNode;if(a===null)return null;var l=a[je]||null;if(l===null)return null;a=l[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(n=n.type,l=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!l;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,r,typeof a));return a}var yr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vh=!1;if(yr)try{var Mo={};Object.defineProperty(Mo,"passive",{get:function(){Vh=!0}}),window.addEventListener("test",Mo,Mo),window.removeEventListener("test",Mo,Mo)}catch{Vh=!1}var Yr=null,Yh=null,fc=null;function h_(){if(fc)return fc;var n,r=Yh,a=r.length,l,y="value"in Yr?Yr.value:Yr.textContent,E=y.length;for(n=0;n<a&&r[n]===y[n];n++);var O=a-n;for(l=1;l<=O&&r[a-l]===y[E-l];l++);return fc=y.slice(n,1<l?1-l:void 0)}function pc(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function gc(){return!0}function d_(){return!1}function si(n){function r(a,l,y,E,O){this._reactName=a,this._targetInst=y,this.type=l,this.nativeEvent=E,this.target=O,this.currentTarget=null;for(var $ in n)n.hasOwnProperty($)&&(a=n[$],this[$]=a?a(E):E[$]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?gc:d_,this.isPropagationStopped=d_,this}return g(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=gc)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=gc)},persist:function(){},isPersistent:gc}),r}var Ns={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mc=si(Ns),No=g({},Ns,{view:0,detail:0}),K2=si(No),Xh,Zh,Oo,_c=g({},No,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qh,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Oo&&(Oo&&n.type==="mousemove"?(Xh=n.screenX-Oo.screenX,Zh=n.screenY-Oo.screenY):Zh=Xh=0,Oo=n),Xh)},movementY:function(n){return"movementY"in n?n.movementY:Zh}}),f_=si(_c),V2=g({},_c,{dataTransfer:0}),Y2=si(V2),X2=g({},No,{relatedTarget:0}),Jh=si(X2),Z2=g({},Ns,{animationName:0,elapsedTime:0,pseudoElement:0}),J2=si(Z2),Q2=g({},Ns,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),eE=si(Q2),tE=g({},Ns,{data:0}),p_=si(tE),nE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iE={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"},rE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function sE(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=rE[n])?!!r[n]:!1}function Qh(){return sE}var aE=g({},No,{key:function(n){if(n.key){var r=nE[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=pc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?iE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qh,charCode:function(n){return n.type==="keypress"?pc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?pc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),oE=si(aE),lE=g({},_c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),g_=si(lE),cE=g({},No,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qh}),uE=si(cE),hE=g({},Ns,{propertyName:0,elapsedTime:0,pseudoElement:0}),dE=si(hE),fE=g({},_c,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),pE=si(fE),gE=g({},Ns,{newState:0,oldState:0}),mE=si(gE),_E=[9,13,27,32],ed=yr&&"CompositionEvent"in window,Do=null;yr&&"documentMode"in document&&(Do=document.documentMode);var vE=yr&&"TextEvent"in window&&!Do,m_=yr&&(!ed||Do&&8<Do&&11>=Do),__=" ",v_=!1;function b_(n,r){switch(n){case"keyup":return _E.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y_(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ma=!1;function bE(n,r){switch(n){case"compositionend":return y_(r);case"keypress":return r.which!==32?null:(v_=!0,__);case"textInput":return n=r.data,n===__&&v_?null:n;default:return null}}function yE(n,r){if(ma)return n==="compositionend"||!ed&&b_(n,r)?(n=h_(),fc=Yh=Yr=null,ma=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return m_&&r.locale!=="ko"?null:r.data;default:return null}}var SE={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 S_(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!SE[n.type]:r==="textarea"}function x_(n,r,a,l){st?tn?tn.push(l):tn=[l]:st=l,r=au(r,"onChange"),0<r.length&&(a=new mc("onChange","change",null,a,l),n.push({event:a,listeners:r}))}var jo=null,Io=null;function xE(n){r1(n,0)}function vc(n){var r=Ee(n);if(ko(r))return n}function w_(n,r){if(n==="change")return r}var C_=!1;if(yr){var td;if(yr){var nd="oninput"in document;if(!nd){var E_=document.createElement("div");E_.setAttribute("oninput","return;"),nd=typeof E_.oninput=="function"}td=nd}else td=!1;C_=td&&(!document.documentMode||9<document.documentMode)}function k_(){jo&&(jo.detachEvent("onpropertychange",T_),Io=jo=null)}function T_(n){if(n.propertyName==="value"&&vc(Io)){var r=[];x_(r,Io,n,Ve(n)),dc(xE,r)}}function wE(n,r,a){n==="focusin"?(k_(),jo=r,Io=a,jo.attachEvent("onpropertychange",T_)):n==="focusout"&&k_()}function CE(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return vc(Io)}function EE(n,r){if(n==="click")return vc(r)}function kE(n,r){if(n==="input"||n==="change")return vc(r)}function TE(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var bi=typeof Object.is=="function"?Object.is:TE;function Bo(n,r){if(bi(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var a=Object.keys(n),l=Object.keys(r);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var y=a[l];if(!Pt.call(r,y)||!bi(n[y],r[y]))return!1}return!0}function A_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function R_(n,r){var a=A_(n);n=0;for(var l;a;){if(a.nodeType===3){if(l=n+a.textContent.length,n<=r&&l>=r)return{node:a,offset:r-n};n=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=A_(a)}}function L_(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?L_(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function M_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=fa(n.document);r instanceof n.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)n=r.contentWindow;else break;r=fa(n.document)}return r}function id(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var AE=yr&&"documentMode"in document&&11>=document.documentMode,_a=null,rd=null,Po=null,sd=!1;function N_(n,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;sd||_a==null||_a!==fa(l)||(l=_a,"selectionStart"in l&&id(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Po&&Bo(Po,l)||(Po=l,l=au(rd,"onSelect"),0<l.length&&(r=new mc("onSelect","select",null,r,a),n.push({event:r,listeners:l}),r.target=_a)))}function Os(n,r){var a={};return a[n.toLowerCase()]=r.toLowerCase(),a["Webkit"+n]="webkit"+r,a["Moz"+n]="moz"+r,a}var va={animationend:Os("Animation","AnimationEnd"),animationiteration:Os("Animation","AnimationIteration"),animationstart:Os("Animation","AnimationStart"),transitionrun:Os("Transition","TransitionRun"),transitionstart:Os("Transition","TransitionStart"),transitioncancel:Os("Transition","TransitionCancel"),transitionend:Os("Transition","TransitionEnd")},ad={},O_={};yr&&(O_=document.createElement("div").style,"AnimationEvent"in window||(delete va.animationend.animation,delete va.animationiteration.animation,delete va.animationstart.animation),"TransitionEvent"in window||delete va.transitionend.transition);function Ds(n){if(ad[n])return ad[n];if(!va[n])return n;var r=va[n],a;for(a in r)if(r.hasOwnProperty(a)&&a in O_)return ad[n]=r[a];return n}var D_=Ds("animationend"),j_=Ds("animationiteration"),I_=Ds("animationstart"),RE=Ds("transitionrun"),LE=Ds("transitionstart"),ME=Ds("transitioncancel"),B_=Ds("transitionend"),P_=new Map,od="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(" ");od.push("scrollEnd");function Zi(n,r){P_.set(n,r),Dt(r,[n])}var bc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Di=[],ba=0,ld=0;function yc(){for(var n=ba,r=ld=ba=0;r<n;){var a=Di[r];Di[r++]=null;var l=Di[r];Di[r++]=null;var y=Di[r];Di[r++]=null;var E=Di[r];if(Di[r++]=null,l!==null&&y!==null){var O=l.pending;O===null?y.next=y:(y.next=O.next,O.next=y),l.pending=y}E!==0&&z_(a,y,E)}}function Sc(n,r,a,l){Di[ba++]=n,Di[ba++]=r,Di[ba++]=a,Di[ba++]=l,ld|=l,n.lanes|=l,n=n.alternate,n!==null&&(n.lanes|=l)}function cd(n,r,a,l){return Sc(n,r,a,l),xc(n)}function js(n,r){return Sc(n,null,null,r),xc(n)}function z_(n,r,a){n.lanes|=a;var l=n.alternate;l!==null&&(l.lanes|=a);for(var y=!1,E=n.return;E!==null;)E.childLanes|=a,l=E.alternate,l!==null&&(l.childLanes|=a),E.tag===22&&(n=E.stateNode,n===null||n._visibility&1||(y=!0)),n=E,E=E.return;return n.tag===3?(E=n.stateNode,y&&r!==null&&(y=31-Et(a),n=E.hiddenUpdates,l=n[y],l===null?n[y]=[r]:l.push(r),r.lane=a|536870912),E):null}function xc(n){if(50<al)throw al=0,bf=null,Error(s(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var ya={};function NE(n,r,a,l){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(n,r,a,l){return new NE(n,r,a,l)}function ud(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Sr(n,r){var a=n.alternate;return a===null?(a=yi(n.tag,r,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=r,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&65011712,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,r=n.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a.refCleanup=n.refCleanup,a}function H_(n,r){n.flags&=65011714;var a=n.alternate;return a===null?(n.childLanes=0,n.lanes=r,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,r=a.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function wc(n,r,a,l,y,E){var O=0;if(l=n,typeof n=="function")ud(n)&&(O=1);else if(typeof n=="string")O=B5(n,a,Q.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=yi(31,a,r,y),n.elementType=I,n.lanes=E,n;case w:return Is(a.children,y,E,r);case m:O=8,y|=24;break;case b:return n=yi(12,a,r,y|2),n.elementType=b,n.lanes=E,n;case L:return n=yi(13,a,r,y),n.elementType=L,n.lanes=E,n;case R:return n=yi(19,a,r,y),n.elementType=R,n.lanes=E,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case x:O=10;break e;case v:O=9;break e;case k:O=11;break e;case N:O=14;break e;case A:O=16,l=null;break e}O=29,a=Error(s(130,n===null?"null":typeof n,"")),l=null}return r=yi(O,a,r,y),r.elementType=n,r.type=l,r.lanes=E,r}function Is(n,r,a,l){return n=yi(7,n,l,r),n.lanes=a,n}function hd(n,r,a){return n=yi(6,n,null,r),n.lanes=a,n}function $_(n){var r=yi(18,null,null,0);return r.stateNode=n,r}function dd(n,r,a){return r=yi(4,n.children!==null?n.children:[],n.key,r),r.lanes=a,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var U_=new WeakMap;function ji(n,r){if(typeof n=="object"&&n!==null){var a=U_.get(n);return a!==void 0?a:(r={value:n,source:r,stack:dt(r)},U_.set(n,r),r)}return{value:n,source:r,stack:dt(r)}}var Sa=[],xa=0,Cc=null,zo=0,Ii=[],Bi=0,Xr=null,or=1,lr="";function xr(n,r){Sa[xa++]=zo,Sa[xa++]=Cc,Cc=n,zo=r}function F_(n,r,a){Ii[Bi++]=or,Ii[Bi++]=lr,Ii[Bi++]=Xr,Xr=n;var l=or;n=lr;var y=32-Et(l)-1;l&=~(1<<y),a+=1;var E=32-Et(r)+y;if(30<E){var O=y-y%5;E=(l&(1<<O)-1).toString(32),l>>=O,y-=O,or=1<<32-Et(r)+y|a<<y|l,lr=E+n}else or=1<<E|a<<y|l,lr=n}function fd(n){n.return!==null&&(xr(n,1),F_(n,1,0))}function pd(n){for(;n===Cc;)Cc=Sa[--xa],Sa[xa]=null,zo=Sa[--xa],Sa[xa]=null;for(;n===Xr;)Xr=Ii[--Bi],Ii[Bi]=null,lr=Ii[--Bi],Ii[Bi]=null,or=Ii[--Bi],Ii[Bi]=null}function W_(n,r){Ii[Bi++]=or,Ii[Bi++]=lr,Ii[Bi++]=Xr,or=r.id,lr=r.overflow,Xr=n}var On=null,Ut=null,ct=!1,Zr=null,Pi=!1,gd=Error(s(519));function Jr(n){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ho(ji(r,n)),gd}function G_(n){var r=n.stateNode,a=n.type,l=n.memoizedProps;switch(r[de]=n,r[je]=l,a){case"dialog":rt("cancel",r),rt("close",r);break;case"iframe":case"object":case"embed":rt("load",r);break;case"video":case"audio":for(a=0;a<ll.length;a++)rt(ll[a],r);break;case"source":rt("error",r);break;case"img":case"image":case"link":rt("error",r),rt("load",r);break;case"details":rt("toggle",r);break;case"input":rt("invalid",r),Ms(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":rt("invalid",r);break;case"textarea":rt("invalid",r),ga(r,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||l.suppressHydrationWarning===!0||l1(r.textContent,a)?(l.popover!=null&&(rt("beforetoggle",r),rt("toggle",r)),l.onScroll!=null&&rt("scroll",r),l.onScrollEnd!=null&&rt("scrollend",r),l.onClick!=null&&(r.onclick=we),r=!0):r=!1,r||Jr(n,!0)}function q_(n){for(On=n.return;On;)switch(On.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:On=On.return}}function wa(n){if(n!==On)return!1;if(!ct)return q_(n),ct=!0,!1;var r=n.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Df(n.type,n.memoizedProps)),a=!a),a&&Ut&&Jr(n),q_(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ut=_1(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ut=_1(n)}else r===27?(r=Ut,ds(n.type)?(n=zf,zf=null,Ut=n):Ut=r):Ut=On?Hi(n.stateNode.nextSibling):null;return!0}function Bs(){Ut=On=null,ct=!1}function md(){var n=Zr;return n!==null&&(ci===null?ci=n:ci.push.apply(ci,n),Zr=null),n}function Ho(n){Zr===null?Zr=[n]:Zr.push(n)}var _d=D(null),Ps=null,wr=null;function Qr(n,r,a){q(_d,r._currentValue),r._currentValue=a}function Cr(n){n._currentValue=_d.current,U(_d)}function vd(n,r,a){for(;n!==null;){var l=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,l!==null&&(l.childLanes|=r)):l!==null&&(l.childLanes&r)!==r&&(l.childLanes|=r),n===a)break;n=n.return}}function bd(n,r,a,l){var y=n.child;for(y!==null&&(y.return=n);y!==null;){var E=y.dependencies;if(E!==null){var O=y.child;E=E.firstContext;e:for(;E!==null;){var $=E;E=y;for(var te=0;te<r.length;te++)if($.context===r[te]){E.lanes|=a,$=E.alternate,$!==null&&($.lanes|=a),vd(E.return,a,n),l||(O=null);break e}E=$.next}}else if(y.tag===18){if(O=y.return,O===null)throw Error(s(341));O.lanes|=a,E=O.alternate,E!==null&&(E.lanes|=a),vd(O,a,n),O=null}else O=y.child;if(O!==null)O.return=y;else for(O=y;O!==null;){if(O===n){O=null;break}if(y=O.sibling,y!==null){y.return=O.return,O=y;break}O=O.return}y=O}}function Ca(n,r,a,l){n=null;for(var y=r,E=!1;y!==null;){if(!E){if((y.flags&524288)!==0)E=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var O=y.alternate;if(O===null)throw Error(s(387));if(O=O.memoizedProps,O!==null){var $=y.type;bi(y.pendingProps.value,O.value)||(n!==null?n.push($):n=[$])}}else if(y===Z.current){if(O=y.alternate,O===null)throw Error(s(387));O.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(n!==null?n.push(fl):n=[fl])}y=y.return}n!==null&&bd(r,n,a,l),r.flags|=262144}function Ec(n){for(n=n.firstContext;n!==null;){if(!bi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function zs(n){Ps=n,wr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Dn(n){return K_(Ps,n)}function kc(n,r){return Ps===null&&zs(n),K_(n,r)}function K_(n,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},wr===null){if(n===null)throw Error(s(308));wr=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else wr=wr.next=r;return a}var OE=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(a,l){n.push(l)}};this.abort=function(){r.aborted=!0,n.forEach(function(a){return a()})}},DE=e.unstable_scheduleCallback,jE=e.unstable_NormalPriority,mn={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yd(){return{controller:new OE,data:new Map,refCount:0}}function $o(n){n.refCount--,n.refCount===0&&DE(jE,function(){n.controller.abort()})}var Uo=null,Sd=0,Ea=0,ka=null;function IE(n,r){if(Uo===null){var a=Uo=[];Sd=0,Ea=Ef(),ka={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Sd++,r.then(V_,V_),r}function V_(){if(--Sd===0&&Uo!==null){ka!==null&&(ka.status="fulfilled");var n=Uo;Uo=null,Ea=0,ka=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function BE(n,r){var a=[],l={status:"pending",value:null,reason:null,then:function(y){a.push(y)}};return n.then(function(){l.status="fulfilled",l.value=r;for(var y=0;y<a.length;y++)(0,a[y])(r)},function(y){for(l.status="rejected",l.reason=y,y=0;y<a.length;y++)(0,a[y])(void 0)}),l}var Y_=z.S;z.S=function(n,r){N0=ht(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&IE(n,r),Y_!==null&&Y_(n,r)};var Hs=D(null);function xd(){var n=Hs.current;return n!==null?n:jt.pooledCache}function Tc(n,r){r===null?q(Hs,Hs.current):q(Hs,r.pool)}function X_(){var n=xd();return n===null?null:{parent:mn._currentValue,pool:n}}var Ta=Error(s(460)),wd=Error(s(474)),Ac=Error(s(542)),Rc={then:function(){}};function Z_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function J_(n,r,a){switch(a=n[a],a===void 0?n.push(r):a!==r&&(r.then(we,we),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,ev(n),n;default:if(typeof r.status=="string")r.then(we,we);else{if(n=jt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=r,n.status="pending",n.then(function(l){if(r.status==="pending"){var y=r;y.status="fulfilled",y.value=l}},function(l){if(r.status==="pending"){var y=r;y.status="rejected",y.reason=l}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,ev(n),n}throw Us=r,Ta}}function $s(n){try{var r=n._init;return r(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Us=a,Ta):a}}var Us=null;function Q_(){if(Us===null)throw Error(s(459));var n=Us;return Us=null,n}function ev(n){if(n===Ta||n===Ac)throw Error(s(483))}var Aa=null,Fo=0;function Lc(n){var r=Fo;return Fo+=1,Aa===null&&(Aa=[]),J_(Aa,n,r)}function Wo(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function Mc(n,r){throw r.$$typeof===S?Error(s(525)):(n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function tv(n){function r(se,ne){if(n){var le=se.deletions;le===null?(se.deletions=[ne],se.flags|=16):le.push(ne)}}function a(se,ne){if(!n)return null;for(;ne!==null;)r(se,ne),ne=ne.sibling;return null}function l(se){for(var ne=new Map;se!==null;)se.key!==null?ne.set(se.key,se):ne.set(se.index,se),se=se.sibling;return ne}function y(se,ne){return se=Sr(se,ne),se.index=0,se.sibling=null,se}function E(se,ne,le){return se.index=le,n?(le=se.alternate,le!==null?(le=le.index,le<ne?(se.flags|=67108866,ne):le):(se.flags|=67108866,ne)):(se.flags|=1048576,ne)}function O(se){return n&&se.alternate===null&&(se.flags|=67108866),se}function $(se,ne,le,_e){return ne===null||ne.tag!==6?(ne=hd(le,se.mode,_e),ne.return=se,ne):(ne=y(ne,le),ne.return=se,ne)}function te(se,ne,le,_e){var He=le.type;return He===w?ge(se,ne,le.props.children,_e,le.key):ne!==null&&(ne.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===A&&$s(He)===ne.type)?(ne=y(ne,le.props),Wo(ne,le),ne.return=se,ne):(ne=wc(le.type,le.key,le.props,null,se.mode,_e),Wo(ne,le),ne.return=se,ne)}function ce(se,ne,le,_e){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==le.containerInfo||ne.stateNode.implementation!==le.implementation?(ne=dd(le,se.mode,_e),ne.return=se,ne):(ne=y(ne,le.children||[]),ne.return=se,ne)}function ge(se,ne,le,_e,He){return ne===null||ne.tag!==7?(ne=Is(le,se.mode,_e,He),ne.return=se,ne):(ne=y(ne,le),ne.return=se,ne)}function ve(se,ne,le){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=hd(""+ne,se.mode,le),ne.return=se,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case C:return le=wc(ne.type,ne.key,ne.props,null,se.mode,le),Wo(le,ne),le.return=se,le;case T:return ne=dd(ne,se.mode,le),ne.return=se,ne;case A:return ne=$s(ne),ve(se,ne,le)}if(W(ne)||G(ne))return ne=Is(ne,se.mode,le,null),ne.return=se,ne;if(typeof ne.then=="function")return ve(se,Lc(ne),le);if(ne.$$typeof===x)return ve(se,kc(se,ne),le);Mc(se,ne)}return null}function ue(se,ne,le,_e){var He=ne!==null?ne.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return He!==null?null:$(se,ne,""+le,_e);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case C:return le.key===He?te(se,ne,le,_e):null;case T:return le.key===He?ce(se,ne,le,_e):null;case A:return le=$s(le),ue(se,ne,le,_e)}if(W(le)||G(le))return He!==null?null:ge(se,ne,le,_e,null);if(typeof le.then=="function")return ue(se,ne,Lc(le),_e);if(le.$$typeof===x)return ue(se,ne,kc(se,le),_e);Mc(se,le)}return null}function he(se,ne,le,_e,He){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return se=se.get(le)||null,$(ne,se,""+_e,He);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case C:return se=se.get(_e.key===null?le:_e.key)||null,te(ne,se,_e,He);case T:return se=se.get(_e.key===null?le:_e.key)||null,ce(ne,se,_e,He);case A:return _e=$s(_e),he(se,ne,le,_e,He)}if(W(_e)||G(_e))return se=se.get(le)||null,ge(ne,se,_e,He,null);if(typeof _e.then=="function")return he(se,ne,le,Lc(_e),He);if(_e.$$typeof===x)return he(se,ne,le,kc(ne,_e),He);Mc(ne,_e)}return null}function Le(se,ne,le,_e){for(var He=null,gt=null,Oe=ne,Ze=ne=0,ot=null;Oe!==null&&Ze<le.length;Ze++){Oe.index>Ze?(ot=Oe,Oe=null):ot=Oe.sibling;var mt=ue(se,Oe,le[Ze],_e);if(mt===null){Oe===null&&(Oe=ot);break}n&&Oe&&mt.alternate===null&&r(se,Oe),ne=E(mt,ne,Ze),gt===null?He=mt:gt.sibling=mt,gt=mt,Oe=ot}if(Ze===le.length)return a(se,Oe),ct&&xr(se,Ze),He;if(Oe===null){for(;Ze<le.length;Ze++)Oe=ve(se,le[Ze],_e),Oe!==null&&(ne=E(Oe,ne,Ze),gt===null?He=Oe:gt.sibling=Oe,gt=Oe);return ct&&xr(se,Ze),He}for(Oe=l(Oe);Ze<le.length;Ze++)ot=he(Oe,se,Ze,le[Ze],_e),ot!==null&&(n&&ot.alternate!==null&&Oe.delete(ot.key===null?Ze:ot.key),ne=E(ot,ne,Ze),gt===null?He=ot:gt.sibling=ot,gt=ot);return n&&Oe.forEach(function(_s){return r(se,_s)}),ct&&xr(se,Ze),He}function We(se,ne,le,_e){if(le==null)throw Error(s(151));for(var He=null,gt=null,Oe=ne,Ze=ne=0,ot=null,mt=le.next();Oe!==null&&!mt.done;Ze++,mt=le.next()){Oe.index>Ze?(ot=Oe,Oe=null):ot=Oe.sibling;var _s=ue(se,Oe,mt.value,_e);if(_s===null){Oe===null&&(Oe=ot);break}n&&Oe&&_s.alternate===null&&r(se,Oe),ne=E(_s,ne,Ze),gt===null?He=_s:gt.sibling=_s,gt=_s,Oe=ot}if(mt.done)return a(se,Oe),ct&&xr(se,Ze),He;if(Oe===null){for(;!mt.done;Ze++,mt=le.next())mt=ve(se,mt.value,_e),mt!==null&&(ne=E(mt,ne,Ze),gt===null?He=mt:gt.sibling=mt,gt=mt);return ct&&xr(se,Ze),He}for(Oe=l(Oe);!mt.done;Ze++,mt=le.next())mt=he(Oe,se,Ze,mt.value,_e),mt!==null&&(n&&mt.alternate!==null&&Oe.delete(mt.key===null?Ze:mt.key),ne=E(mt,ne,Ze),gt===null?He=mt:gt.sibling=mt,gt=mt);return n&&Oe.forEach(function(V5){return r(se,V5)}),ct&&xr(se,Ze),He}function Mt(se,ne,le,_e){if(typeof le=="object"&&le!==null&&le.type===w&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case C:e:{for(var He=le.key;ne!==null;){if(ne.key===He){if(He=le.type,He===w){if(ne.tag===7){a(se,ne.sibling),_e=y(ne,le.props.children),_e.return=se,se=_e;break e}}else if(ne.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===A&&$s(He)===ne.type){a(se,ne.sibling),_e=y(ne,le.props),Wo(_e,le),_e.return=se,se=_e;break e}a(se,ne);break}else r(se,ne);ne=ne.sibling}le.type===w?(_e=Is(le.props.children,se.mode,_e,le.key),_e.return=se,se=_e):(_e=wc(le.type,le.key,le.props,null,se.mode,_e),Wo(_e,le),_e.return=se,se=_e)}return O(se);case T:e:{for(He=le.key;ne!==null;){if(ne.key===He)if(ne.tag===4&&ne.stateNode.containerInfo===le.containerInfo&&ne.stateNode.implementation===le.implementation){a(se,ne.sibling),_e=y(ne,le.children||[]),_e.return=se,se=_e;break e}else{a(se,ne);break}else r(se,ne);ne=ne.sibling}_e=dd(le,se.mode,_e),_e.return=se,se=_e}return O(se);case A:return le=$s(le),Mt(se,ne,le,_e)}if(W(le))return Le(se,ne,le,_e);if(G(le)){if(He=G(le),typeof He!="function")throw Error(s(150));return le=He.call(le),We(se,ne,le,_e)}if(typeof le.then=="function")return Mt(se,ne,Lc(le),_e);if(le.$$typeof===x)return Mt(se,ne,kc(se,le),_e);Mc(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,ne!==null&&ne.tag===6?(a(se,ne.sibling),_e=y(ne,le),_e.return=se,se=_e):(a(se,ne),_e=hd(le,se.mode,_e),_e.return=se,se=_e),O(se)):a(se,ne)}return function(se,ne,le,_e){try{Fo=0;var He=Mt(se,ne,le,_e);return Aa=null,He}catch(Oe){if(Oe===Ta||Oe===Ac)throw Oe;var gt=yi(29,Oe,null,se.mode);return gt.lanes=_e,gt.return=se,gt}}}var Fs=tv(!0),nv=tv(!1),es=!1;function Cd(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ed(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ts(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ns(n,r,a){var l=n.updateQueue;if(l===null)return null;if(l=l.shared,(St&2)!==0){var y=l.pending;return y===null?r.next=r:(r.next=y.next,y.next=r),l.pending=r,r=xc(n),z_(n,null,a),r}return Sc(n,l,r,a),xc(n)}function Go(n,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var l=r.lanes;l&=n.pendingLanes,a|=l,r.lanes=a,ze(n,a)}}function kd(n,r){var a=n.updateQueue,l=n.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var y=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var O={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?y=E=O:E=E.next=O,a=a.next}while(a!==null);E===null?y=E=r:E=E.next=r}else y=E=r;a={baseState:l.baseState,firstBaseUpdate:y,lastBaseUpdate:E,shared:l.shared,callbacks:l.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=r:n.next=r,a.lastBaseUpdate=r}var Td=!1;function qo(){if(Td){var n=ka;if(n!==null)throw n}}function Ko(n,r,a,l){Td=!1;var y=n.updateQueue;es=!1;var E=y.firstBaseUpdate,O=y.lastBaseUpdate,$=y.shared.pending;if($!==null){y.shared.pending=null;var te=$,ce=te.next;te.next=null,O===null?E=ce:O.next=ce,O=te;var ge=n.alternate;ge!==null&&(ge=ge.updateQueue,$=ge.lastBaseUpdate,$!==O&&($===null?ge.firstBaseUpdate=ce:$.next=ce,ge.lastBaseUpdate=te))}if(E!==null){var ve=y.baseState;O=0,ge=ce=te=null,$=E;do{var ue=$.lane&-536870913,he=ue!==$.lane;if(he?(at&ue)===ue:(l&ue)===ue){ue!==0&&ue===Ea&&(Td=!0),ge!==null&&(ge=ge.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Le=n,We=$;ue=r;var Mt=a;switch(We.tag){case 1:if(Le=We.payload,typeof Le=="function"){ve=Le.call(Mt,ve,ue);break e}ve=Le;break e;case 3:Le.flags=Le.flags&-65537|128;case 0:if(Le=We.payload,ue=typeof Le=="function"?Le.call(Mt,ve,ue):Le,ue==null)break e;ve=g({},ve,ue);break e;case 2:es=!0}}ue=$.callback,ue!==null&&(n.flags|=64,he&&(n.flags|=8192),he=y.callbacks,he===null?y.callbacks=[ue]:he.push(ue))}else he={lane:ue,tag:$.tag,payload:$.payload,callback:$.callback,next:null},ge===null?(ce=ge=he,te=ve):ge=ge.next=he,O|=ue;if($=$.next,$===null){if($=y.shared.pending,$===null)break;he=$,$=he.next,he.next=null,y.lastBaseUpdate=he,y.shared.pending=null}}while(!0);ge===null&&(te=ve),y.baseState=te,y.firstBaseUpdate=ce,y.lastBaseUpdate=ge,E===null&&(y.shared.lanes=0),os|=O,n.lanes=O,n.memoizedState=ve}}function iv(n,r){if(typeof n!="function")throw Error(s(191,n));n.call(r)}function rv(n,r){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)iv(a[n],r)}var Ra=D(null),Nc=D(0);function sv(n,r){n=Or,q(Nc,n),q(Ra,r),Or=n|r.baseLanes}function Ad(){q(Nc,Or),q(Ra,Ra.current)}function Rd(){Or=Nc.current,U(Ra),U(Nc)}var Si=D(null),zi=null;function is(n){var r=n.alternate;q(fn,fn.current&1),q(Si,n),zi===null&&(r===null||Ra.current!==null||r.memoizedState!==null)&&(zi=n)}function Ld(n){q(fn,fn.current),q(Si,n),zi===null&&(zi=n)}function av(n){n.tag===22?(q(fn,fn.current),q(Si,n),zi===null&&(zi=n)):rs()}function rs(){q(fn,fn.current),q(Si,Si.current)}function xi(n){U(Si),zi===n&&(zi=null),U(fn)}var fn=D(0);function Oc(n){for(var r=n;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Bf(a)||Pf(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Er=0,Ye=null,Rt=null,_n=null,Dc=!1,La=!1,Ws=!1,jc=0,Vo=0,Ma=null,PE=0;function sn(){throw Error(s(321))}function Md(n,r){if(r===null)return!1;for(var a=0;a<r.length&&a<n.length;a++)if(!bi(n[a],r[a]))return!1;return!0}function Nd(n,r,a,l,y,E){return Er=E,Ye=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,z.H=n===null||n.memoizedState===null?Fv:Kd,Ws=!1,E=a(l,y),Ws=!1,La&&(E=lv(r,a,l,y)),ov(n),E}function ov(n){z.H=Zo;var r=Rt!==null&&Rt.next!==null;if(Er=0,_n=Rt=Ye=null,Dc=!1,Vo=0,Ma=null,r)throw Error(s(300));n===null||vn||(n=n.dependencies,n!==null&&Ec(n)&&(vn=!0))}function lv(n,r,a,l){Ye=n;var y=0;do{if(La&&(Ma=null),Vo=0,La=!1,25<=y)throw Error(s(301));if(y+=1,_n=Rt=null,n.updateQueue!=null){var E=n.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}z.H=Wv,E=r(a,l)}while(La);return E}function zE(){var n=z.H,r=n.useState()[0];return r=typeof r.then=="function"?Yo(r):r,n=n.useState()[0],(Rt!==null?Rt.memoizedState:null)!==n&&(Ye.flags|=1024),r}function Od(){var n=jc!==0;return jc=0,n}function Dd(n,r,a){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~a}function jd(n){if(Dc){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Dc=!1}Er=0,_n=Rt=Ye=null,La=!1,Vo=jc=0,Ma=null}function Kn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?Ye.memoizedState=_n=n:_n=_n.next=n,_n}function pn(){if(Rt===null){var n=Ye.alternate;n=n!==null?n.memoizedState:null}else n=Rt.next;var r=_n===null?Ye.memoizedState:_n.next;if(r!==null)_n=r,Rt=n;else{if(n===null)throw Ye.alternate===null?Error(s(467)):Error(s(310));Rt=n,n={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},_n===null?Ye.memoizedState=_n=n:_n=_n.next=n}return _n}function Ic(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yo(n){var r=Vo;return Vo+=1,Ma===null&&(Ma=[]),n=J_(Ma,n,r),r=Ye,(_n===null?r.memoizedState:_n.next)===null&&(r=r.alternate,z.H=r===null||r.memoizedState===null?Fv:Kd),n}function Bc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Yo(n);if(n.$$typeof===x)return Dn(n)}throw Error(s(438,String(n)))}function Id(n){var r=null,a=Ye.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=Ye.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(r={data:l.data.map(function(y){return y.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=Ic(),Ye.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(n),l=0;l<n;l++)a[l]=K;return r.index++,a}function kr(n,r){return typeof r=="function"?r(n):r}function Pc(n){var r=pn();return Bd(r,Rt,n)}function Bd(n,r,a){var l=n.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=a;var y=n.baseQueue,E=l.pending;if(E!==null){if(y!==null){var O=y.next;y.next=E.next,E.next=O}r.baseQueue=y=E,l.pending=null}if(E=n.baseState,y===null)n.memoizedState=E;else{r=y.next;var $=O=null,te=null,ce=r,ge=!1;do{var ve=ce.lane&-536870913;if(ve!==ce.lane?(at&ve)===ve:(Er&ve)===ve){var ue=ce.revertLane;if(ue===0)te!==null&&(te=te.next={lane:0,revertLane:0,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),ve===Ea&&(ge=!0);else if((Er&ue)===ue){ce=ce.next,ue===Ea&&(ge=!0);continue}else ve={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},te===null?($=te=ve,O=E):te=te.next=ve,Ye.lanes|=ue,os|=ue;ve=ce.action,Ws&&a(E,ve),E=ce.hasEagerState?ce.eagerState:a(E,ve)}else ue={lane:ve,revertLane:ce.revertLane,gesture:ce.gesture,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},te===null?($=te=ue,O=E):te=te.next=ue,Ye.lanes|=ve,os|=ve;ce=ce.next}while(ce!==null&&ce!==r);if(te===null?O=E:te.next=$,!bi(E,n.memoizedState)&&(vn=!0,ge&&(a=ka,a!==null)))throw a;n.memoizedState=E,n.baseState=O,n.baseQueue=te,l.lastRenderedState=E}return y===null&&(l.lanes=0),[n.memoizedState,l.dispatch]}function Pd(n){var r=pn(),a=r.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var l=a.dispatch,y=a.pending,E=r.memoizedState;if(y!==null){a.pending=null;var O=y=y.next;do E=n(E,O.action),O=O.next;while(O!==y);bi(E,r.memoizedState)||(vn=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),a.lastRenderedState=E}return[E,l]}function cv(n,r,a){var l=Ye,y=pn(),E=ct;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=r();var O=!bi((Rt||y).memoizedState,a);if(O&&(y.memoizedState=a,vn=!0),y=y.queue,$d(dv.bind(null,l,y,n),[n]),y.getSnapshot!==r||O||_n!==null&&_n.memoizedState.tag&1){if(l.flags|=2048,Na(9,{destroy:void 0},hv.bind(null,l,y,a,r),null),jt===null)throw Error(s(349));E||(Er&127)!==0||uv(l,r,a)}return a}function uv(n,r,a){n.flags|=16384,n={getSnapshot:r,value:a},r=Ye.updateQueue,r===null?(r=Ic(),Ye.updateQueue=r,r.stores=[n]):(a=r.stores,a===null?r.stores=[n]:a.push(n))}function hv(n,r,a,l){r.value=a,r.getSnapshot=l,fv(r)&&pv(n)}function dv(n,r,a){return a(function(){fv(r)&&pv(n)})}function fv(n){var r=n.getSnapshot;n=n.value;try{var a=r();return!bi(n,a)}catch{return!0}}function pv(n){var r=js(n,2);r!==null&&ui(r,n,2)}function zd(n){var r=Kn();if(typeof n=="function"){var a=n;if(n=a(),Ws){$t(!0);try{a()}finally{$t(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:n},r}function gv(n,r,a,l){return n.baseState=a,Bd(n,Rt,typeof l=="function"?l:kr)}function HE(n,r,a,l,y){if($c(n))throw Error(s(485));if(n=r.action,n!==null){var E={payload:y,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){E.listeners.push(O)}};z.T!==null?a(!0):E.isTransition=!1,l(E),a=r.pending,a===null?(E.next=r.pending=E,mv(r,E)):(E.next=a.next,r.pending=a.next=E)}}function mv(n,r){var a=r.action,l=r.payload,y=n.state;if(r.isTransition){var E=z.T,O={};z.T=O;try{var $=a(y,l),te=z.S;te!==null&&te(O,$),_v(n,r,$)}catch(ce){Hd(n,r,ce)}finally{E!==null&&O.types!==null&&(E.types=O.types),z.T=E}}else try{E=a(y,l),_v(n,r,E)}catch(ce){Hd(n,r,ce)}}function _v(n,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){vv(n,r,l)},function(l){return Hd(n,r,l)}):vv(n,r,a)}function vv(n,r,a){r.status="fulfilled",r.value=a,bv(r),n.state=a,r=n.pending,r!==null&&(a=r.next,a===r?n.pending=null:(a=a.next,r.next=a,mv(n,a)))}function Hd(n,r,a){var l=n.pending;if(n.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,bv(r),r=r.next;while(r!==l)}n.action=null}function bv(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function yv(n,r){return r}function Sv(n,r){if(ct){var a=jt.formState;if(a!==null){e:{var l=Ye;if(ct){if(Ut){t:{for(var y=Ut,E=Pi;y.nodeType!==8;){if(!E){y=null;break t}if(y=Hi(y.nextSibling),y===null){y=null;break t}}E=y.data,y=E==="F!"||E==="F"?y:null}if(y){Ut=Hi(y.nextSibling),l=y.data==="F!";break e}}Jr(l)}l=!1}l&&(r=a[0])}}return a=Kn(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yv,lastRenderedState:r},a.queue=l,a=Hv.bind(null,Ye,l),l.dispatch=a,l=zd(!1),E=qd.bind(null,Ye,!1,l.queue),l=Kn(),y={state:r,dispatch:null,action:n,pending:null},l.queue=y,a=HE.bind(null,Ye,y,E,a),y.dispatch=a,l.memoizedState=n,[r,a,!1]}function xv(n){var r=pn();return wv(r,Rt,n)}function wv(n,r,a){if(r=Bd(n,r,yv)[0],n=Pc(kr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Yo(r)}catch(O){throw O===Ta?Ac:O}else l=r;r=pn();var y=r.queue,E=y.dispatch;return a!==r.memoizedState&&(Ye.flags|=2048,Na(9,{destroy:void 0},$E.bind(null,y,a),null)),[l,E,n]}function $E(n,r){n.action=r}function Cv(n){var r=pn(),a=Rt;if(a!==null)return wv(r,a,n);pn(),r=r.memoizedState,a=pn();var l=a.queue.dispatch;return a.memoizedState=n,[r,l,!1]}function Na(n,r,a,l){return n={tag:n,create:a,deps:l,inst:r,next:null},r=Ye.updateQueue,r===null&&(r=Ic(),Ye.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=n.next=n:(l=a.next,a.next=n,n.next=l,r.lastEffect=n),n}function Ev(){return pn().memoizedState}function zc(n,r,a,l){var y=Kn();Ye.flags|=n,y.memoizedState=Na(1|r,{destroy:void 0},a,l===void 0?null:l)}function Hc(n,r,a,l){var y=pn();l=l===void 0?null:l;var E=y.memoizedState.inst;Rt!==null&&l!==null&&Md(l,Rt.memoizedState.deps)?y.memoizedState=Na(r,E,a,l):(Ye.flags|=n,y.memoizedState=Na(1|r,E,a,l))}function kv(n,r){zc(8390656,8,n,r)}function $d(n,r){Hc(2048,8,n,r)}function UE(n){Ye.flags|=4;var r=Ye.updateQueue;if(r===null)r=Ic(),Ye.updateQueue=r,r.events=[n];else{var a=r.events;a===null?r.events=[n]:a.push(n)}}function Tv(n){var r=pn().memoizedState;return UE({ref:r,nextImpl:n}),function(){if((St&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Av(n,r){return Hc(4,2,n,r)}function Rv(n,r){return Hc(4,4,n,r)}function Lv(n,r){if(typeof r=="function"){n=n();var a=r(n);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function Mv(n,r,a){a=a!=null?a.concat([n]):null,Hc(4,4,Lv.bind(null,r,n),a)}function Ud(){}function Nv(n,r){var a=pn();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Md(r,l[1])?l[0]:(a.memoizedState=[n,r],n)}function Ov(n,r){var a=pn();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Md(r,l[1]))return l[0];if(l=n(),Ws){$t(!0);try{n()}finally{$t(!1)}}return a.memoizedState=[l,r],l}function Fd(n,r,a){return a===void 0||(Er&1073741824)!==0&&(at&261930)===0?n.memoizedState=r:(n.memoizedState=a,n=D0(),Ye.lanes|=n,os|=n,a)}function Dv(n,r,a,l){return bi(a,r)?a:Ra.current!==null?(n=Fd(n,a,l),bi(n,r)||(vn=!0),n):(Er&42)===0||(Er&1073741824)!==0&&(at&261930)===0?(vn=!0,n.memoizedState=a):(n=D0(),Ye.lanes|=n,os|=n,r)}function jv(n,r,a,l,y){var E=V.p;V.p=E!==0&&8>E?E:8;var O=z.T,$={};z.T=$,qd(n,!1,r,a);try{var te=y(),ce=z.S;if(ce!==null&&ce($,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var ge=BE(te,l);Xo(n,r,ge,Ei(n))}else Xo(n,r,l,Ei(n))}catch(ve){Xo(n,r,{then:function(){},status:"rejected",reason:ve},Ei())}finally{V.p=E,O!==null&&$.types!==null&&(O.types=$.types),z.T=O}}function FE(){}function Wd(n,r,a,l){if(n.tag!==5)throw Error(s(476));var y=Iv(n).queue;jv(n,y,r,X,a===null?FE:function(){return Bv(n),a(l)})}function Iv(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:X},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:kr,lastRenderedState:a},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Bv(n){var r=Iv(n);r.next===null&&(r=n.alternate.memoizedState),Xo(n,r.next.queue,{},Ei())}function Gd(){return Dn(fl)}function Pv(){return pn().memoizedState}function zv(){return pn().memoizedState}function WE(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var a=Ei();n=ts(a);var l=ns(r,n,a);l!==null&&(ui(l,r,a),Go(l,r,a)),r={cache:yd()},n.payload=r;return}r=r.return}}function GE(n,r,a){var l=Ei();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$c(n)?$v(r,a):(a=cd(n,r,a,l),a!==null&&(ui(a,n,l),Uv(a,r,l)))}function Hv(n,r,a){var l=Ei();Xo(n,r,a,l)}function Xo(n,r,a,l){var y={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($c(n))$v(r,y);else{var E=n.alternate;if(n.lanes===0&&(E===null||E.lanes===0)&&(E=r.lastRenderedReducer,E!==null))try{var O=r.lastRenderedState,$=E(O,a);if(y.hasEagerState=!0,y.eagerState=$,bi($,O))return Sc(n,r,y,0),jt===null&&yc(),!1}catch{}if(a=cd(n,r,y,l),a!==null)return ui(a,n,l),Uv(a,r,l),!0}return!1}function qd(n,r,a,l){if(l={lane:2,revertLane:Ef(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$c(n)){if(r)throw Error(s(479))}else r=cd(n,a,l,2),r!==null&&ui(r,n,2)}function $c(n){var r=n.alternate;return n===Ye||r!==null&&r===Ye}function $v(n,r){La=Dc=!0;var a=n.pending;a===null?r.next=r:(r.next=a.next,a.next=r),n.pending=r}function Uv(n,r,a){if((a&4194048)!==0){var l=r.lanes;l&=n.pendingLanes,a|=l,r.lanes=a,ze(n,a)}}var Zo={readContext:Dn,use:Bc,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn};Zo.useEffectEvent=sn;var Fv={readContext:Dn,use:Bc,useCallback:function(n,r){return Kn().memoizedState=[n,r===void 0?null:r],n},useContext:Dn,useEffect:kv,useImperativeHandle:function(n,r,a){a=a!=null?a.concat([n]):null,zc(4194308,4,Lv.bind(null,r,n),a)},useLayoutEffect:function(n,r){return zc(4194308,4,n,r)},useInsertionEffect:function(n,r){zc(4,2,n,r)},useMemo:function(n,r){var a=Kn();r=r===void 0?null:r;var l=n();if(Ws){$t(!0);try{n()}finally{$t(!1)}}return a.memoizedState=[l,r],l},useReducer:function(n,r,a){var l=Kn();if(a!==void 0){var y=a(r);if(Ws){$t(!0);try{a(r)}finally{$t(!1)}}}else y=r;return l.memoizedState=l.baseState=y,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:y},l.queue=n,n=n.dispatch=GE.bind(null,Ye,n),[l.memoizedState,n]},useRef:function(n){var r=Kn();return n={current:n},r.memoizedState=n},useState:function(n){n=zd(n);var r=n.queue,a=Hv.bind(null,Ye,r);return r.dispatch=a,[n.memoizedState,a]},useDebugValue:Ud,useDeferredValue:function(n,r){var a=Kn();return Fd(a,n,r)},useTransition:function(){var n=zd(!1);return n=jv.bind(null,Ye,n.queue,!0,!1),Kn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,a){var l=Ye,y=Kn();if(ct){if(a===void 0)throw Error(s(407));a=a()}else{if(a=r(),jt===null)throw Error(s(349));(at&127)!==0||uv(l,r,a)}y.memoizedState=a;var E={value:a,getSnapshot:r};return y.queue=E,kv(dv.bind(null,l,E,n),[n]),l.flags|=2048,Na(9,{destroy:void 0},hv.bind(null,l,E,a,r),null),a},useId:function(){var n=Kn(),r=jt.identifierPrefix;if(ct){var a=lr,l=or;a=(l&~(1<<32-Et(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=jc++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=PE++,r="_"+r+"r_"+a.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Gd,useFormState:Sv,useActionState:Sv,useOptimistic:function(n){var r=Kn();r.memoizedState=r.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=qd.bind(null,Ye,!0,a),a.dispatch=r,[n,r]},useMemoCache:Id,useCacheRefresh:function(){return Kn().memoizedState=WE.bind(null,Ye)},useEffectEvent:function(n){var r=Kn(),a={impl:n};return r.memoizedState=a,function(){if((St&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Kd={readContext:Dn,use:Bc,useCallback:Nv,useContext:Dn,useEffect:$d,useImperativeHandle:Mv,useInsertionEffect:Av,useLayoutEffect:Rv,useMemo:Ov,useReducer:Pc,useRef:Ev,useState:function(){return Pc(kr)},useDebugValue:Ud,useDeferredValue:function(n,r){var a=pn();return Dv(a,Rt.memoizedState,n,r)},useTransition:function(){var n=Pc(kr)[0],r=pn().memoizedState;return[typeof n=="boolean"?n:Yo(n),r]},useSyncExternalStore:cv,useId:Pv,useHostTransitionStatus:Gd,useFormState:xv,useActionState:xv,useOptimistic:function(n,r){var a=pn();return gv(a,Rt,n,r)},useMemoCache:Id,useCacheRefresh:zv};Kd.useEffectEvent=Tv;var Wv={readContext:Dn,use:Bc,useCallback:Nv,useContext:Dn,useEffect:$d,useImperativeHandle:Mv,useInsertionEffect:Av,useLayoutEffect:Rv,useMemo:Ov,useReducer:Pd,useRef:Ev,useState:function(){return Pd(kr)},useDebugValue:Ud,useDeferredValue:function(n,r){var a=pn();return Rt===null?Fd(a,n,r):Dv(a,Rt.memoizedState,n,r)},useTransition:function(){var n=Pd(kr)[0],r=pn().memoizedState;return[typeof n=="boolean"?n:Yo(n),r]},useSyncExternalStore:cv,useId:Pv,useHostTransitionStatus:Gd,useFormState:Cv,useActionState:Cv,useOptimistic:function(n,r){var a=pn();return Rt!==null?gv(a,Rt,n,r):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Id,useCacheRefresh:zv};Wv.useEffectEvent=Tv;function Vd(n,r,a,l){r=n.memoizedState,a=a(l,r),a=a==null?r:g({},r,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var Yd={enqueueSetState:function(n,r,a){n=n._reactInternals;var l=Ei(),y=ts(l);y.payload=r,a!=null&&(y.callback=a),r=ns(n,y,l),r!==null&&(ui(r,n,l),Go(r,n,l))},enqueueReplaceState:function(n,r,a){n=n._reactInternals;var l=Ei(),y=ts(l);y.tag=1,y.payload=r,a!=null&&(y.callback=a),r=ns(n,y,l),r!==null&&(ui(r,n,l),Go(r,n,l))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var a=Ei(),l=ts(a);l.tag=2,r!=null&&(l.callback=r),r=ns(n,l,a),r!==null&&(ui(r,n,a),Go(r,n,a))}};function Gv(n,r,a,l,y,E,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(l,E,O):r.prototype&&r.prototype.isPureReactComponent?!Bo(a,l)||!Bo(y,E):!0}function qv(n,r,a,l){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,l),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,l),r.state!==n&&Yd.enqueueReplaceState(r,r.state,null)}function Gs(n,r){var a=r;if("ref"in r){a={};for(var l in r)l!=="ref"&&(a[l]=r[l])}if(n=n.defaultProps){a===r&&(a=g({},a));for(var y in n)a[y]===void 0&&(a[y]=n[y])}return a}function Kv(n){bc(n)}function Vv(n){console.error(n)}function Yv(n){bc(n)}function Uc(n,r){try{var a=n.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Xv(n,r,a){try{var l=n.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Xd(n,r,a){return a=ts(a),a.tag=3,a.payload={element:null},a.callback=function(){Uc(n,r)},a}function Zv(n){return n=ts(n),n.tag=3,n}function Jv(n,r,a,l){var y=a.type.getDerivedStateFromError;if(typeof y=="function"){var E=l.value;n.payload=function(){return y(E)},n.callback=function(){Xv(r,a,l)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){Xv(r,a,l),typeof y!="function"&&(ls===null?ls=new Set([this]):ls.add(this));var $=l.stack;this.componentDidCatch(l.value,{componentStack:$!==null?$:""})})}function qE(n,r,a,l,y){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&Ca(r,a,y,!0),a=Si.current,a!==null){switch(a.tag){case 31:case 13:return zi===null?eu():a.alternate===null&&an===0&&(an=3),a.flags&=-257,a.flags|=65536,a.lanes=y,l===Rc?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),xf(n,l,y)),!1;case 22:return a.flags|=65536,l===Rc?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([l]):a.add(l)),xf(n,l,y)),!1}throw Error(s(435,a.tag))}return xf(n,l,y),eu(),!1}if(ct)return r=Si.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=y,l!==gd&&(n=Error(s(422),{cause:l}),Ho(ji(n,a)))):(l!==gd&&(r=Error(s(423),{cause:l}),Ho(ji(r,a))),n=n.current.alternate,n.flags|=65536,y&=-y,n.lanes|=y,l=ji(l,a),y=Xd(n.stateNode,l,y),kd(n,y),an!==4&&(an=2)),!1;var E=Error(s(520),{cause:l});if(E=ji(E,a),sl===null?sl=[E]:sl.push(E),an!==4&&(an=2),r===null)return!0;l=ji(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,n=y&-y,a.lanes|=n,n=Xd(a.stateNode,l,n),kd(a,n),!1;case 1:if(r=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(ls===null||!ls.has(E))))return a.flags|=65536,y&=-y,a.lanes|=y,y=Zv(y),Jv(y,n,a,l),kd(a,y),!1}a=a.return}while(a!==null);return!1}var Zd=Error(s(461)),vn=!1;function jn(n,r,a,l){r.child=n===null?nv(r,null,a,l):Fs(r,n.child,a,l)}function Qv(n,r,a,l,y){a=a.render;var E=r.ref;if("ref"in l){var O={};for(var $ in l)$!=="ref"&&(O[$]=l[$])}else O=l;return zs(r),l=Nd(n,r,a,O,E,y),$=Od(),n!==null&&!vn?(Dd(n,r,y),Tr(n,r,y)):(ct&&$&&fd(r),r.flags|=1,jn(n,r,l,y),r.child)}function e0(n,r,a,l,y){if(n===null){var E=a.type;return typeof E=="function"&&!ud(E)&&E.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=E,t0(n,r,E,l,y)):(n=wc(a.type,null,l,r,r.mode,y),n.ref=r.ref,n.return=r,r.child=n)}if(E=n.child,!af(n,y)){var O=E.memoizedProps;if(a=a.compare,a=a!==null?a:Bo,a(O,l)&&n.ref===r.ref)return Tr(n,r,y)}return r.flags|=1,n=Sr(E,l),n.ref=r.ref,n.return=r,r.child=n}function t0(n,r,a,l,y){if(n!==null){var E=n.memoizedProps;if(Bo(E,l)&&n.ref===r.ref)if(vn=!1,r.pendingProps=l=E,af(n,y))(n.flags&131072)!==0&&(vn=!0);else return r.lanes=n.lanes,Tr(n,r,y)}return Jd(n,r,a,l,y)}function n0(n,r,a,l){var y=l.children,E=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((r.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,n!==null){for(l=r.child=n.child,y=0;l!==null;)y=y|l.lanes|l.childLanes,l=l.sibling;l=y&~E}else l=0,r.child=null;return i0(n,r,E,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Tc(r,E!==null?E.cachePool:null),E!==null?sv(r,E):Ad(),av(r);else return l=r.lanes=536870912,i0(n,r,E!==null?E.baseLanes|a:a,a,l)}else E!==null?(Tc(r,E.cachePool),sv(r,E),rs(),r.memoizedState=null):(n!==null&&Tc(r,null),Ad(),rs());return jn(n,r,y,a),r.child}function Jo(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function i0(n,r,a,l,y){var E=xd();return E=E===null?null:{parent:mn._currentValue,pool:E},r.memoizedState={baseLanes:a,cachePool:E},n!==null&&Tc(r,null),Ad(),av(r),n!==null&&Ca(n,r,l,!0),r.childLanes=y,null}function Fc(n,r){return r=Gc({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function r0(n,r,a){return Fs(r,n.child,null,a),n=Fc(r,r.pendingProps),n.flags|=2,xi(r),r.memoizedState=null,n}function KE(n,r,a){var l=r.pendingProps,y=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ct){if(l.mode==="hidden")return n=Fc(r,l),r.lanes=536870912,Jo(null,n);if(Ld(r),(n=Ut)?(n=m1(n,Pi),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Xr!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=$_(n),a.return=r,r.child=a,On=r,Ut=null)):n=null,n===null)throw Jr(r);return r.lanes=536870912,null}return Fc(r,l)}var E=n.memoizedState;if(E!==null){var O=E.dehydrated;if(Ld(r),y)if(r.flags&256)r.flags&=-257,r=r0(n,r,a);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(s(558));else if(vn||Ca(n,r,a,!1),y=(a&n.childLanes)!==0,vn||y){if(l=jt,l!==null&&(O=It(l,a),O!==0&&O!==E.retryLane))throw E.retryLane=O,js(n,O),ui(l,n,O),Zd;eu(),r=r0(n,r,a)}else n=E.treeContext,Ut=Hi(O.nextSibling),On=r,ct=!0,Zr=null,Pi=!1,n!==null&&W_(r,n),r=Fc(r,l),r.flags|=4096;return r}return n=Sr(n.child,{mode:l.mode,children:l.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Wc(n,r){var a=r.ref;if(a===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(n===null||n.ref!==a)&&(r.flags|=4194816)}}function Jd(n,r,a,l,y){return zs(r),a=Nd(n,r,a,l,void 0,y),l=Od(),n!==null&&!vn?(Dd(n,r,y),Tr(n,r,y)):(ct&&l&&fd(r),r.flags|=1,jn(n,r,a,y),r.child)}function s0(n,r,a,l,y,E){return zs(r),r.updateQueue=null,a=lv(r,l,a,y),ov(n),l=Od(),n!==null&&!vn?(Dd(n,r,E),Tr(n,r,E)):(ct&&l&&fd(r),r.flags|=1,jn(n,r,a,E),r.child)}function a0(n,r,a,l,y){if(zs(r),r.stateNode===null){var E=ya,O=a.contextType;typeof O=="object"&&O!==null&&(E=Dn(O)),E=new a(l,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Yd,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=l,E.state=r.memoizedState,E.refs={},Cd(r),O=a.contextType,E.context=typeof O=="object"&&O!==null?Dn(O):ya,E.state=r.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(Vd(r,a,O,l),E.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(O=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),O!==E.state&&Yd.enqueueReplaceState(E,E.state,null),Ko(r,l,E,y),qo(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(n===null){E=r.stateNode;var $=r.memoizedProps,te=Gs(a,$);E.props=te;var ce=E.context,ge=a.contextType;O=ya,typeof ge=="object"&&ge!==null&&(O=Dn(ge));var ve=a.getDerivedStateFromProps;ge=typeof ve=="function"||typeof E.getSnapshotBeforeUpdate=="function",$=r.pendingProps!==$,ge||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||($||ce!==O)&&qv(r,E,l,O),es=!1;var ue=r.memoizedState;E.state=ue,Ko(r,l,E,y),qo(),ce=r.memoizedState,$||ue!==ce||es?(typeof ve=="function"&&(Vd(r,a,ve,l),ce=r.memoizedState),(te=es||Gv(r,a,te,l,ue,ce,O))?(ge||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(r.flags|=4194308)):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=l,r.memoizedState=ce),E.props=l,E.state=ce,E.context=O,l=te):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),l=!1)}else{E=r.stateNode,Ed(n,r),O=r.memoizedProps,ge=Gs(a,O),E.props=ge,ve=r.pendingProps,ue=E.context,ce=a.contextType,te=ya,typeof ce=="object"&&ce!==null&&(te=Dn(ce)),$=a.getDerivedStateFromProps,(ce=typeof $=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==ve||ue!==te)&&qv(r,E,l,te),es=!1,ue=r.memoizedState,E.state=ue,Ko(r,l,E,y),qo();var he=r.memoizedState;O!==ve||ue!==he||es||n!==null&&n.dependencies!==null&&Ec(n.dependencies)?(typeof $=="function"&&(Vd(r,a,$,l),he=r.memoizedState),(ge=es||Gv(r,a,ge,l,ue,he,te)||n!==null&&n.dependencies!==null&&Ec(n.dependencies))?(ce||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(l,he,te),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(l,he,te)),typeof E.componentDidUpdate=="function"&&(r.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof E.componentDidUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=1024),r.memoizedProps=l,r.memoizedState=he),E.props=l,E.state=he,E.context=te,l=ge):(typeof E.componentDidUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=1024),l=!1)}return E=l,Wc(n,r),l=(r.flags&128)!==0,E||l?(E=r.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:E.render(),r.flags|=1,n!==null&&l?(r.child=Fs(r,n.child,null,y),r.child=Fs(r,null,a,y)):jn(n,r,a,y),r.memoizedState=E.state,n=r.child):n=Tr(n,r,y),n}function o0(n,r,a,l){return Bs(),r.flags|=256,jn(n,r,a,l),r.child}var Qd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ef(n){return{baseLanes:n,cachePool:X_()}}function tf(n,r,a){return n=n!==null?n.childLanes&~a:0,r&&(n|=Ci),n}function l0(n,r,a){var l=r.pendingProps,y=!1,E=(r.flags&128)!==0,O;if((O=E)||(O=n!==null&&n.memoizedState===null?!1:(fn.current&2)!==0),O&&(y=!0,r.flags&=-129),O=(r.flags&32)!==0,r.flags&=-33,n===null){if(ct){if(y?is(r):rs(),(n=Ut)?(n=m1(n,Pi),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Xr!==null?{id:or,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=$_(n),a.return=r,r.child=a,On=r,Ut=null)):n=null,n===null)throw Jr(r);return Pf(n)?r.lanes=32:r.lanes=536870912,null}var $=l.children;return l=l.fallback,y?(rs(),y=r.mode,$=Gc({mode:"hidden",children:$},y),l=Is(l,y,a,null),$.return=r,l.return=r,$.sibling=l,r.child=$,l=r.child,l.memoizedState=ef(a),l.childLanes=tf(n,O,a),r.memoizedState=Qd,Jo(null,l)):(is(r),nf(r,$))}var te=n.memoizedState;if(te!==null&&($=te.dehydrated,$!==null)){if(E)r.flags&256?(is(r),r.flags&=-257,r=rf(n,r,a)):r.memoizedState!==null?(rs(),r.child=n.child,r.flags|=128,r=null):(rs(),$=l.fallback,y=r.mode,l=Gc({mode:"visible",children:l.children},y),$=Is($,y,a,null),$.flags|=2,l.return=r,$.return=r,l.sibling=$,r.child=l,Fs(r,n.child,null,a),l=r.child,l.memoizedState=ef(a),l.childLanes=tf(n,O,a),r.memoizedState=Qd,r=Jo(null,l));else if(is(r),Pf($)){if(O=$.nextSibling&&$.nextSibling.dataset,O)var ce=O.dgst;O=ce,l=Error(s(419)),l.stack="",l.digest=O,Ho({value:l,source:null,stack:null}),r=rf(n,r,a)}else if(vn||Ca(n,r,a,!1),O=(a&n.childLanes)!==0,vn||O){if(O=jt,O!==null&&(l=It(O,a),l!==0&&l!==te.retryLane))throw te.retryLane=l,js(n,l),ui(O,n,l),Zd;Bf($)||eu(),r=rf(n,r,a)}else Bf($)?(r.flags|=192,r.child=n.child,r=null):(n=te.treeContext,Ut=Hi($.nextSibling),On=r,ct=!0,Zr=null,Pi=!1,n!==null&&W_(r,n),r=nf(r,l.children),r.flags|=4096);return r}return y?(rs(),$=l.fallback,y=r.mode,te=n.child,ce=te.sibling,l=Sr(te,{mode:"hidden",children:l.children}),l.subtreeFlags=te.subtreeFlags&65011712,ce!==null?$=Sr(ce,$):($=Is($,y,a,null),$.flags|=2),$.return=r,l.return=r,l.sibling=$,r.child=l,Jo(null,l),l=r.child,$=n.child.memoizedState,$===null?$=ef(a):(y=$.cachePool,y!==null?(te=mn._currentValue,y=y.parent!==te?{parent:te,pool:te}:y):y=X_(),$={baseLanes:$.baseLanes|a,cachePool:y}),l.memoizedState=$,l.childLanes=tf(n,O,a),r.memoizedState=Qd,Jo(n.child,l)):(is(r),a=n.child,n=a.sibling,a=Sr(a,{mode:"visible",children:l.children}),a.return=r,a.sibling=null,n!==null&&(O=r.deletions,O===null?(r.deletions=[n],r.flags|=16):O.push(n)),r.child=a,r.memoizedState=null,a)}function nf(n,r){return r=Gc({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Gc(n,r){return n=yi(22,n,null,r),n.lanes=0,n}function rf(n,r,a){return Fs(r,n.child,null,a),n=nf(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function c0(n,r,a){n.lanes|=r;var l=n.alternate;l!==null&&(l.lanes|=r),vd(n.return,r,a)}function sf(n,r,a,l,y,E){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:y,treeForkCount:E}:(O.isBackwards=r,O.rendering=null,O.renderingStartTime=0,O.last=l,O.tail=a,O.tailMode=y,O.treeForkCount=E)}function u0(n,r,a){var l=r.pendingProps,y=l.revealOrder,E=l.tail;l=l.children;var O=fn.current,$=(O&2)!==0;if($?(O=O&1|2,r.flags|=128):O&=1,q(fn,O),jn(n,r,l,a),l=ct?zo:0,!$&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&c0(n,a,r);else if(n.tag===19)c0(n,a,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(y){case"forwards":for(a=r.child,y=null;a!==null;)n=a.alternate,n!==null&&Oc(n)===null&&(y=a),a=a.sibling;a=y,a===null?(y=r.child,r.child=null):(y=a.sibling,a.sibling=null),sf(r,!1,y,a,E,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,y=r.child,r.child=null;y!==null;){if(n=y.alternate,n!==null&&Oc(n)===null){r.child=y;break}n=y.sibling,y.sibling=a,a=y,y=n}sf(r,!0,a,null,E,l);break;case"together":sf(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function Tr(n,r,a){if(n!==null&&(r.dependencies=n.dependencies),os|=r.lanes,(a&r.childLanes)===0)if(n!==null){if(Ca(n,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,a=Sr(n,n.pendingProps),r.child=a,a.return=r;n.sibling!==null;)n=n.sibling,a=a.sibling=Sr(n,n.pendingProps),a.return=r;a.sibling=null}return r.child}function af(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Ec(n)))}function VE(n,r,a){switch(r.tag){case 3:H(r,r.stateNode.containerInfo),Qr(r,mn,n.memoizedState.cache),Bs();break;case 27:case 5:fe(r);break;case 4:H(r,r.stateNode.containerInfo);break;case 10:Qr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Ld(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(is(r),r.flags|=128,null):(a&r.child.childLanes)!==0?l0(n,r,a):(is(r),n=Tr(n,r,a),n!==null?n.sibling:null);is(r);break;case 19:var y=(n.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(Ca(n,r,a,!1),l=(a&r.childLanes)!==0),y){if(l)return u0(n,r,a);r.flags|=128}if(y=r.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),q(fn,fn.current),l)break;return null;case 22:return r.lanes=0,n0(n,r,a,r.pendingProps);case 24:Qr(r,mn,n.memoizedState.cache)}return Tr(n,r,a)}function h0(n,r,a){if(n!==null)if(n.memoizedProps!==r.pendingProps)vn=!0;else{if(!af(n,a)&&(r.flags&128)===0)return vn=!1,VE(n,r,a);vn=(n.flags&131072)!==0}else vn=!1,ct&&(r.flags&1048576)!==0&&F_(r,zo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(n=$s(r.elementType),r.type=n,typeof n=="function")ud(n)?(l=Gs(n,l),r.tag=1,r=a0(null,r,n,l,a)):(r.tag=0,r=Jd(null,r,n,l,a));else{if(n!=null){var y=n.$$typeof;if(y===k){r.tag=11,r=Qv(null,r,n,l,a);break e}else if(y===N){r.tag=14,r=e0(null,r,n,l,a);break e}}throw r=Y(n)||n,Error(s(306,r,""))}}return r;case 0:return Jd(n,r,r.type,r.pendingProps,a);case 1:return l=r.type,y=Gs(l,r.pendingProps),a0(n,r,l,y,a);case 3:e:{if(H(r,r.stateNode.containerInfo),n===null)throw Error(s(387));l=r.pendingProps;var E=r.memoizedState;y=E.element,Ed(n,r),Ko(r,l,null,a);var O=r.memoizedState;if(l=O.cache,Qr(r,mn,l),l!==E.cache&&bd(r,[mn],a,!0),qo(),l=O.element,E.isDehydrated)if(E={element:l,isDehydrated:!1,cache:O.cache},r.updateQueue.baseState=E,r.memoizedState=E,r.flags&256){r=o0(n,r,l,a);break e}else if(l!==y){y=ji(Error(s(424)),r),Ho(y),r=o0(n,r,l,a);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Ut=Hi(n.firstChild),On=r,ct=!0,Zr=null,Pi=!0,a=nv(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Bs(),l===y){r=Tr(n,r,a);break e}jn(n,r,l,a)}r=r.child}return r;case 26:return Wc(n,r),n===null?(a=x1(r.type,null,r.pendingProps,null))?r.memoizedState=a:ct||(a=r.type,n=r.pendingProps,l=ou(ie.current).createElement(a),l[de]=r,l[je]=n,In(l,a,n),$e(l),r.stateNode=l):r.memoizedState=x1(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return fe(r),n===null&&ct&&(l=r.stateNode=b1(r.type,r.pendingProps,ie.current),On=r,Pi=!0,y=Ut,ds(r.type)?(zf=y,Ut=Hi(l.firstChild)):Ut=y),jn(n,r,r.pendingProps.children,a),Wc(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ct&&((y=l=Ut)&&(l=C5(l,r.type,r.pendingProps,Pi),l!==null?(r.stateNode=l,On=r,Ut=Hi(l.firstChild),Pi=!1,y=!0):y=!1),y||Jr(r)),fe(r),y=r.type,E=r.pendingProps,O=n!==null?n.memoizedProps:null,l=E.children,Df(y,E)?l=null:O!==null&&Df(y,O)&&(r.flags|=32),r.memoizedState!==null&&(y=Nd(n,r,zE,null,null,a),fl._currentValue=y),Wc(n,r),jn(n,r,l,a),r.child;case 6:return n===null&&ct&&((n=a=Ut)&&(a=E5(a,r.pendingProps,Pi),a!==null?(r.stateNode=a,On=r,Ut=null,n=!0):n=!1),n||Jr(r)),null;case 13:return l0(n,r,a);case 4:return H(r,r.stateNode.containerInfo),l=r.pendingProps,n===null?r.child=Fs(r,null,l,a):jn(n,r,l,a),r.child;case 11:return Qv(n,r,r.type,r.pendingProps,a);case 7:return jn(n,r,r.pendingProps,a),r.child;case 8:return jn(n,r,r.pendingProps.children,a),r.child;case 12:return jn(n,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Qr(r,r.type,l.value),jn(n,r,l.children,a),r.child;case 9:return y=r.type._context,l=r.pendingProps.children,zs(r),y=Dn(y),l=l(y),r.flags|=1,jn(n,r,l,a),r.child;case 14:return e0(n,r,r.type,r.pendingProps,a);case 15:return t0(n,r,r.type,r.pendingProps,a);case 19:return u0(n,r,a);case 31:return KE(n,r,a);case 22:return n0(n,r,a,r.pendingProps);case 24:return zs(r),l=Dn(mn),n===null?(y=xd(),y===null&&(y=jt,E=yd(),y.pooledCache=E,E.refCount++,E!==null&&(y.pooledCacheLanes|=a),y=E),r.memoizedState={parent:l,cache:y},Cd(r),Qr(r,mn,y)):((n.lanes&a)!==0&&(Ed(n,r),Ko(r,null,null,a),qo()),y=n.memoizedState,E=r.memoizedState,y.parent!==l?(y={parent:l,cache:l},r.memoizedState=y,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=y),Qr(r,mn,l)):(l=E.cache,Qr(r,mn,l),l!==y.cache&&bd(r,[mn],a,!0))),jn(n,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Ar(n){n.flags|=4}function of(n,r,a,l,y){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(y&335544128)===y)if(n.stateNode.complete)n.flags|=8192;else if(P0())n.flags|=8192;else throw Us=Rc,wd}else n.flags&=-16777217}function d0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!T1(r))if(P0())n.flags|=8192;else throw Us=Rc,wd}function qc(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?Pe():536870912,n.lanes|=r,Ia|=r)}function Qo(n,r){if(!ct)switch(n.tailMode){case"hidden":r=n.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:l.sibling=null}}function Ft(n){var r=n.alternate!==null&&n.alternate.child===n.child,a=0,l=0;if(r)for(var y=n.child;y!==null;)a|=y.lanes|y.childLanes,l|=y.subtreeFlags&65011712,l|=y.flags&65011712,y.return=n,y=y.sibling;else for(y=n.child;y!==null;)a|=y.lanes|y.childLanes,l|=y.subtreeFlags,l|=y.flags,y.return=n,y=y.sibling;return n.subtreeFlags|=l,n.childLanes=a,r}function YE(n,r,a){var l=r.pendingProps;switch(pd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(r),null;case 1:return Ft(r),null;case 3:return a=r.stateNode,l=null,n!==null&&(l=n.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Cr(mn),oe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(wa(r)?Ar(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,md())),Ft(r),null;case 26:var y=r.type,E=r.memoizedState;return n===null?(Ar(r),E!==null?(Ft(r),d0(r,E)):(Ft(r),of(r,y,null,l,a))):E?E!==n.memoizedState?(Ar(r),Ft(r),d0(r,E)):(Ft(r),r.flags&=-16777217):(n=n.memoizedProps,n!==l&&Ar(r),Ft(r),of(r,y,n,l,a)),null;case 27:if(Se(r),a=ie.current,y=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==l&&Ar(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return Ft(r),null}n=Q.current,wa(r)?G_(r):(n=b1(y,l,a),r.stateNode=n,Ar(r))}return Ft(r),null;case 5:if(Se(r),y=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==l&&Ar(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return Ft(r),null}if(E=Q.current,wa(r))G_(r);else{var O=ou(ie.current);switch(E){case 1:E=O.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:E=O.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":E=O.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":E=O.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":E=O.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof l.is=="string"?O.createElement("select",{is:l.is}):O.createElement("select"),l.multiple?E.multiple=!0:l.size&&(E.size=l.size);break;default:E=typeof l.is=="string"?O.createElement(y,{is:l.is}):O.createElement(y)}}E[de]=r,E[je]=l;e:for(O=r.child;O!==null;){if(O.tag===5||O.tag===6)E.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===r)break e;for(;O.sibling===null;){if(O.return===null||O.return===r)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}r.stateNode=E;e:switch(In(E,y,l),y){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ar(r)}}return Ft(r),of(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,a),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==l&&Ar(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(s(166));if(n=ie.current,wa(r)){if(n=r.stateNode,a=r.memoizedProps,l=null,y=On,y!==null)switch(y.tag){case 27:case 5:l=y.memoizedProps}n[de]=r,n=!!(n.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||l1(n.nodeValue,a)),n||Jr(r,!0)}else n=ou(n).createTextNode(l),n[de]=r,r.stateNode=n}return Ft(r),null;case 31:if(a=r.memoizedState,n===null||n.memoizedState!==null){if(l=wa(r),a!==null){if(n===null){if(!l)throw Error(s(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[de]=r}else Bs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ft(r),n=!1}else a=md(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return r.flags&256?(xi(r),r):(xi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return Ft(r),null;case 13:if(l=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(y=wa(r),l!==null&&l.dehydrated!==null){if(n===null){if(!y)throw Error(s(318));if(y=r.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(s(317));y[de]=r}else Bs(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ft(r),y=!1}else y=md(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=y),y=!0;if(!y)return r.flags&256?(xi(r),r):(xi(r),null)}return xi(r),(r.flags&128)!==0?(r.lanes=a,r):(a=l!==null,n=n!==null&&n.memoizedState!==null,a&&(l=r.child,y=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(y=l.alternate.memoizedState.cachePool.pool),E=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(E=l.memoizedState.cachePool.pool),E!==y&&(l.flags|=2048)),a!==n&&a&&(r.child.flags|=8192),qc(r,r.updateQueue),Ft(r),null);case 4:return oe(),n===null&&Rf(r.stateNode.containerInfo),Ft(r),null;case 10:return Cr(r.type),Ft(r),null;case 19:if(U(fn),l=r.memoizedState,l===null)return Ft(r),null;if(y=(r.flags&128)!==0,E=l.rendering,E===null)if(y)Qo(l,!1);else{if(an!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(E=Oc(n),E!==null){for(r.flags|=128,Qo(l,!1),n=E.updateQueue,r.updateQueue=n,qc(r,n),r.subtreeFlags=0,n=a,a=r.child;a!==null;)H_(a,n),a=a.sibling;return q(fn,fn.current&1|2),ct&&xr(r,l.treeForkCount),r.child}n=n.sibling}l.tail!==null&&ht()>Zc&&(r.flags|=128,y=!0,Qo(l,!1),r.lanes=4194304)}else{if(!y)if(n=Oc(E),n!==null){if(r.flags|=128,y=!0,n=n.updateQueue,r.updateQueue=n,qc(r,n),Qo(l,!0),l.tail===null&&l.tailMode==="hidden"&&!E.alternate&&!ct)return Ft(r),null}else 2*ht()-l.renderingStartTime>Zc&&a!==536870912&&(r.flags|=128,y=!0,Qo(l,!1),r.lanes=4194304);l.isBackwards?(E.sibling=r.child,r.child=E):(n=l.last,n!==null?n.sibling=E:r.child=E,l.last=E)}return l.tail!==null?(n=l.tail,l.rendering=n,l.tail=n.sibling,l.renderingStartTime=ht(),n.sibling=null,a=fn.current,q(fn,y?a&1|2:a&1),ct&&xr(r,l.treeForkCount),n):(Ft(r),null);case 22:case 23:return xi(r),Rd(),l=r.memoizedState!==null,n!==null?n.memoizedState!==null!==l&&(r.flags|=8192):l&&(r.flags|=8192),l?(a&536870912)!==0&&(r.flags&128)===0&&(Ft(r),r.subtreeFlags&6&&(r.flags|=8192)):Ft(r),a=r.updateQueue,a!==null&&qc(r,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),l=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),l!==a&&(r.flags|=2048),n!==null&&U(Hs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),Cr(mn),Ft(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function XE(n,r){switch(pd(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Cr(mn),oe(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return Se(r),null;case 31:if(r.memoizedState!==null){if(xi(r),r.alternate===null)throw Error(s(340));Bs()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(xi(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Bs()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return U(fn),null;case 4:return oe(),null;case 10:return Cr(r.type),null;case 22:case 23:return xi(r),Rd(),n!==null&&U(Hs),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Cr(mn),null;case 25:return null;default:return null}}function f0(n,r){switch(pd(r),r.tag){case 3:Cr(mn),oe();break;case 26:case 27:case 5:Se(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&xi(r);break;case 13:xi(r);break;case 19:U(fn);break;case 10:Cr(r.type);break;case 22:case 23:xi(r),Rd(),n!==null&&U(Hs);break;case 24:Cr(mn)}}function el(n,r){try{var a=r.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var y=l.next;a=y;do{if((a.tag&n)===n){l=void 0;var E=a.create,O=a.inst;l=E(),O.destroy=l}a=a.next}while(a!==y)}}catch($){At(r,r.return,$)}}function ss(n,r,a){try{var l=r.updateQueue,y=l!==null?l.lastEffect:null;if(y!==null){var E=y.next;l=E;do{if((l.tag&n)===n){var O=l.inst,$=O.destroy;if($!==void 0){O.destroy=void 0,y=r;var te=a,ce=$;try{ce()}catch(ge){At(y,te,ge)}}}l=l.next}while(l!==E)}}catch(ge){At(r,r.return,ge)}}function p0(n){var r=n.updateQueue;if(r!==null){var a=n.stateNode;try{rv(r,a)}catch(l){At(n,n.return,l)}}}function g0(n,r,a){a.props=Gs(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(l){At(n,r,l)}}function tl(n,r){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var l=n.stateNode;break;case 30:l=n.stateNode;break;default:l=n.stateNode}typeof a=="function"?n.refCleanup=a(l):a.current=l}}catch(y){At(n,r,y)}}function cr(n,r){var a=n.ref,l=n.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(y){At(n,r,y)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(y){At(n,r,y)}else a.current=null}function m0(n){var r=n.type,a=n.memoizedProps,l=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(y){At(n,n.return,y)}}function lf(n,r,a){try{var l=n.stateNode;v5(l,n.type,a,r),l[je]=r}catch(y){At(n,n.return,y)}}function _0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ds(n.type)||n.tag===4}function cf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||_0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&ds(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function uf(n,r,a){var l=n.tag;if(l===5||l===6)n=n.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(n,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(n),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=we));else if(l!==4&&(l===27&&ds(n.type)&&(a=n.stateNode,r=null),n=n.child,n!==null))for(uf(n,r,a),n=n.sibling;n!==null;)uf(n,r,a),n=n.sibling}function Kc(n,r,a){var l=n.tag;if(l===5||l===6)n=n.stateNode,r?a.insertBefore(n,r):a.appendChild(n);else if(l!==4&&(l===27&&ds(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(Kc(n,r,a),n=n.sibling;n!==null;)Kc(n,r,a),n=n.sibling}function v0(n){var r=n.stateNode,a=n.memoizedProps;try{for(var l=n.type,y=r.attributes;y.length;)r.removeAttributeNode(y[0]);In(r,l,a),r[de]=n,r[je]=a}catch(E){At(n,n.return,E)}}var Rr=!1,bn=!1,hf=!1,b0=typeof WeakSet=="function"?WeakSet:Set,En=null;function ZE(n,r){if(n=n.containerInfo,Nf=pu,n=M_(n),id(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var y=l.anchorOffset,E=l.focusNode;l=l.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var O=0,$=-1,te=-1,ce=0,ge=0,ve=n,ue=null;t:for(;;){for(var he;ve!==a||y!==0&&ve.nodeType!==3||($=O+y),ve!==E||l!==0&&ve.nodeType!==3||(te=O+l),ve.nodeType===3&&(O+=ve.nodeValue.length),(he=ve.firstChild)!==null;)ue=ve,ve=he;for(;;){if(ve===n)break t;if(ue===a&&++ce===y&&($=O),ue===E&&++ge===l&&(te=O),(he=ve.nextSibling)!==null)break;ve=ue,ue=ve.parentNode}ve=he}a=$===-1||te===-1?null:{start:$,end:te}}else a=null}a=a||{start:0,end:0}}else a=null;for(Of={focusedElem:n,selectionRange:a},pu=!1,En=r;En!==null;)if(r=En,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,En=n;else for(;En!==null;){switch(r=En,E=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(a=0;a<n.length;a++)y=n[a],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&E!==null){n=void 0,a=r,y=E.memoizedProps,E=E.memoizedState,l=a.stateNode;try{var Le=Gs(a.type,y);n=l.getSnapshotBeforeUpdate(Le,E),l.__reactInternalSnapshotBeforeUpdate=n}catch(We){At(a,a.return,We)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,a=n.nodeType,a===9)If(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":If(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=r.sibling,n!==null){n.return=r.return,En=n;break}En=r.return}}function y0(n,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Mr(n,a),l&4&&el(5,a);break;case 1:if(Mr(n,a),l&4)if(n=a.stateNode,r===null)try{n.componentDidMount()}catch(O){At(a,a.return,O)}else{var y=Gs(a.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(y,r,n.__reactInternalSnapshotBeforeUpdate)}catch(O){At(a,a.return,O)}}l&64&&p0(a),l&512&&tl(a,a.return);break;case 3:if(Mr(n,a),l&64&&(n=a.updateQueue,n!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{rv(n,r)}catch(O){At(a,a.return,O)}}break;case 27:r===null&&l&4&&v0(a);case 26:case 5:Mr(n,a),r===null&&l&4&&m0(a),l&512&&tl(a,a.return);break;case 12:Mr(n,a);break;case 31:Mr(n,a),l&4&&w0(n,a);break;case 13:Mr(n,a),l&4&&C0(n,a),l&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=a5.bind(null,a),k5(n,a))));break;case 22:if(l=a.memoizedState!==null||Rr,!l){r=r!==null&&r.memoizedState!==null||bn,y=Rr;var E=bn;Rr=l,(bn=r)&&!E?Nr(n,a,(a.subtreeFlags&8772)!==0):Mr(n,a),Rr=y,bn=E}break;case 30:break;default:Mr(n,a)}}function S0(n){var r=n.alternate;r!==null&&(n.alternate=null,S0(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&Re(r)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Yt=null,ai=!1;function Lr(n,r,a){for(a=a.child;a!==null;)x0(n,r,a),a=a.sibling}function x0(n,r,a){if(Ht&&typeof Ht.onCommitFiberUnmount=="function")try{Ht.onCommitFiberUnmount(hn,a)}catch{}switch(a.tag){case 26:bn||cr(a,r),Lr(n,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:bn||cr(a,r);var l=Yt,y=ai;ds(a.type)&&(Yt=a.stateNode,ai=!1),Lr(n,r,a),ul(a.stateNode),Yt=l,ai=y;break;case 5:bn||cr(a,r);case 6:if(l=Yt,y=ai,Yt=null,Lr(n,r,a),Yt=l,ai=y,Yt!==null)if(ai)try{(Yt.nodeType===9?Yt.body:Yt.nodeName==="HTML"?Yt.ownerDocument.body:Yt).removeChild(a.stateNode)}catch(E){At(a,r,E)}else try{Yt.removeChild(a.stateNode)}catch(E){At(a,r,E)}break;case 18:Yt!==null&&(ai?(n=Yt,p1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),Wa(n)):p1(Yt,a.stateNode));break;case 4:l=Yt,y=ai,Yt=a.stateNode.containerInfo,ai=!0,Lr(n,r,a),Yt=l,ai=y;break;case 0:case 11:case 14:case 15:ss(2,a,r),bn||ss(4,a,r),Lr(n,r,a);break;case 1:bn||(cr(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&g0(a,r,l)),Lr(n,r,a);break;case 21:Lr(n,r,a);break;case 22:bn=(l=bn)||a.memoizedState!==null,Lr(n,r,a),bn=l;break;default:Lr(n,r,a)}}function w0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Wa(n)}catch(a){At(r,r.return,a)}}}function C0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Wa(n)}catch(a){At(r,r.return,a)}}function JE(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new b0),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new b0),r;default:throw Error(s(435,n.tag))}}function Vc(n,r){var a=JE(n);r.forEach(function(l){if(!a.has(l)){a.add(l);var y=o5.bind(null,n,l);l.then(y,y)}})}function oi(n,r){var a=r.deletions;if(a!==null)for(var l=0;l<a.length;l++){var y=a[l],E=n,O=r,$=O;e:for(;$!==null;){switch($.tag){case 27:if(ds($.type)){Yt=$.stateNode,ai=!1;break e}break;case 5:Yt=$.stateNode,ai=!1;break e;case 3:case 4:Yt=$.stateNode.containerInfo,ai=!0;break e}$=$.return}if(Yt===null)throw Error(s(160));x0(E,O,y),Yt=null,ai=!1,E=y.alternate,E!==null&&(E.return=null),y.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)E0(r,n),r=r.sibling}var Ji=null;function E0(n,r){var a=n.alternate,l=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:oi(r,n),li(n),l&4&&(ss(3,n,n.return),el(3,n),ss(5,n,n.return));break;case 1:oi(r,n),li(n),l&512&&(bn||a===null||cr(a,a.return)),l&64&&Rr&&(n=n.updateQueue,n!==null&&(l=n.callbacks,l!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var y=Ji;if(oi(r,n),li(n),l&512&&(bn||a===null||cr(a,a.return)),l&4){var E=a!==null?a.memoizedState:null;if(l=n.memoizedState,a===null)if(l===null)if(n.stateNode===null){e:{l=n.type,a=n.memoizedProps,y=y.ownerDocument||y;t:switch(l){case"title":E=y.getElementsByTagName("title")[0],(!E||E[wn]||E[de]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=y.createElement(l),y.head.insertBefore(E,y.querySelector("head > title"))),In(E,l,a),E[de]=n,$e(E),l=E;break e;case"link":var O=E1("link","href",y).get(l+(a.href||""));if(O){for(var $=0;$<O.length;$++)if(E=O[$],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){O.splice($,1);break t}}E=y.createElement(l),In(E,l,a),y.head.appendChild(E);break;case"meta":if(O=E1("meta","content",y).get(l+(a.content||""))){for($=0;$<O.length;$++)if(E=O[$],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){O.splice($,1);break t}}E=y.createElement(l),In(E,l,a),y.head.appendChild(E);break;default:throw Error(s(468,l))}E[de]=n,$e(E),l=E}n.stateNode=l}else k1(y,n.type,n.stateNode);else n.stateNode=C1(y,l,n.memoizedProps);else E!==l?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,l===null?k1(y,n.type,n.stateNode):C1(y,l,n.memoizedProps)):l===null&&n.stateNode!==null&&lf(n,n.memoizedProps,a.memoizedProps)}break;case 27:oi(r,n),li(n),l&512&&(bn||a===null||cr(a,a.return)),a!==null&&l&4&&lf(n,n.memoizedProps,a.memoizedProps);break;case 5:if(oi(r,n),li(n),l&512&&(bn||a===null||cr(a,a.return)),n.flags&32){y=n.stateNode;try{Ge(y,"")}catch(Le){At(n,n.return,Le)}}l&4&&n.stateNode!=null&&(y=n.memoizedProps,lf(n,y,a!==null?a.memoizedProps:y)),l&1024&&(hf=!0);break;case 6:if(oi(r,n),li(n),l&4){if(n.stateNode===null)throw Error(s(162));l=n.memoizedProps,a=n.stateNode;try{a.nodeValue=l}catch(Le){At(n,n.return,Le)}}break;case 3:if(uu=null,y=Ji,Ji=lu(r.containerInfo),oi(r,n),Ji=y,li(n),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Wa(r.containerInfo)}catch(Le){At(n,n.return,Le)}hf&&(hf=!1,k0(n));break;case 4:l=Ji,Ji=lu(n.stateNode.containerInfo),oi(r,n),li(n),Ji=l;break;case 12:oi(r,n),li(n);break;case 31:oi(r,n),li(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Vc(n,l)));break;case 13:oi(r,n),li(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Xc=ht()),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Vc(n,l)));break;case 22:y=n.memoizedState!==null;var te=a!==null&&a.memoizedState!==null,ce=Rr,ge=bn;if(Rr=ce||y,bn=ge||te,oi(r,n),bn=ge,Rr=ce,li(n),l&8192)e:for(r=n.stateNode,r._visibility=y?r._visibility&-2:r._visibility|1,y&&(a===null||te||Rr||bn||qs(n)),a=null,r=n;;){if(r.tag===5||r.tag===26){if(a===null){te=a=r;try{if(E=te.stateNode,y)O=E.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{$=te.stateNode;var ve=te.memoizedProps.style,ue=ve!=null&&ve.hasOwnProperty("display")?ve.display:null;$.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(Le){At(te,te.return,Le)}}}else if(r.tag===6){if(a===null){te=r;try{te.stateNode.nodeValue=y?"":te.memoizedProps}catch(Le){At(te,te.return,Le)}}}else if(r.tag===18){if(a===null){te=r;try{var he=te.stateNode;y?g1(he,!0):g1(te.stateNode,!1)}catch(Le){At(te,te.return,Le)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}l&4&&(l=n.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Vc(n,a))));break;case 19:oi(r,n),li(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Vc(n,l)));break;case 30:break;case 21:break;default:oi(r,n),li(n)}}function li(n){var r=n.flags;if(r&2){try{for(var a,l=n.return;l!==null;){if(_0(l)){a=l;break}l=l.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var y=a.stateNode,E=cf(n);Kc(n,E,y);break;case 5:var O=a.stateNode;a.flags&32&&(Ge(O,""),a.flags&=-33);var $=cf(n);Kc(n,$,O);break;case 3:case 4:var te=a.stateNode.containerInfo,ce=cf(n);uf(n,ce,te);break;default:throw Error(s(161))}}catch(ge){At(n,n.return,ge)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function k0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;k0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function Mr(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)y0(n,r.alternate,r),r=r.sibling}function qs(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:ss(4,r,r.return),qs(r);break;case 1:cr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&g0(r,r.return,a),qs(r);break;case 27:ul(r.stateNode);case 26:case 5:cr(r,r.return),qs(r);break;case 22:r.memoizedState===null&&qs(r);break;case 30:qs(r);break;default:qs(r)}n=n.sibling}}function Nr(n,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var l=r.alternate,y=n,E=r,O=E.flags;switch(E.tag){case 0:case 11:case 15:Nr(y,E,a),el(4,E);break;case 1:if(Nr(y,E,a),l=E,y=l.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ce){At(l,l.return,ce)}if(l=E,y=l.updateQueue,y!==null){var $=l.stateNode;try{var te=y.shared.hiddenCallbacks;if(te!==null)for(y.shared.hiddenCallbacks=null,y=0;y<te.length;y++)iv(te[y],$)}catch(ce){At(l,l.return,ce)}}a&&O&64&&p0(E),tl(E,E.return);break;case 27:v0(E);case 26:case 5:Nr(y,E,a),a&&l===null&&O&4&&m0(E),tl(E,E.return);break;case 12:Nr(y,E,a);break;case 31:Nr(y,E,a),a&&O&4&&w0(y,E);break;case 13:Nr(y,E,a),a&&O&4&&C0(y,E);break;case 22:E.memoizedState===null&&Nr(y,E,a),tl(E,E.return);break;case 30:break;default:Nr(y,E,a)}r=r.sibling}}function df(n,r){var a=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==a&&(n!=null&&n.refCount++,a!=null&&$o(a))}function ff(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&$o(n))}function Qi(n,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)T0(n,r,a,l),r=r.sibling}function T0(n,r,a,l){var y=r.flags;switch(r.tag){case 0:case 11:case 15:Qi(n,r,a,l),y&2048&&el(9,r);break;case 1:Qi(n,r,a,l);break;case 3:Qi(n,r,a,l),y&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&$o(n)));break;case 12:if(y&2048){Qi(n,r,a,l),n=r.stateNode;try{var E=r.memoizedProps,O=E.id,$=E.onPostCommit;typeof $=="function"&&$(O,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(te){At(r,r.return,te)}}else Qi(n,r,a,l);break;case 31:Qi(n,r,a,l);break;case 13:Qi(n,r,a,l);break;case 23:break;case 22:E=r.stateNode,O=r.alternate,r.memoizedState!==null?E._visibility&2?Qi(n,r,a,l):nl(n,r):E._visibility&2?Qi(n,r,a,l):(E._visibility|=2,Oa(n,r,a,l,(r.subtreeFlags&10256)!==0||!1)),y&2048&&df(O,r);break;case 24:Qi(n,r,a,l),y&2048&&ff(r.alternate,r);break;default:Qi(n,r,a,l)}}function Oa(n,r,a,l,y){for(y=y&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var E=n,O=r,$=a,te=l,ce=O.flags;switch(O.tag){case 0:case 11:case 15:Oa(E,O,$,te,y),el(8,O);break;case 23:break;case 22:var ge=O.stateNode;O.memoizedState!==null?ge._visibility&2?Oa(E,O,$,te,y):nl(E,O):(ge._visibility|=2,Oa(E,O,$,te,y)),y&&ce&2048&&df(O.alternate,O);break;case 24:Oa(E,O,$,te,y),y&&ce&2048&&ff(O.alternate,O);break;default:Oa(E,O,$,te,y)}r=r.sibling}}function nl(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=n,l=r,y=l.flags;switch(l.tag){case 22:nl(a,l),y&2048&&df(l.alternate,l);break;case 24:nl(a,l),y&2048&&ff(l.alternate,l);break;default:nl(a,l)}r=r.sibling}}var il=8192;function Da(n,r,a){if(n.subtreeFlags&il)for(n=n.child;n!==null;)A0(n,r,a),n=n.sibling}function A0(n,r,a){switch(n.tag){case 26:Da(n,r,a),n.flags&il&&n.memoizedState!==null&&P5(a,Ji,n.memoizedState,n.memoizedProps);break;case 5:Da(n,r,a);break;case 3:case 4:var l=Ji;Ji=lu(n.stateNode.containerInfo),Da(n,r,a),Ji=l;break;case 22:n.memoizedState===null&&(l=n.alternate,l!==null&&l.memoizedState!==null?(l=il,il=16777216,Da(n,r,a),il=l):Da(n,r,a));break;default:Da(n,r,a)}}function R0(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function rl(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];En=l,M0(l,n)}R0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)L0(n),n=n.sibling}function L0(n){switch(n.tag){case 0:case 11:case 15:rl(n),n.flags&2048&&ss(9,n,n.return);break;case 3:rl(n);break;case 12:rl(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,Yc(n)):rl(n);break;default:rl(n)}}function Yc(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var l=r[a];En=l,M0(l,n)}R0(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:ss(8,r,r.return),Yc(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Yc(r));break;default:Yc(r)}n=n.sibling}}function M0(n,r){for(;En!==null;){var a=En;switch(a.tag){case 0:case 11:case 15:ss(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:$o(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,En=l;else e:for(a=n;En!==null;){l=En;var y=l.sibling,E=l.return;if(S0(l),l===a){En=null;break e}if(y!==null){y.return=E,En=y;break e}En=E}}}var QE={getCacheForType:function(n){var r=Dn(mn),a=r.data.get(n);return a===void 0&&(a=n(),r.data.set(n,a)),a},cacheSignal:function(){return Dn(mn).controller.signal}},e5=typeof WeakMap=="function"?WeakMap:Map,St=0,jt=null,it=null,at=0,Tt=0,wi=null,as=!1,ja=!1,pf=!1,Or=0,an=0,os=0,Ks=0,gf=0,Ci=0,Ia=0,sl=null,ci=null,mf=!1,Xc=0,N0=0,Zc=1/0,Jc=null,ls=null,Cn=0,cs=null,Ba=null,Dr=0,_f=0,vf=null,O0=null,al=0,bf=null;function Ei(){return(St&2)!==0&&at!==0?at&-at:z.T!==null?Ef():Mi()}function D0(){if(Ci===0)if((at&536870912)===0||ct){var n=$n;$n<<=1,($n&3932160)===0&&($n=262144),Ci=n}else Ci=536870912;return n=Si.current,n!==null&&(n.flags|=32),Ci}function ui(n,r,a){(n===jt&&(Tt===2||Tt===9)||n.cancelPendingCommit!==null)&&(Pa(n,0),us(n,at,Ci,!1)),ft(n,a),((St&2)===0||n!==jt)&&(n===jt&&((St&2)===0&&(Ks|=a),an===4&&us(n,at,Ci,!1)),ur(n))}function j0(n,r,a){if((St&6)!==0)throw Error(s(327));var l=!a&&(r&127)===0&&(r&n.expiredLanes)===0||pe(n,r),y=l?i5(n,r):Sf(n,r,!0),E=l;do{if(y===0){ja&&!l&&us(n,r,0,!1);break}else{if(a=n.current.alternate,E&&!t5(a)){y=Sf(n,r,!1),E=!1;continue}if(y===2){if(E=r,n.errorRecoveryDisabledLanes&E)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){r=O;e:{var $=n;y=sl;var te=$.current.memoizedState.isDehydrated;if(te&&(Pa($,O).flags|=256),O=Sf($,O,!1),O!==2){if(pf&&!te){$.errorRecoveryDisabledLanes|=E,Ks|=E,y=4;break e}E=ci,ci=y,E!==null&&(ci===null?ci=E:ci.push.apply(ci,E))}y=O}if(E=!1,y!==2)continue}}if(y===1){Pa(n,0),us(n,r,0,!0);break}e:{switch(l=n,E=y,E){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:us(l,r,Ci,!as);break e;case 2:ci=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(y=Xc+300-ht(),10<y)){if(us(l,r,Ci,!as),ee(l,0,!0)!==0)break e;Dr=r,l.timeoutHandle=d1(I0.bind(null,l,a,ci,Jc,mf,r,Ci,Ks,Ia,as,E,"Throttled",-0,0),y);break e}I0(l,a,ci,Jc,mf,r,Ci,Ks,Ia,as,E,null,-0,0)}}break}while(!0);ur(n)}function I0(n,r,a,l,y,E,O,$,te,ce,ge,ve,ue,he){if(n.timeoutHandle=-1,ve=r.subtreeFlags,ve&8192||(ve&16785408)===16785408){ve={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:we},A0(r,E,ve);var Le=(E&62914560)===E?Xc-ht():(E&4194048)===E?N0-ht():0;if(Le=z5(ve,Le),Le!==null){Dr=E,n.cancelPendingCommit=Le(W0.bind(null,n,r,E,a,l,y,O,$,te,ge,ve,null,ue,he)),us(n,E,O,!ce);return}}W0(n,r,E,a,l,y,O,$,te)}function t5(n){for(var r=n;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var y=a[l],E=y.getSnapshot;y=y.value;try{if(!bi(E(),y))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function us(n,r,a,l){r&=~gf,r&=~Ks,n.suspendedLanes|=r,n.pingedLanes&=~r,l&&(n.warmLanes|=r),l=n.expirationTimes;for(var y=r;0<y;){var E=31-Et(y),O=1<<E;l[E]=-1,y&=~O}a!==0&&Ce(n,a,r)}function Qc(){return(St&6)===0?(ol(0),!1):!0}function yf(){if(it!==null){if(Tt===0)var n=it.return;else n=it,wr=Ps=null,jd(n),Aa=null,Fo=0,n=it;for(;n!==null;)f0(n.alternate,n),n=n.return;it=null}}function Pa(n,r){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,S5(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),Dr=0,yf(),jt=n,it=a=Sr(n.current,null),at=r,Tt=0,wi=null,as=!1,ja=pe(n,r),pf=!1,Ia=Ci=gf=Ks=os=an=0,ci=sl=null,mf=!1,(r&8)!==0&&(r|=r&32);var l=n.entangledLanes;if(l!==0)for(n=n.entanglements,l&=r;0<l;){var y=31-Et(l),E=1<<y;r|=n[y],l&=~E}return Or=r,yc(),a}function B0(n,r){Ye=null,z.H=Zo,r===Ta||r===Ac?(r=Q_(),Tt=3):r===wd?(r=Q_(),Tt=4):Tt=r===Zd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,wi=r,it===null&&(an=1,Uc(n,ji(r,n.current)))}function P0(){var n=Si.current;return n===null?!0:(at&4194048)===at?zi===null:(at&62914560)===at||(at&536870912)!==0?n===zi:!1}function z0(){var n=z.H;return z.H=Zo,n===null?Zo:n}function H0(){var n=z.A;return z.A=QE,n}function eu(){an=4,as||(at&4194048)!==at&&Si.current!==null||(ja=!0),(os&134217727)===0&&(Ks&134217727)===0||jt===null||us(jt,at,Ci,!1)}function Sf(n,r,a){var l=St;St|=2;var y=z0(),E=H0();(jt!==n||at!==r)&&(Jc=null,Pa(n,r)),r=!1;var O=an;e:do try{if(Tt!==0&&it!==null){var $=it,te=wi;switch(Tt){case 8:yf(),O=6;break e;case 3:case 2:case 9:case 6:Si.current===null&&(r=!0);var ce=Tt;if(Tt=0,wi=null,za(n,$,te,ce),a&&ja){O=0;break e}break;default:ce=Tt,Tt=0,wi=null,za(n,$,te,ce)}}n5(),O=an;break}catch(ge){B0(n,ge)}while(!0);return r&&n.shellSuspendCounter++,wr=Ps=null,St=l,z.H=y,z.A=E,it===null&&(jt=null,at=0,yc()),O}function n5(){for(;it!==null;)$0(it)}function i5(n,r){var a=St;St|=2;var l=z0(),y=H0();jt!==n||at!==r?(Jc=null,Zc=ht()+500,Pa(n,r)):ja=pe(n,r);e:do try{if(Tt!==0&&it!==null){r=it;var E=wi;t:switch(Tt){case 1:Tt=0,wi=null,za(n,r,E,1);break;case 2:case 9:if(Z_(E)){Tt=0,wi=null,U0(r);break}r=function(){Tt!==2&&Tt!==9||jt!==n||(Tt=7),ur(n)},E.then(r,r);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:Z_(E)?(Tt=0,wi=null,U0(r)):(Tt=0,wi=null,za(n,r,E,7));break;case 5:var O=null;switch(it.tag){case 26:O=it.memoizedState;case 5:case 27:var $=it;if(O?T1(O):$.stateNode.complete){Tt=0,wi=null;var te=$.sibling;if(te!==null)it=te;else{var ce=$.return;ce!==null?(it=ce,tu(ce)):it=null}break t}}Tt=0,wi=null,za(n,r,E,5);break;case 6:Tt=0,wi=null,za(n,r,E,6);break;case 8:yf(),an=6;break e;default:throw Error(s(462))}}r5();break}catch(ge){B0(n,ge)}while(!0);return wr=Ps=null,z.H=l,z.A=y,St=a,it!==null?0:(jt=null,at=0,yc(),an)}function r5(){for(;it!==null&&!qn();)$0(it)}function $0(n){var r=h0(n.alternate,n,Or);n.memoizedProps=n.pendingProps,r===null?tu(n):it=r}function U0(n){var r=n,a=r.alternate;switch(r.tag){case 15:case 0:r=s0(a,r,r.pendingProps,r.type,void 0,at);break;case 11:r=s0(a,r,r.pendingProps,r.type.render,r.ref,at);break;case 5:jd(r);default:f0(a,r),r=it=H_(r,Or),r=h0(a,r,Or)}n.memoizedProps=n.pendingProps,r===null?tu(n):it=r}function za(n,r,a,l){wr=Ps=null,jd(r),Aa=null,Fo=0;var y=r.return;try{if(qE(n,y,r,a,at)){an=1,Uc(n,ji(a,n.current)),it=null;return}}catch(E){if(y!==null)throw it=y,E;an=1,Uc(n,ji(a,n.current)),it=null;return}r.flags&32768?(ct||l===1?n=!0:ja||(at&536870912)!==0?n=!1:(as=n=!0,(l===2||l===9||l===3||l===6)&&(l=Si.current,l!==null&&l.tag===13&&(l.flags|=16384))),F0(r,n)):tu(r)}function tu(n){var r=n;do{if((r.flags&32768)!==0){F0(r,as);return}n=r.return;var a=YE(r.alternate,r,Or);if(a!==null){it=a;return}if(r=r.sibling,r!==null){it=r;return}it=r=n}while(r!==null);an===0&&(an=5)}function F0(n,r){do{var a=XE(n.alternate,n);if(a!==null){a.flags&=32767,it=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(n=n.sibling,n!==null)){it=n;return}it=n=a}while(n!==null);an=6,it=null}function W0(n,r,a,l,y,E,O,$,te){n.cancelPendingCommit=null;do nu();while(Cn!==0);if((St&6)!==0)throw Error(s(327));if(r!==null){if(r===n.current)throw Error(s(177));if(E=r.lanes|r.childLanes,E|=ld,Te(n,a,E,O,$,te),n===jt&&(it=jt=null,at=0),Ba=r,cs=n,Dr=a,_f=E,vf=y,O0=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,l5(nn,function(){return Y0(),null})):(n.callbackNode=null,n.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=z.T,z.T=null,y=V.p,V.p=2,O=St,St|=4;try{ZE(n,r,a)}finally{St=O,V.p=y,z.T=l}}Cn=1,G0(),q0(),K0()}}function G0(){if(Cn===1){Cn=0;var n=cs,r=Ba,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var l=V.p;V.p=2;var y=St;St|=4;try{E0(r,n);var E=Of,O=M_(n.containerInfo),$=E.focusedElem,te=E.selectionRange;if(O!==$&&$&&$.ownerDocument&&L_($.ownerDocument.documentElement,$)){if(te!==null&&id($)){var ce=te.start,ge=te.end;if(ge===void 0&&(ge=ce),"selectionStart"in $)$.selectionStart=ce,$.selectionEnd=Math.min(ge,$.value.length);else{var ve=$.ownerDocument||document,ue=ve&&ve.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),Le=$.textContent.length,We=Math.min(te.start,Le),Mt=te.end===void 0?We:Math.min(te.end,Le);!he.extend&&We>Mt&&(O=Mt,Mt=We,We=O);var se=R_($,We),ne=R_($,Mt);if(se&&ne&&(he.rangeCount!==1||he.anchorNode!==se.node||he.anchorOffset!==se.offset||he.focusNode!==ne.node||he.focusOffset!==ne.offset)){var le=ve.createRange();le.setStart(se.node,se.offset),he.removeAllRanges(),We>Mt?(he.addRange(le),he.extend(ne.node,ne.offset)):(le.setEnd(ne.node,ne.offset),he.addRange(le))}}}}for(ve=[],he=$;he=he.parentNode;)he.nodeType===1&&ve.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<ve.length;$++){var _e=ve[$];_e.element.scrollLeft=_e.left,_e.element.scrollTop=_e.top}}pu=!!Nf,Of=Nf=null}finally{St=y,V.p=l,z.T=a}}n.current=r,Cn=2}}function q0(){if(Cn===2){Cn=0;var n=cs,r=Ba,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var l=V.p;V.p=2;var y=St;St|=4;try{y0(n,r.alternate,r)}finally{St=y,V.p=l,z.T=a}}Cn=3}}function K0(){if(Cn===4||Cn===3){Cn=0,Zt();var n=cs,r=Ba,a=Dr,l=O0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Cn=5:(Cn=0,Ba=cs=null,V0(n,n.pendingLanes));var y=n.pendingLanes;if(y===0&&(ls=null),dn(a),r=r.stateNode,Ht&&typeof Ht.onCommitFiberRoot=="function")try{Ht.onCommitFiberRoot(hn,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=z.T,y=V.p,V.p=2,z.T=null;try{for(var E=n.onRecoverableError,O=0;O<l.length;O++){var $=l[O];E($.value,{componentStack:$.stack})}}finally{z.T=r,V.p=y}}(Dr&3)!==0&&nu(),ur(n),y=n.pendingLanes,(a&261930)!==0&&(y&42)!==0?n===bf?al++:(al=0,bf=n):al=0,ol(0)}}function V0(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,$o(r)))}function nu(){return G0(),q0(),K0(),Y0()}function Y0(){if(Cn!==5)return!1;var n=cs,r=_f;_f=0;var a=dn(Dr),l=z.T,y=V.p;try{V.p=32>a?32:a,z.T=null,a=vf,vf=null;var E=cs,O=Dr;if(Cn=0,Ba=cs=null,Dr=0,(St&6)!==0)throw Error(s(331));var $=St;if(St|=4,L0(E.current),T0(E,E.current,O,a),St=$,ol(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(hn,E)}catch{}return!0}finally{V.p=y,z.T=l,V0(n,r)}}function X0(n,r,a){r=ji(a,r),r=Xd(n.stateNode,r,2),n=ns(n,r,2),n!==null&&(ft(n,2),ur(n))}function At(n,r,a){if(n.tag===3)X0(n,n,a);else for(;r!==null;){if(r.tag===3){X0(r,n,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ls===null||!ls.has(l))){n=ji(a,n),a=Zv(2),l=ns(r,a,2),l!==null&&(Jv(a,l,r,n),ft(l,2),ur(l));break}}r=r.return}}function xf(n,r,a){var l=n.pingCache;if(l===null){l=n.pingCache=new e5;var y=new Set;l.set(r,y)}else y=l.get(r),y===void 0&&(y=new Set,l.set(r,y));y.has(a)||(pf=!0,y.add(a),n=s5.bind(null,n,r,a),r.then(n,n))}function s5(n,r,a){var l=n.pingCache;l!==null&&l.delete(r),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,jt===n&&(at&a)===a&&(an===4||an===3&&(at&62914560)===at&&300>ht()-Xc?(St&2)===0&&Pa(n,0):gf|=a,Ia===at&&(Ia=0)),ur(n)}function Z0(n,r){r===0&&(r=Pe()),n=js(n,r),n!==null&&(ft(n,r),ur(n))}function a5(n){var r=n.memoizedState,a=0;r!==null&&(a=r.retryLane),Z0(n,a)}function o5(n,r){var a=0;switch(n.tag){case 31:case 13:var l=n.stateNode,y=n.memoizedState;y!==null&&(a=y.retryLane);break;case 19:l=n.stateNode;break;case 22:l=n.stateNode._retryCache;break;default:throw Error(s(314))}l!==null&&l.delete(r),Z0(n,a)}function l5(n,r){return Ct(n,r)}var iu=null,Ha=null,wf=!1,ru=!1,Cf=!1,hs=0;function ur(n){n!==Ha&&n.next===null&&(Ha===null?iu=Ha=n:Ha=Ha.next=n),ru=!0,wf||(wf=!0,u5())}function ol(n,r){if(!Cf&&ru){Cf=!0;do for(var a=!1,l=iu;l!==null;){if(n!==0){var y=l.pendingLanes;if(y===0)var E=0;else{var O=l.suspendedLanes,$=l.pingedLanes;E=(1<<31-Et(42|n)+1)-1,E&=y&~(O&~$),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,t1(l,E))}else E=at,E=ee(l,l===jt?E:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(E&3)===0||pe(l,E)||(a=!0,t1(l,E));l=l.next}while(a);Cf=!1}}function c5(){J0()}function J0(){ru=wf=!1;var n=0;hs!==0&&y5()&&(n=hs);for(var r=ht(),a=null,l=iu;l!==null;){var y=l.next,E=Q0(l,r);E===0?(l.next=null,a===null?iu=y:a.next=y,y===null&&(Ha=a)):(a=l,(n!==0||(E&3)!==0)&&(ru=!0)),l=y}Cn!==0&&Cn!==5||ol(n),hs!==0&&(hs=0)}function Q0(n,r){for(var a=n.suspendedLanes,l=n.pingedLanes,y=n.expirationTimes,E=n.pendingLanes&-62914561;0<E;){var O=31-Et(E),$=1<<O,te=y[O];te===-1?(($&a)===0||($&l)!==0)&&(y[O]=xe($,r)):te<=r&&(n.expiredLanes|=$),E&=~$}if(r=jt,a=at,a=ee(n,n===r?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l=n.callbackNode,a===0||n===r&&(Tt===2||Tt===9)||n.cancelPendingCommit!==null)return l!==null&&l!==null&&Gn(l),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||pe(n,a)){if(r=a&-a,r===n.callbackPriority)return r;switch(l!==null&&Gn(l),dn(a)){case 2:case 8:a=Kt;break;case 32:a=nn;break;case 268435456:a=xn;break;default:a=nn}return l=e1.bind(null,n),a=Ct(a,l),n.callbackPriority=r,n.callbackNode=a,r}return l!==null&&l!==null&&Gn(l),n.callbackPriority=2,n.callbackNode=null,2}function e1(n,r){if(Cn!==0&&Cn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(nu()&&n.callbackNode!==a)return null;var l=at;return l=ee(n,n===jt?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l===0?null:(j0(n,l,r),Q0(n,ht()),n.callbackNode!=null&&n.callbackNode===a?e1.bind(null,n):null)}function t1(n,r){if(nu())return null;j0(n,r,!0)}function u5(){x5(function(){(St&6)!==0?Ct(zt,c5):J0()})}function Ef(){if(hs===0){var n=Ea;n===0&&(n=Ln,Ln<<=1,(Ln&261888)===0&&(Ln=256)),hs=n}return hs}function n1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Vr(""+n)}function i1(n,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,n.id&&a.setAttribute("form",n.id),r.parentNode.insertBefore(a,r),n=new FormData(n),a.parentNode.removeChild(a),n}function h5(n,r,a,l,y){if(r==="submit"&&a&&a.stateNode===y){var E=n1((y[je]||null).action),O=l.submitter;O&&(r=(r=O[je]||null)?n1(r.formAction):O.getAttribute("formAction"),r!==null&&(E=r,O=null));var $=new mc("action","action",null,l,y);n.push({event:$,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(hs!==0){var te=O?i1(y,O):new FormData(y);Wd(a,{pending:!0,data:te,method:y.method,action:E},null,te)}}else typeof E=="function"&&($.preventDefault(),te=O?i1(y,O):new FormData(y),Wd(a,{pending:!0,data:te,method:y.method,action:E},E,te))},currentTarget:y}]})}}for(var kf=0;kf<od.length;kf++){var Tf=od[kf],d5=Tf.toLowerCase(),f5=Tf[0].toUpperCase()+Tf.slice(1);Zi(d5,"on"+f5)}Zi(D_,"onAnimationEnd"),Zi(j_,"onAnimationIteration"),Zi(I_,"onAnimationStart"),Zi("dblclick","onDoubleClick"),Zi("focusin","onFocus"),Zi("focusout","onBlur"),Zi(RE,"onTransitionRun"),Zi(LE,"onTransitionStart"),Zi(ME,"onTransitionCancel"),Zi(B_,"onTransitionEnd"),be("onMouseEnter",["mouseout","mouseover"]),be("onMouseLeave",["mouseout","mouseover"]),be("onPointerEnter",["pointerout","pointerover"]),be("onPointerLeave",["pointerout","pointerover"]),Dt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ll="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(" "),p5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ll));function r1(n,r){r=(r&4)!==0;for(var a=0;a<n.length;a++){var l=n[a],y=l.event;l=l.listeners;e:{var E=void 0;if(r)for(var O=l.length-1;0<=O;O--){var $=l[O],te=$.instance,ce=$.currentTarget;if($=$.listener,te!==E&&y.isPropagationStopped())break e;E=$,y.currentTarget=ce;try{E(y)}catch(ge){bc(ge)}y.currentTarget=null,E=te}else for(O=0;O<l.length;O++){if($=l[O],te=$.instance,ce=$.currentTarget,$=$.listener,te!==E&&y.isPropagationStopped())break e;E=$,y.currentTarget=ce;try{E(y)}catch(ge){bc(ge)}y.currentTarget=null,E=te}}}}function rt(n,r){var a=r[nt];a===void 0&&(a=r[nt]=new Set);var l=n+"__bubble";a.has(l)||(s1(r,n,2,!1),a.add(l))}function Af(n,r,a){var l=0;r&&(l|=4),s1(a,n,l,r)}var su="_reactListening"+Math.random().toString(36).slice(2);function Rf(n){if(!n[su]){n[su]=!0,yt.forEach(function(a){a!=="selectionchange"&&(p5.has(a)||Af(a,!1,n),Af(a,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[su]||(r[su]=!0,Af("selectionchange",!1,r))}}function s1(n,r,a,l){switch(D1(r)){case 2:var y=U5;break;case 8:y=F5;break;default:y=Wf}a=y.bind(null,r,a,n),y=void 0,!Vh||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(y=!0),l?y!==void 0?n.addEventListener(r,a,{capture:!0,passive:y}):n.addEventListener(r,a,!0):y!==void 0?n.addEventListener(r,a,{passive:y}):n.addEventListener(r,a,!1)}function Lf(n,r,a,l,y){var E=l;if((r&1)===0&&(r&2)===0&&l!==null)e:for(;;){if(l===null)return;var O=l.tag;if(O===3||O===4){var $=l.stateNode.containerInfo;if($===y)break;if(O===4)for(O=l.return;O!==null;){var te=O.tag;if((te===3||te===4)&&O.stateNode.containerInfo===y)return;O=O.return}for(;$!==null;){if(O=J($),O===null)return;if(te=O.tag,te===5||te===6||te===26||te===27){l=E=O;continue e}$=$.parentNode}}l=l.return}dc(function(){var ce=E,ge=Ve(a),ve=[];e:{var ue=P_.get(n);if(ue!==void 0){var he=mc,Le=n;switch(n){case"keypress":if(pc(a)===0)break e;case"keydown":case"keyup":he=oE;break;case"focusin":Le="focus",he=Jh;break;case"focusout":Le="blur",he=Jh;break;case"beforeblur":case"afterblur":he=Jh;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=f_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=Y2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=uE;break;case D_:case j_:case I_:he=J2;break;case B_:he=dE;break;case"scroll":case"scrollend":he=K2;break;case"wheel":he=pE;break;case"copy":case"cut":case"paste":he=eE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=g_;break;case"toggle":case"beforetoggle":he=mE}var We=(r&4)!==0,Mt=!We&&(n==="scroll"||n==="scrollend"),se=We?ue!==null?ue+"Capture":null:ue;We=[];for(var ne=ce,le;ne!==null;){var _e=ne;if(le=_e.stateNode,_e=_e.tag,_e!==5&&_e!==26&&_e!==27||le===null||se===null||(_e=Lo(ne,se),_e!=null&&We.push(cl(ne,_e,le))),Mt)break;ne=ne.return}0<We.length&&(ue=new he(ue,Le,null,a,ge),ve.push({event:ue,listeners:We}))}}if((r&7)===0){e:{if(ue=n==="mouseover"||n==="pointerover",he=n==="mouseout"||n==="pointerout",ue&&a!==Ne&&(Le=a.relatedTarget||a.fromElement)&&(J(Le)||Le[vt]))break e;if((he||ue)&&(ue=ge.window===ge?ge:(ue=ge.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?(Le=a.relatedTarget||a.toElement,he=ce,Le=Le?J(Le):null,Le!==null&&(Mt=f(Le),We=Le.tag,Le!==Mt||We!==5&&We!==27&&We!==6)&&(Le=null)):(he=null,Le=ce),he!==Le)){if(We=f_,_e="onMouseLeave",se="onMouseEnter",ne="mouse",(n==="pointerout"||n==="pointerover")&&(We=g_,_e="onPointerLeave",se="onPointerEnter",ne="pointer"),Mt=he==null?ue:Ee(he),le=Le==null?ue:Ee(Le),ue=new We(_e,ne+"leave",he,a,ge),ue.target=Mt,ue.relatedTarget=le,_e=null,J(ge)===ce&&(We=new We(se,ne+"enter",Le,a,ge),We.target=le,We.relatedTarget=Mt,_e=We),Mt=_e,he&&Le)t:{for(We=g5,se=he,ne=Le,le=0,_e=se;_e;_e=We(_e))le++;_e=0;for(var He=ne;He;He=We(He))_e++;for(;0<le-_e;)se=We(se),le--;for(;0<_e-le;)ne=We(ne),_e--;for(;le--;){if(se===ne||ne!==null&&se===ne.alternate){We=se;break t}se=We(se),ne=We(ne)}We=null}else We=null;he!==null&&a1(ve,ue,he,We,!1),Le!==null&&Mt!==null&&a1(ve,Mt,Le,We,!0)}}e:{if(ue=ce?Ee(ce):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var gt=w_;else if(S_(ue))if(C_)gt=kE;else{gt=CE;var Oe=wE}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ce&&Kr(ce.elementType)&&(gt=w_):gt=EE;if(gt&&(gt=gt(n,ce))){x_(ve,gt,a,ge);break e}Oe&&Oe(n,ue,ce),n==="focusout"&&ce&&ue.type==="number"&&ce.memoizedProps.value!=null&&pa(ue,"number",ue.value)}switch(Oe=ce?Ee(ce):window,n){case"focusin":(S_(Oe)||Oe.contentEditable==="true")&&(_a=Oe,rd=ce,Po=null);break;case"focusout":Po=rd=_a=null;break;case"mousedown":sd=!0;break;case"contextmenu":case"mouseup":case"dragend":sd=!1,N_(ve,a,ge);break;case"selectionchange":if(AE)break;case"keydown":case"keyup":N_(ve,a,ge)}var Ze;if(ed)e:{switch(n){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else ma?b_(n,a)&&(ot="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(ot="onCompositionStart");ot&&(m_&&a.locale!=="ko"&&(ma||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&ma&&(Ze=h_()):(Yr=ge,Yh="value"in Yr?Yr.value:Yr.textContent,ma=!0)),Oe=au(ce,ot),0<Oe.length&&(ot=new p_(ot,n,null,a,ge),ve.push({event:ot,listeners:Oe}),Ze?ot.data=Ze:(Ze=y_(a),Ze!==null&&(ot.data=Ze)))),(Ze=vE?bE(n,a):yE(n,a))&&(ot=au(ce,"onBeforeInput"),0<ot.length&&(Oe=new p_("onBeforeInput","beforeinput",null,a,ge),ve.push({event:Oe,listeners:ot}),Oe.data=Ze)),h5(ve,n,ce,a,ge)}r1(ve,r)})}function cl(n,r,a){return{instance:n,listener:r,currentTarget:a}}function au(n,r){for(var a=r+"Capture",l=[];n!==null;){var y=n,E=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||E===null||(y=Lo(n,a),y!=null&&l.unshift(cl(n,y,E)),y=Lo(n,r),y!=null&&l.push(cl(n,y,E))),n.tag===3)return l;n=n.return}return[]}function g5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function a1(n,r,a,l,y){for(var E=r._reactName,O=[];a!==null&&a!==l;){var $=a,te=$.alternate,ce=$.stateNode;if($=$.tag,te!==null&&te===l)break;$!==5&&$!==26&&$!==27||ce===null||(te=ce,y?(ce=Lo(a,E),ce!=null&&O.unshift(cl(a,ce,te))):y||(ce=Lo(a,E),ce!=null&&O.push(cl(a,ce,te)))),a=a.return}O.length!==0&&n.push({event:r,listeners:O})}var m5=/\r\n?/g,_5=/\u0000|\uFFFD/g;function o1(n){return(typeof n=="string"?n:""+n).replace(m5,`
9
+ `).replace(_5,"")}function l1(n,r){return r=o1(r),o1(n)===r}function Lt(n,r,a,l,y,E){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||Ge(n,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&Ge(n,""+l);break;case"className":_i(n,"class",l);break;case"tabIndex":_i(n,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":_i(n,a,l);break;case"style":kt(n,l,E);break;case"data":if(r!=="object"){_i(n,"data",l);break}case"src":case"href":if(l===""&&(r!=="a"||a!=="href")){n.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){n.removeAttribute(a);break}l=Vr(""+l),n.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){n.setAttribute(a,"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 E=="function"&&(a==="formAction"?(r!=="input"&&Lt(n,r,"name",y.name,y,null),Lt(n,r,"formEncType",y.formEncType,y,null),Lt(n,r,"formMethod",y.formMethod,y,null),Lt(n,r,"formTarget",y.formTarget,y,null)):(Lt(n,r,"encType",y.encType,y,null),Lt(n,r,"method",y.method,y,null),Lt(n,r,"target",y.target,y,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){n.removeAttribute(a);break}l=Vr(""+l),n.setAttribute(a,l);break;case"onClick":l!=null&&(n.onclick=we);break;case"onScroll":l!=null&&rt("scroll",n);break;case"onScrollEnd":l!=null&&rt("scrollend",n);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(y.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":n.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){n.removeAttribute("xlink:href");break}a=Vr(""+l),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(a,""+l):n.removeAttribute(a);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":l&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":l===!0?n.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?n.setAttribute(a,l):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?n.setAttribute(a,l):n.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?n.removeAttribute(a):n.setAttribute(a,l);break;case"popover":rt("beforetoggle",n),rt("toggle",n),Un(n,"popover",l);break;case"xlinkActuate":ii(n,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ii(n,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ii(n,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ii(n,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ii(n,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ii(n,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ii(n,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ii(n,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ii(n,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Un(n,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=br.get(a)||a,Un(n,a,l))}}function Mf(n,r,a,l,y,E){switch(a){case"style":kt(n,l,E);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(s(61));if(a=l.__html,a!=null){if(y.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof l=="string"?Ge(n,l):(typeof l=="number"||typeof l=="bigint")&&Ge(n,""+l);break;case"onScroll":l!=null&&rt("scroll",n);break;case"onScrollEnd":l!=null&&rt("scrollend",n);break;case"onClick":l!=null&&(n.onclick=we);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wt.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(y=a.endsWith("Capture"),r=a.slice(2,y?a.length-7:void 0),E=n[je]||null,E=E!=null?E[a]:null,typeof E=="function"&&n.removeEventListener(r,E,y),typeof l=="function")){typeof E!="function"&&E!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(r,l,y);break e}a in n?n[a]=l:l===!0?n.setAttribute(a,""):Un(n,a,l)}}}function In(n,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":rt("error",n),rt("load",n);var l=!1,y=!1,E;for(E in a)if(a.hasOwnProperty(E)){var O=a[E];if(O!=null)switch(E){case"src":l=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Lt(n,r,E,O,a,null)}}y&&Lt(n,r,"srcSet",a.srcSet,a,null),l&&Lt(n,r,"src",a.src,a,null);return;case"input":rt("invalid",n);var $=E=O=y=null,te=null,ce=null;for(l in a)if(a.hasOwnProperty(l)){var ge=a[l];if(ge!=null)switch(l){case"name":y=ge;break;case"type":O=ge;break;case"checked":te=ge;break;case"defaultChecked":ce=ge;break;case"value":E=ge;break;case"defaultValue":$=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(s(137,r));break;default:Lt(n,r,l,ge,a,null)}}Ms(n,E,$,te,ce,O,y,!1);return;case"select":rt("invalid",n),l=O=E=null;for(y in a)if(a.hasOwnProperty(y)&&($=a[y],$!=null))switch(y){case"value":E=$;break;case"defaultValue":O=$;break;case"multiple":l=$;default:Lt(n,r,y,$,a,null)}r=E,a=O,n.multiple=!!l,r!=null?Nn(n,!!l,r,!1):a!=null&&Nn(n,!!l,a,!0);return;case"textarea":rt("invalid",n),E=y=l=null;for(O in a)if(a.hasOwnProperty(O)&&($=a[O],$!=null))switch(O){case"value":l=$;break;case"defaultValue":y=$;break;case"children":E=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(s(91));break;default:Lt(n,r,O,$,a,null)}ga(n,l,y,E);return;case"option":for(te in a)a.hasOwnProperty(te)&&(l=a[te],l!=null)&&(te==="selected"?n.selected=l&&typeof l!="function"&&typeof l!="symbol":Lt(n,r,te,l,a,null));return;case"dialog":rt("beforetoggle",n),rt("toggle",n),rt("cancel",n),rt("close",n);break;case"iframe":case"object":rt("load",n);break;case"video":case"audio":for(l=0;l<ll.length;l++)rt(ll[l],n);break;case"image":rt("error",n),rt("load",n);break;case"details":rt("toggle",n);break;case"embed":case"source":case"link":rt("error",n),rt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ce in a)if(a.hasOwnProperty(ce)&&(l=a[ce],l!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Lt(n,r,ce,l,a,null)}return;default:if(Kr(r)){for(ge in a)a.hasOwnProperty(ge)&&(l=a[ge],l!==void 0&&Mf(n,r,ge,l,a,void 0));return}}for($ in a)a.hasOwnProperty($)&&(l=a[$],l!=null&&Lt(n,r,$,l,a,null))}function v5(n,r,a,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,E=null,O=null,$=null,te=null,ce=null,ge=null;for(he in a){var ve=a[he];if(a.hasOwnProperty(he)&&ve!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":te=ve;default:l.hasOwnProperty(he)||Lt(n,r,he,null,l,ve)}}for(var ue in l){var he=l[ue];if(ve=a[ue],l.hasOwnProperty(ue)&&(he!=null||ve!=null))switch(ue){case"type":E=he;break;case"name":y=he;break;case"checked":ce=he;break;case"defaultChecked":ge=he;break;case"value":O=he;break;case"defaultValue":$=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(s(137,r));break;default:he!==ve&&Lt(n,r,ue,he,l,ve)}}To(n,O,$,te,ce,ge,E,y);return;case"select":he=O=$=ue=null;for(E in a)if(te=a[E],a.hasOwnProperty(E)&&te!=null)switch(E){case"value":break;case"multiple":he=te;default:l.hasOwnProperty(E)||Lt(n,r,E,null,l,te)}for(y in l)if(E=l[y],te=a[y],l.hasOwnProperty(y)&&(E!=null||te!=null))switch(y){case"value":ue=E;break;case"defaultValue":$=E;break;case"multiple":O=E;default:E!==te&&Lt(n,r,y,E,l,te)}r=$,a=O,l=he,ue!=null?Nn(n,!!a,ue,!1):!!l!=!!a&&(r!=null?Nn(n,!!a,r,!0):Nn(n,!!a,a?[]:"",!1));return;case"textarea":he=ue=null;for($ in a)if(y=a[$],a.hasOwnProperty($)&&y!=null&&!l.hasOwnProperty($))switch($){case"value":break;case"children":break;default:Lt(n,r,$,null,l,y)}for(O in l)if(y=l[O],E=a[O],l.hasOwnProperty(O)&&(y!=null||E!=null))switch(O){case"value":ue=y;break;case"defaultValue":he=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(s(91));break;default:y!==E&&Lt(n,r,O,y,l,E)}uc(n,ue,he);return;case"option":for(var Le in a)ue=a[Le],a.hasOwnProperty(Le)&&ue!=null&&!l.hasOwnProperty(Le)&&(Le==="selected"?n.selected=!1:Lt(n,r,Le,null,l,ue));for(te in l)ue=l[te],he=a[te],l.hasOwnProperty(te)&&ue!==he&&(ue!=null||he!=null)&&(te==="selected"?n.selected=ue&&typeof ue!="function"&&typeof ue!="symbol":Lt(n,r,te,ue,l,he));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 We in a)ue=a[We],a.hasOwnProperty(We)&&ue!=null&&!l.hasOwnProperty(We)&&Lt(n,r,We,null,l,ue);for(ce in l)if(ue=l[ce],he=a[ce],l.hasOwnProperty(ce)&&ue!==he&&(ue!=null||he!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,r));break;default:Lt(n,r,ce,ue,l,he)}return;default:if(Kr(r)){for(var Mt in a)ue=a[Mt],a.hasOwnProperty(Mt)&&ue!==void 0&&!l.hasOwnProperty(Mt)&&Mf(n,r,Mt,void 0,l,ue);for(ge in l)ue=l[ge],he=a[ge],!l.hasOwnProperty(ge)||ue===he||ue===void 0&&he===void 0||Mf(n,r,ge,ue,l,he);return}}for(var se in a)ue=a[se],a.hasOwnProperty(se)&&ue!=null&&!l.hasOwnProperty(se)&&Lt(n,r,se,null,l,ue);for(ve in l)ue=l[ve],he=a[ve],!l.hasOwnProperty(ve)||ue===he||ue==null&&he==null||Lt(n,r,ve,ue,l,he)}function c1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function b5(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var y=a[l],E=y.transferSize,O=y.initiatorType,$=y.duration;if(E&&$&&c1(O)){for(O=0,$=y.responseEnd,l+=1;l<a.length;l++){var te=a[l],ce=te.startTime;if(ce>$)break;var ge=te.transferSize,ve=te.initiatorType;ge&&c1(ve)&&(te=te.responseEnd,O+=ge*(te<$?1:($-ce)/(te-ce)))}if(--l,r+=8*(E+O)/(y.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Nf=null,Of=null;function ou(n){return n.nodeType===9?n:n.ownerDocument}function u1(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function h1(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function Df(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var jf=null;function y5(){var n=window.event;return n&&n.type==="popstate"?n===jf?!1:(jf=n,!0):(jf=null,!1)}var d1=typeof setTimeout=="function"?setTimeout:void 0,S5=typeof clearTimeout=="function"?clearTimeout:void 0,f1=typeof Promise=="function"?Promise:void 0,x5=typeof queueMicrotask=="function"?queueMicrotask:typeof f1<"u"?function(n){return f1.resolve(null).then(n).catch(w5)}:d1;function w5(n){setTimeout(function(){throw n})}function ds(n){return n==="head"}function p1(n,r){var a=r,l=0;do{var y=a.nextSibling;if(n.removeChild(a),y&&y.nodeType===8)if(a=y.data,a==="/$"||a==="/&"){if(l===0){n.removeChild(y),Wa(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")ul(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ul(a);for(var E=a.firstChild;E;){var O=E.nextSibling,$=E.nodeName;E[wn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=O}}else a==="body"&&ul(n.ownerDocument.body);a=y}while(a);Wa(r)}function g1(n,r){var a=n;n=0;do{var l=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=l}while(a)}function If(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":If(a),Re(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function C5(n,r,a,l){for(;n.nodeType===1;){var y=a;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!l&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(l){if(!n[wn])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(E=n.getAttribute("rel"),E==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(E!==y.rel||n.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||n.getAttribute("title")!==(y.title==null?null:y.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(E=n.getAttribute("src"),(E!==(y.src==null?null:y.src)||n.getAttribute("type")!==(y.type==null?null:y.type)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&E&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var E=y.name==null?null:""+y.name;if(y.type==="hidden"&&n.getAttribute("name")===E)return n}else return n;if(n=Hi(n.nextSibling),n===null)break}return null}function E5(n,r,a){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Hi(n.nextSibling),n===null))return null;return n}function m1(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Hi(n.nextSibling),n===null))return null;return n}function Bf(n){return n.data==="$?"||n.data==="$~"}function Pf(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function k5(n,r){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||a.readyState!=="loading")r();else{var l=function(){r(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),n._reactRetry=l}}function Hi(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var zf=null;function _1(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(r===0)return Hi(n.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}n=n.nextSibling}return null}function v1(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return n;r--}else a!=="/$"&&a!=="/&"||r++}n=n.previousSibling}return null}function b1(n,r,a){switch(r=ou(a),n){case"html":if(n=r.documentElement,!n)throw Error(s(452));return n;case"head":if(n=r.head,!n)throw Error(s(453));return n;case"body":if(n=r.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function ul(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);Re(n)}var $i=new Map,y1=new Set;function lu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var jr=V.d;V.d={f:T5,r:A5,D:R5,C:L5,L:M5,m:N5,X:D5,S:O5,M:j5};function T5(){var n=jr.f(),r=Qc();return n||r}function A5(n){var r=me(n);r!==null&&r.tag===5&&r.type==="form"?Bv(r):jr.r(n)}var $a=typeof document>"u"?null:document;function S1(n,r,a){var l=$a;if(l&&typeof r=="string"&&r){var y=ri(r);y='link[rel="'+n+'"][href="'+y+'"]',typeof a=="string"&&(y+='[crossorigin="'+a+'"]'),y1.has(y)||(y1.add(y),n={rel:n,crossOrigin:a,href:r},l.querySelector(y)===null&&(r=l.createElement("link"),In(r,"link",n),$e(r),l.head.appendChild(r)))}}function R5(n){jr.D(n),S1("dns-prefetch",n,null)}function L5(n,r){jr.C(n,r),S1("preconnect",n,r)}function M5(n,r,a){jr.L(n,r,a);var l=$a;if(l&&n&&r){var y='link[rel="preload"][as="'+ri(r)+'"]';r==="image"&&a&&a.imageSrcSet?(y+='[imagesrcset="'+ri(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(y+='[imagesizes="'+ri(a.imageSizes)+'"]')):y+='[href="'+ri(n)+'"]';var E=y;switch(r){case"style":E=Ua(n);break;case"script":E=Fa(n)}$i.has(E)||(n=g({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:n,as:r},a),$i.set(E,n),l.querySelector(y)!==null||r==="style"&&l.querySelector(hl(E))||r==="script"&&l.querySelector(dl(E))||(r=l.createElement("link"),In(r,"link",n),$e(r),l.head.appendChild(r)))}}function N5(n,r){jr.m(n,r);var a=$a;if(a&&n){var l=r&&typeof r.as=="string"?r.as:"script",y='link[rel="modulepreload"][as="'+ri(l)+'"][href="'+ri(n)+'"]',E=y;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Fa(n)}if(!$i.has(E)&&(n=g({rel:"modulepreload",href:n},r),$i.set(E,n),a.querySelector(y)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(dl(E)))return}l=a.createElement("link"),In(l,"link",n),$e(l),a.head.appendChild(l)}}}function O5(n,r,a){jr.S(n,r,a);var l=$a;if(l&&n){var y=Qe(l).hoistableStyles,E=Ua(n);r=r||"default";var O=y.get(E);if(!O){var $={loading:0,preload:null};if(O=l.querySelector(hl(E)))$.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":r},a),(a=$i.get(E))&&Hf(n,a);var te=O=l.createElement("link");$e(te),In(te,"link",n),te._p=new Promise(function(ce,ge){te.onload=ce,te.onerror=ge}),te.addEventListener("load",function(){$.loading|=1}),te.addEventListener("error",function(){$.loading|=2}),$.loading|=4,cu(O,r,l)}O={type:"stylesheet",instance:O,count:1,state:$},y.set(E,O)}}}function D5(n,r){jr.X(n,r);var a=$a;if(a&&n){var l=Qe(a).hoistableScripts,y=Fa(n),E=l.get(y);E||(E=a.querySelector(dl(y)),E||(n=g({src:n,async:!0},r),(r=$i.get(y))&&$f(n,r),E=a.createElement("script"),$e(E),In(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},l.set(y,E))}}function j5(n,r){jr.M(n,r);var a=$a;if(a&&n){var l=Qe(a).hoistableScripts,y=Fa(n),E=l.get(y);E||(E=a.querySelector(dl(y)),E||(n=g({src:n,async:!0,type:"module"},r),(r=$i.get(y))&&$f(n,r),E=a.createElement("script"),$e(E),In(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},l.set(y,E))}}function x1(n,r,a,l){var y=(y=ie.current)?lu(y):null;if(!y)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Ua(a.href),a=Qe(y).hoistableStyles,l=a.get(r),l||(l={type:"style",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=Ua(a.href);var E=Qe(y).hoistableStyles,O=E.get(n);if(O||(y=y.ownerDocument||y,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(n,O),(E=y.querySelector(hl(n)))&&!E._p&&(O.instance=E,O.state.loading=5),$i.has(n)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},$i.set(n,a),E||I5(y,n,a,O.state))),r&&l===null)throw Error(s(528,""));return O}if(r&&l!==null)throw Error(s(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Fa(a),a=Qe(y).hoistableScripts,l=a.get(r),l||(l={type:"script",instance:null,count:0,state:null},a.set(r,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Ua(n){return'href="'+ri(n)+'"'}function hl(n){return'link[rel="stylesheet"]['+n+"]"}function w1(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function I5(n,r,a,l){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?l.loading=1:(r=n.createElement("link"),l.preload=r,r.addEventListener("load",function(){return l.loading|=1}),r.addEventListener("error",function(){return l.loading|=2}),In(r,"link",a),$e(r),n.head.appendChild(r))}function Fa(n){return'[src="'+ri(n)+'"]'}function dl(n){return"script[async]"+n}function C1(n,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=n.querySelector('style[data-href~="'+ri(a.href)+'"]');if(l)return r.instance=l,$e(l),l;var y=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(n.ownerDocument||n).createElement("style"),$e(l),In(l,"style",y),cu(l,a.precedence,n),r.instance=l;case"stylesheet":y=Ua(a.href);var E=n.querySelector(hl(y));if(E)return r.state.loading|=4,r.instance=E,$e(E),E;l=w1(a),(y=$i.get(y))&&Hf(l,y),E=(n.ownerDocument||n).createElement("link"),$e(E);var O=E;return O._p=new Promise(function($,te){O.onload=$,O.onerror=te}),In(E,"link",l),r.state.loading|=4,cu(E,a.precedence,n),r.instance=E;case"script":return E=Fa(a.src),(y=n.querySelector(dl(E)))?(r.instance=y,$e(y),y):(l=a,(y=$i.get(E))&&(l=g({},a),$f(l,y)),n=n.ownerDocument||n,y=n.createElement("script"),$e(y),In(y,"link",l),n.head.appendChild(y),r.instance=y);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(l=r.instance,r.state.loading|=4,cu(l,a.precedence,n));return r.instance}function cu(n,r,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=l.length?l[l.length-1]:null,E=y,O=0;O<l.length;O++){var $=l[O];if($.dataset.precedence===r)E=$;else if(E!==y)break}E?E.parentNode.insertBefore(n,E.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(n,r.firstChild))}function Hf(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function $f(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var uu=null;function E1(n,r,a){if(uu===null){var l=new Map,y=uu=new Map;y.set(a,l)}else y=uu,l=y.get(a),l||(l=new Map,y.set(a,l));if(l.has(n))return l;for(l.set(n,null),a=a.getElementsByTagName(n),y=0;y<a.length;y++){var E=a[y];if(!(E[wn]||E[de]||n==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var O=E.getAttribute(r)||"";O=n+O;var $=l.get(O);$?$.push(E):l.set(O,[E])}}return l}function k1(n,r,a){n=n.ownerDocument||n,n.head.insertBefore(a,r==="title"?n.querySelector("head > title"):null)}function B5(n,r,a){if(a===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function T1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function P5(n,r,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var y=Ua(l.href),E=r.querySelector(hl(y));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=hu.bind(n),r.then(n,n)),a.state.loading|=4,a.instance=E,$e(E);return}E=r.ownerDocument||r,l=w1(l),(y=$i.get(y))&&Hf(l,y),E=E.createElement("link"),$e(E);var O=E;O._p=new Promise(function($,te){O.onload=$,O.onerror=te}),In(E,"link",l),a.instance=E}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(n.count++,a=hu.bind(n),r.addEventListener("load",a),r.addEventListener("error",a))}}var Uf=0;function z5(n,r){return n.stylesheets&&n.count===0&&fu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var l=setTimeout(function(){if(n.stylesheets&&fu(n,n.stylesheets),n.unsuspend){var E=n.unsuspend;n.unsuspend=null,E()}},6e4+r);0<n.imgBytes&&Uf===0&&(Uf=62500*b5());var y=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&fu(n,n.stylesheets),n.unsuspend)){var E=n.unsuspend;n.unsuspend=null,E()}},(n.imgBytes>Uf?50:800)+r);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(l),clearTimeout(y)}}:null}function hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var du=null;function fu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,du=new Map,r.forEach(H5,n),du=null,hu.call(n))}function H5(n,r){if(!(r.state.loading&4)){var a=du.get(n);if(a)var l=a.get(null);else{a=new Map,du.set(n,a);for(var y=n.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<y.length;E++){var O=y[E];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(a.set(O.dataset.precedence,O),l=O)}l&&a.set(null,l)}y=r.instance,O=y.getAttribute("data-precedence"),E=a.get(O)||l,E===l&&a.set(null,y),a.set(O,y),this.count++,l=hu.bind(this),y.addEventListener("load",l),y.addEventListener("error",l),E?E.parentNode.insertBefore(y,E.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(y,n.firstChild)),r.state.loading|=4}}var fl={$$typeof:x,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function $5(n,r,a,l,y,E,O,$,te){this.tag=1,this.containerInfo=n,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=xt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xt(0),this.hiddenUpdates=xt(null),this.identifierPrefix=l,this.onUncaughtError=y,this.onCaughtError=E,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=te,this.incompleteTransitions=new Map}function A1(n,r,a,l,y,E,O,$,te,ce,ge,ve){return n=new $5(n,r,a,O,te,ce,ge,ve,$),r=1,E===!0&&(r|=24),E=yi(3,null,null,r),n.current=E,E.stateNode=n,r=yd(),r.refCount++,n.pooledCache=r,r.refCount++,E.memoizedState={element:l,isDehydrated:a,cache:r},Cd(E),n}function R1(n){return n?(n=ya,n):ya}function L1(n,r,a,l,y,E){y=R1(y),l.context===null?l.context=y:l.pendingContext=y,l=ts(r),l.payload={element:a},E=E===void 0?null:E,E!==null&&(l.callback=E),a=ns(n,l,r),a!==null&&(ui(a,n,r),Go(a,n,r))}function M1(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<r?a:r}}function Ff(n,r){M1(n,r),(n=n.alternate)&&M1(n,r)}function N1(n){if(n.tag===13||n.tag===31){var r=js(n,67108864);r!==null&&ui(r,n,67108864),Ff(n,67108864)}}function O1(n){if(n.tag===13||n.tag===31){var r=Ei();r=et(r);var a=js(n,r);a!==null&&ui(a,n,r),Ff(n,r)}}var pu=!0;function U5(n,r,a,l){var y=z.T;z.T=null;var E=V.p;try{V.p=2,Wf(n,r,a,l)}finally{V.p=E,z.T=y}}function F5(n,r,a,l){var y=z.T;z.T=null;var E=V.p;try{V.p=8,Wf(n,r,a,l)}finally{V.p=E,z.T=y}}function Wf(n,r,a,l){if(pu){var y=Gf(l);if(y===null)Lf(n,r,l,gu,a),j1(n,l);else if(G5(y,n,r,a,l))l.stopPropagation();else if(j1(n,l),r&4&&-1<W5.indexOf(n)){for(;y!==null;){var E=me(y);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var O=rn(E.pendingLanes);if(O!==0){var $=E;for($.pendingLanes|=2,$.entangledLanes|=2;O;){var te=1<<31-Et(O);$.entanglements[1]|=te,O&=~te}ur(E),(St&6)===0&&(Zc=ht()+500,ol(0))}}break;case 31:case 13:$=js(E,2),$!==null&&ui($,E,2),Qc(),Ff(E,2)}if(E=Gf(l),E===null&&Lf(n,r,l,gu,a),E===y)break;y=E}y!==null&&l.stopPropagation()}else Lf(n,r,l,null,a)}}function Gf(n){return n=Ve(n),qf(n)}var gu=null;function qf(n){if(gu=null,n=J(n),n!==null){var r=f(n);if(r===null)n=null;else{var a=r.tag;if(a===13){if(n=p(r),n!==null)return n;n=null}else if(a===31){if(n=c(r),n!==null)return n;n=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return gu=n,null}function D1(n){switch(n){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(Jt()){case zt:return 2;case Kt:return 8;case nn:case ni:return 32;case xn:return 268435456;default:return 32}default:return 32}}var Kf=!1,fs=null,ps=null,gs=null,pl=new Map,gl=new Map,ms=[],W5="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 j1(n,r){switch(n){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":ps=null;break;case"mouseover":case"mouseout":gs=null;break;case"pointerover":case"pointerout":pl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":gl.delete(r.pointerId)}}function ml(n,r,a,l,y,E){return n===null||n.nativeEvent!==E?(n={blockedOn:r,domEventName:a,eventSystemFlags:l,nativeEvent:E,targetContainers:[y]},r!==null&&(r=me(r),r!==null&&N1(r)),n):(n.eventSystemFlags|=l,r=n.targetContainers,y!==null&&r.indexOf(y)===-1&&r.push(y),n)}function G5(n,r,a,l,y){switch(r){case"focusin":return fs=ml(fs,n,r,a,l,y),!0;case"dragenter":return ps=ml(ps,n,r,a,l,y),!0;case"mouseover":return gs=ml(gs,n,r,a,l,y),!0;case"pointerover":var E=y.pointerId;return pl.set(E,ml(pl.get(E)||null,n,r,a,l,y)),!0;case"gotpointercapture":return E=y.pointerId,gl.set(E,ml(gl.get(E)||null,n,r,a,l,y)),!0}return!1}function I1(n){var r=J(n.target);if(r!==null){var a=f(r);if(a!==null){if(r=a.tag,r===13){if(r=p(a),r!==null){n.blockedOn=r,Ni(n.priority,function(){O1(a)});return}}else if(r===31){if(r=c(a),r!==null){n.blockedOn=r,Ni(n.priority,function(){O1(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function mu(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var a=Gf(n.nativeEvent);if(a===null){a=n.nativeEvent;var l=new a.constructor(a.type,a);Ne=l,a.target.dispatchEvent(l),Ne=null}else return r=me(a),r!==null&&N1(r),n.blockedOn=a,!1;r.shift()}return!0}function B1(n,r,a){mu(n)&&a.delete(r)}function q5(){Kf=!1,fs!==null&&mu(fs)&&(fs=null),ps!==null&&mu(ps)&&(ps=null),gs!==null&&mu(gs)&&(gs=null),pl.forEach(B1),gl.forEach(B1)}function _u(n,r){n.blockedOn===r&&(n.blockedOn=null,Kf||(Kf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,q5)))}var vu=null;function P1(n){vu!==n&&(vu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){vu===n&&(vu=null);for(var r=0;r<n.length;r+=3){var a=n[r],l=n[r+1],y=n[r+2];if(typeof l!="function"){if(qf(l||a)===null)continue;break}var E=me(a);E!==null&&(n.splice(r,3),r-=3,Wd(E,{pending:!0,data:y,method:a.method,action:l},l,y))}}))}function Wa(n){function r(te){return _u(te,n)}fs!==null&&_u(fs,n),ps!==null&&_u(ps,n),gs!==null&&_u(gs,n),pl.forEach(r),gl.forEach(r);for(var a=0;a<ms.length;a++){var l=ms[a];l.blockedOn===n&&(l.blockedOn=null)}for(;0<ms.length&&(a=ms[0],a.blockedOn===null);)I1(a),a.blockedOn===null&&ms.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var y=a[l],E=a[l+1],O=y[je]||null;if(typeof E=="function")O||P1(a);else if(O){var $=null;if(E&&E.hasAttribute("formAction")){if(y=E,O=E[je]||null)$=O.formAction;else if(qf(y)!==null)continue}else $=O.action;typeof $=="function"?a[l+1]=$:(a.splice(l,3),l-=3),P1(a)}}}function z1(){function n(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(O){return y=O})},focusReset:"manual",scroll:"manual"})}function r(){y!==null&&(y(),y=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,y=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),y!==null&&(y(),y=null)}}}function Vf(n){this._internalRoot=n}bu.prototype.render=Vf.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));var a=r.current,l=Ei();L1(a,l,n,r,null,null)},bu.prototype.unmount=Vf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;L1(n.current,2,null,n,null,null),Qc(),r[vt]=null}};function bu(n){this._internalRoot=n}bu.prototype.unstable_scheduleHydration=function(n){if(n){var r=Mi();n={blockedOn:null,target:n,priority:r};for(var a=0;a<ms.length&&r!==0&&r<ms[a].priority;a++);ms.splice(a,0,n),a===0&&I1(n)}};var H1=t.version;if(H1!=="19.2.7")throw Error(s(527,H1,"19.2.7"));V.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=d(r),n=n!==null?_(n):null,n=n===null?null:n.stateNode,n};var K5={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{hn=yu.inject(K5),Ht=yu}catch{}}return vl.createRoot=function(n,r){if(!o(n))throw Error(s(299));var a=!1,l="",y=Kv,E=Vv,O=Yv;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(l=r.identifierPrefix),r.onUncaughtError!==void 0&&(y=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(O=r.onRecoverableError)),r=A1(n,1,!1,null,null,a,l,null,y,E,O,z1),n[vt]=r.current,Rf(n),new Vf(r)},vl.hydrateRoot=function(n,r,a){if(!o(n))throw Error(s(299));var l=!1,y="",E=Kv,O=Vv,$=Yv,te=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(y=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(O=a.onCaughtError),a.onRecoverableError!==void 0&&($=a.onRecoverableError),a.formState!==void 0&&(te=a.formState)),r=A1(n,1,!0,r,a??null,l,y,te,E,O,$,z1),r.context=R1(null),a=r.current,l=Ei(),l=et(l),y=ts(l),y.callback=null,ns(a,y,l),a=l,r.current.lanes=a,ft(r,a),ur(r),n[vt]=r.current,Rf(n),new bu(r)},vl.version="19.2.7",vl}var Z1;function Dk(){if(Z1)return Jf.exports;Z1=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(),Jf.exports=Ok(),Jf.exports}var jk=Dk();var J1="popstate";function Q1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Ik(e={}){function t(s,o){let f=o.state?.masked,{pathname:p,search:c,hash:h}=f||s.location;return rg("",{pathname:p,search:c,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",f?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function i(s,o){return typeof o=="string"?o:ql(o)}return Pk(t,i,null,e)}function Xt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function rr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Bk(){return Math.random().toString(36).substring(2,10)}function eb(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 rg(e,t,i=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?So(t):t,state:i,key:t&&t.key||s||Bk(),mask:o}}function ql({pathname:e="/",search:t="",hash:i=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function So(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substring(i),e=e.substring(0,i));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function Pk(e,t,i,s={}){let{window:o=document.defaultView,v5Compat:f=!1}=s,p=o.history,c="POP",h=null,d=_();d==null&&(d=0,p.replaceState({...p.state,idx:d},""));function _(){return(p.state||{idx:null}).idx}function g(){c="POP";let m=_(),b=m==null?null:m-d;d=m,h&&h({action:c,location:w.location,delta:b})}function S(m,b){c="PUSH";let v=Q1(m)?m:rg(w.location,m,b);d=_()+1;let x=eb(v,d),k=w.createHref(v.mask||v);try{p.pushState(x,"",k)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;o.location.assign(k)}f&&h&&h({action:c,location:w.location,delta:1})}function C(m,b){c="REPLACE";let v=Q1(m)?m:rg(w.location,m,b);d=_();let x=eb(v,d),k=w.createHref(v.mask||v);p.replaceState(x,"",k),f&&h&&h({action:c,location:w.location,delta:0})}function T(m){return zk(o,m)}let w={get action(){return c},get location(){return e(o,p)},listen(m){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(J1,g),h=m,()=>{o.removeEventListener(J1,g),h=null}},createHref(m){return t(o,m)},createURL:T,encodeLocation(m){let b=T(m);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:S,replace:C,go(m){return p.go(m)}};return w}function zk(e,t,i=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Xt(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:ql(t);return o=o.replace(/ $/,"%20"),!i&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function nx(e,t,i="/"){return Hk(e,t,i,!1)}function Hk(e,t,i,s,o){let f=typeof t=="string"?So(t):t,p=Wr(f.pathname||"/",i);if(p==null)return null;let c=$k(e),h=null,d=Qk(p);for(let _=0;h==null&&_<c.length;++_)h=Zk(c[_],d,s);return h}function $k(e){let t=ix(e);return Uk(t),t}function ix(e,t=[],i=[],s="",o=!1){let f=(p,c,h=o,d)=>{let _={relativePath:d===void 0?p.path||"":d,caseSensitive:p.caseSensitive===!0,childrenIndex:c,route:p};if(_.relativePath.startsWith("/")){if(!_.relativePath.startsWith(s)&&h)return;Xt(_.relativePath.startsWith(s),`Absolute route path "${_.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),_.relativePath=_.relativePath.slice(s.length)}let g=ir([s,_.relativePath]),S=i.concat(_);p.children&&p.children.length>0&&(Xt(p.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),ix(p.children,t,S,g,h)),!(p.path==null&&!p.index)&&t.push({path:g,score:Yk(g,p.index),routesMeta:S})};return e.forEach((p,c)=>{if(p.path===""||!p.path?.includes("?"))f(p,c);else for(let h of rx(p.path))f(p,c,!0,h)}),t}function rx(e){let t=e.split("/");if(t.length===0)return[];let[i,...s]=t,o=i.endsWith("?"),f=i.replace(/\?$/,"");if(s.length===0)return o?[f,""]:[f];let p=rx(s.join("/")),c=[];return c.push(...p.map(h=>h===""?f:[f,h].join("/"))),o&&c.push(...p),c.map(h=>e.startsWith("/")&&h===""?"/":h)}function Uk(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:Xk(t.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var Fk=/^:[\w-]+$/,Wk=3,Gk=2,qk=1,Kk=10,Vk=-2,tb=e=>e==="*";function Yk(e,t){let i=e.split("/"),s=i.length;return i.some(tb)&&(s+=Vk),t&&(s+=Gk),i.filter(o=>!tb(o)).reduce((o,f)=>o+(Fk.test(f)?Wk:f===""?qk:Kk),s)}function Xk(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function Zk(e,t,i=!1){let{routesMeta:s}=e,o={},f="/",p=[];for(let c=0;c<s.length;++c){let h=s[c],d=c===s.length-1,_=f==="/"?t:t.slice(f.length)||"/",g=lh({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},_),S=h.route;if(!g&&d&&i&&!s[s.length-1].route.index&&(g=lh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},_)),!g)return null;Object.assign(o,g.params),p.push({params:o,pathname:ir([f,g.pathname]),pathnameBase:iT(ir([f,g.pathnameBase])),route:S}),g.pathnameBase!=="/"&&(f=ir([f,g.pathnameBase]))}return p}function lh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=Jk(e.path,e.caseSensitive,e.end),o=t.match(i);if(!o)return null;let f=o[0],p=f.replace(/(.)\/+$/,"$1"),c=o.slice(1);return{params:s.reduce((d,{paramName:_,isOptional:g},S)=>{if(_==="*"){let T=c[S]||"";p=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const C=c[S];return g&&!C?d[_]=void 0:d[_]=(C||"").replace(/%2F/g,"/"),d},{}),pathname:f,pathnameBase:p,pattern:e}}function Jk(e,t=!1,i=!0){rr(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 s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(p,c,h,d,_)=>{if(s.push({paramName:c,isOptional:h!=null}),h){let g=_.charAt(d+p.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function Qk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return rr(!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 Wr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,s=e.charAt(i);return s&&s!=="/"?null:e.slice(i)||"/"}var eT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function tT(e,t="/"){let{pathname:i,search:s="",hash:o=""}=typeof e=="string"?So(e):e,f;return i?(i=sx(i),i.startsWith("/")?f=nb(i.substring(1),"/"):f=nb(i,t)):f=t,{pathname:f,search:rT(s),hash:sT(o)}}function nb(e,t){let i=ch(t).split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function np(e,t,i,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function nT(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function mm(e){let t=nT(e);return t.map((i,s)=>s===t.length-1?i.pathname:i.pathnameBase)}function Oh(e,t,i,s=!1){let o;typeof e=="string"?o=So(e):(o={...e},Xt(!o.pathname||!o.pathname.includes("?"),np("?","pathname","search",o)),Xt(!o.pathname||!o.pathname.includes("#"),np("#","pathname","hash",o)),Xt(!o.search||!o.search.includes("#"),np("#","search","hash",o)));let f=e===""||o.pathname==="",p=f?"/":o.pathname,c;if(p==null)c=i;else{let g=t.length-1;if(!s&&p.startsWith("..")){let S=p.split("/");for(;S[0]==="..";)S.shift(),g-=1;o.pathname=S.join("/")}c=g>=0?t[g]:"/"}let h=tT(o,c),d=p&&p!=="/"&&p.endsWith("/"),_=(f||p===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||_)&&(h.pathname+="/"),h}var sx=e=>e.replace(/\/\/+/g,"/"),ir=e=>sx(e.join("/")),ch=e=>e.replace(/\/+$/,""),iT=e=>ch(e).replace(/^\/*/,"/"),rT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,aT=class{constructor(e,t,i,s=!1){this.status=e,this.statusText=t||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function oT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function lT(e){let t=e.map(i=>i.route.path).filter(Boolean);return ir(t)||"/"}var ax=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ox(e,t){let i=e;if(typeof i!="string"||!eT.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,o=!1;if(ax)try{let f=new URL(window.location.href),p=i.startsWith("//")?new URL(f.protocol+i):new URL(i),c=Wr(p.pathname,t);p.origin===f.origin&&c!=null?i=c+p.search+p.hash:o=!0}catch{rr(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lx=["POST","PUT","PATCH","DELETE"];new Set(lx);var cT=["GET",...lx];new Set(cT);var xo=M.createContext(null);xo.displayName="DataRouter";var Dh=M.createContext(null);Dh.displayName="DataRouterState";var cx=M.createContext(!1);function uT(){return M.useContext(cx)}var ux=M.createContext({isTransitioning:!1});ux.displayName="ViewTransition";var hT=M.createContext(new Map);hT.displayName="Fetchers";var dT=M.createContext(null);dT.displayName="Await";var Li=M.createContext(null);Li.displayName="Navigation";var sc=M.createContext(null);sc.displayName="Location";var _r=M.createContext({outlet:null,matches:[],isDataRoute:!1});_r.displayName="Route";var _m=M.createContext(null);_m.displayName="RouteError";var hx="REACT_ROUTER_ERROR",fT="REDIRECT",pT="ROUTE_ERROR_RESPONSE";function gT(e){if(e.startsWith(`${hx}:${fT}:{`))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 mT(e){if(e.startsWith(`${hx}:${pT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new aT(t.status,t.statusText,t.data)}catch{}}function _T(e,{relative:t}={}){Xt(wo(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=M.useContext(Li),{hash:o,pathname:f,search:p}=ac(e,{relative:t}),c=f;return i!=="/"&&(c=f==="/"?i:ir([i,f])),s.createHref({pathname:c,search:p,hash:o})}function wo(){return M.useContext(sc)!=null}function Vi(){return Xt(wo(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(sc).location}var dx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function fx(e){M.useContext(Li).static||M.useLayoutEffect(e)}function jh(){let{isDataRoute:e}=M.useContext(_r);return e?LT():vT()}function vT(){Xt(wo(),"useNavigate() may be used only in the context of a <Router> component.");let e=M.useContext(xo),{basename:t,navigator:i}=M.useContext(Li),{matches:s}=M.useContext(_r),{pathname:o}=Vi(),f=JSON.stringify(mm(s)),p=M.useRef(!1);return fx(()=>{p.current=!0}),M.useCallback((h,d={})=>{if(rr(p.current,dx),!p.current)return;if(typeof h=="number"){i.go(h);return}let _=Oh(h,JSON.parse(f),o,d.relative==="path");e==null&&t!=="/"&&(_.pathname=_.pathname==="/"?t:ir([t,_.pathname])),(d.replace?i.replace:i.push)(_,d.state,d)},[t,i,f,o,e])}M.createContext(null);function ac(e,{relative:t}={}){let{matches:i}=M.useContext(_r),{pathname:s}=Vi(),o=JSON.stringify(mm(i));return M.useMemo(()=>Oh(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function bT(e,t){return px(e,t)}function px(e,t,i){Xt(wo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=M.useContext(Li),{matches:o}=M.useContext(_r),f=o[o.length-1],p=f?f.params:{},c=f?f.pathname:"/",h=f?f.pathnameBase:"/",d=f&&f.route;{let m=d&&d.path||"";mx(c,!d||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${m}">) 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="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let _=Vi(),g;if(t){let m=typeof t=="string"?So(t):t;Xt(h==="/"||m.pathname?.startsWith(h),`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 "${h}" but pathname "${m.pathname}" was given in the \`location\` prop.`),g=m}else g=_;let S=g.pathname||"/",C=S;if(h!=="/"){let m=h.replace(/^\//,"").split("/");C="/"+S.replace(/^\//,"").split("/").slice(m.length).join("/")}let T=i&&i.state.matches.length?i.state.matches.map(m=>Object.assign(m,{route:i.manifest[m.route.id]||m.route})):nx(e,{pathname:C});rr(d||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),rr(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=CT(T&&T.map(m=>Object.assign({},m,{params:Object.assign({},p,m.params),pathname:ir([h,s.encodeLocation?s.encodeLocation(m.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?h:ir([h,s.encodeLocation?s.encodeLocation(m.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),o,i);return t&&w?M.createElement(sc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},w):w}function yT(){let e=RT(),t=oT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},f={padding:"2px 4px",backgroundColor:s},p=null;return console.error("Error handled by React Router default ErrorBoundary:",e),p=M.createElement(M.Fragment,null,M.createElement("p",null,"💿 Hey developer 👋"),M.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",M.createElement("code",{style:f},"ErrorBoundary")," or"," ",M.createElement("code",{style:f},"errorElement")," prop on your route.")),M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},t),i?M.createElement("pre",{style:o},i):null,p)}var ST=M.createElement(yT,null),gx=class extends M.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 i=mT(e.digest);i&&(e=i)}let t=e!==void 0?M.createElement(_r.Provider,{value:this.props.routeContext},M.createElement(_m.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?M.createElement(xT,{error:e},t):t}};gx.contextType=cx;var ip=new WeakMap;function xT({children:e,error:t}){let{basename:i}=M.useContext(Li);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=gT(t.digest);if(s){let o=ip.get(t);if(o)throw o;let f=ox(s.location,i);if(ax&&!ip.get(t))if(f.isExternal||s.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:s.replace}));throw ip.set(t,p),p}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return e}function wT({routeContext:e,match:t,children:i}){let s=M.useContext(xo);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(_r.Provider,{value:e},i)}function CT(e,t=[],i){let s=i?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,f=s?.errors;if(f!=null){let _=o.findIndex(g=>g.route.id&&f?.[g.route.id]!==void 0);Xt(_>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),o=o.slice(0,Math.min(o.length,_+1))}let p=!1,c=-1;if(i&&s){p=s.renderFallback;for(let _=0;_<o.length;_++){let g=o[_];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=_),g.route.id){let{loaderData:S,errors:C}=s,T=g.route.loader&&!S.hasOwnProperty(g.route.id)&&(!C||C[g.route.id]===void 0);if(g.route.lazy||T){i.isStatic&&(p=!0),c>=0?o=o.slice(0,c+1):o=[o[0]];break}}}}let h=i?.onError,d=s&&h?(_,g)=>{h(_,{location:s.location,params:s.matches?.[0]?.params??{},pattern:lT(s.matches),errorInfo:g})}:void 0;return o.reduceRight((_,g,S)=>{let C,T=!1,w=null,m=null;s&&(C=f&&g.route.id?f[g.route.id]:void 0,w=g.route.errorElement||ST,p&&(c<0&&S===0?(mx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,m=null):c===S&&(T=!0,m=g.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,S+1)),v=()=>{let x;return C?x=w:T?x=m:g.route.Component?x=M.createElement(g.route.Component,null):g.route.element?x=g.route.element:x=_,M.createElement(wT,{match:g,routeContext:{outlet:_,matches:b,isDataRoute:s!=null},children:x})};return s&&(g.route.ErrorBoundary||g.route.errorElement||S===0)?M.createElement(gx,{location:s.location,revalidation:s.revalidation,component:w,error:C,children:v(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:d}):v()},null)}function vm(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=M.useContext(xo);return Xt(t,vm(e)),t}function kT(e){let t=M.useContext(Dh);return Xt(t,vm(e)),t}function TT(e){let t=M.useContext(_r);return Xt(t,vm(e)),t}function bm(e){let t=TT(e),i=t.matches[t.matches.length-1];return Xt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function AT(){return bm("useRouteId")}function RT(){let e=M.useContext(_m),t=kT("useRouteError"),i=bm("useRouteError");return e!==void 0?e:t.errors?.[i]}function LT(){let{router:e}=ET("useNavigate"),t=bm("useNavigate"),i=M.useRef(!1);return fx(()=>{i.current=!0}),M.useCallback(async(o,f={})=>{rr(i.current,dx),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...f}))},[e,t])}var ib={};function mx(e,t,i){!t&&!ib[e]&&(ib[e]=!0,rr(!1,i))}M.memo(MT);function MT({routes:e,manifest:t,future:i,state:s,isStatic:o,onError:f}){return px(e,void 0,{manifest:t,state:s,isStatic:o,onError:f})}function rb({to:e,replace:t,state:i,relative:s}){Xt(wo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=M.useContext(Li);rr(!o,"<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:f}=M.useContext(_r),{pathname:p}=Vi(),c=jh(),h=Oh(e,mm(f),p,s==="path"),d=JSON.stringify(h);return M.useEffect(()=>{c(JSON.parse(d),{replace:t,state:i,relative:s})},[c,d,s,t,i]),null}function Za(e){Xt(!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 NT({basename:e="/",children:t=null,location:i,navigationType:s="POP",navigator:o,static:f=!1,useTransitions:p}){Xt(!wo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),h=M.useMemo(()=>({basename:c,navigator:o,static:f,useTransitions:p,future:{}}),[c,o,f,p]);typeof i=="string"&&(i=So(i));let{pathname:d="/",search:_="",hash:g="",state:S=null,key:C="default",mask:T}=i,w=M.useMemo(()=>{let m=Wr(d,c);return m==null?null:{location:{pathname:m,search:_,hash:g,state:S,key:C,mask:T},navigationType:s}},[c,d,_,g,S,C,s,T]);return rr(w!=null,`<Router basename="${c}"> is not able to match the URL "${d}${_}${g}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:M.createElement(Li.Provider,{value:h},M.createElement(sc.Provider,{children:t,value:w}))}function OT({children:e,location:t}){return bT(sg(e),t)}function sg(e,t=[]){let i=[];return M.Children.forEach(e,(s,o)=>{if(!M.isValidElement(s))return;let f=[...t,o];if(s.type===M.Fragment){i.push.apply(i,sg(s.props.children,f));return}Xt(s.type===Za,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Xt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let p={id:s.props.id||f.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(p.children=sg(s.props.children,f)),i.push(p)}),i}var Wu="get",Gu="application/x-www-form-urlencoded";function Ih(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function DT(e){return Ih(e)&&e.tagName.toLowerCase()==="button"}function jT(e){return Ih(e)&&e.tagName.toLowerCase()==="form"}function IT(e){return Ih(e)&&e.tagName.toLowerCase()==="input"}function BT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function PT(e,t){return e.button===0&&(!t||t==="_self")&&!BT(e)}var Su=null;function zT(){if(Su===null)try{new FormData(document.createElement("form"),0),Su=!1}catch{Su=!0}return Su}var HT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rp(e){return e!=null&&!HT.has(e)?(rr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Gu}"`),null):e}function $T(e,t){let i,s,o,f,p;if(jT(e)){let c=e.getAttribute("action");s=c?Wr(c,t):null,i=e.getAttribute("method")||Wu,o=rp(e.getAttribute("enctype"))||Gu,f=new FormData(e)}else if(DT(e)||IT(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||c.getAttribute("action");if(s=h?Wr(h,t):null,i=e.getAttribute("formmethod")||c.getAttribute("method")||Wu,o=rp(e.getAttribute("formenctype"))||rp(c.getAttribute("enctype"))||Gu,f=new FormData(c,e),!zT()){let{name:d,type:_,value:g}=e;if(_==="image"){let S=d?`${d}.`:"";f.append(`${S}x`,"0"),f.append(`${S}y`,"0")}else d&&f.append(d,g)}}else{if(Ih(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Wu,s=null,o=Gu,p=e}return f&&o==="text/plain"&&(p=f,f=void 0),{action:s,method:i.toLowerCase(),encType:o,formData:f,body:p}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ym(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _x(e,t,i,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&Wr(o.pathname,t)==="/"?o.pathname=`${ch(t)}/_root.${s}`:o.pathname=`${ch(o.pathname)}.${s}`,o}async function UT(e,t){if(e.id in t)return t[e.id];try{let i=await import(e.module);return t[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function FT(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 WT(e,t,i){let s=await Promise.all(e.map(async o=>{let f=t.routes[o.route.id];if(f){let p=await UT(f,i);return p.links?p.links():[]}return[]}));return VT(s.flat(1).filter(FT).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function sb(e,t,i,s,o,f){let p=(h,d)=>i[d]?h.route.id!==i[d].route.id:!0,c=(h,d)=>i[d].pathname!==h.pathname||i[d].route.path?.endsWith("*")&&i[d].params["*"]!==h.params["*"];return f==="assets"?t.filter((h,d)=>p(h,d)||c(h,d)):f==="data"?t.filter((h,d)=>{let _=s.routes[h.route.id];if(!_||!_.hasLoader)return!1;if(p(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let g=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function GT(e,t,{includeHydrateFallback:i}={}){return qT(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let f=[o.module];return o.clientActionModule&&(f=f.concat(o.clientActionModule)),o.clientLoaderModule&&(f=f.concat(o.clientLoaderModule)),i&&o.hydrateFallbackModule&&(f=f.concat(o.hydrateFallbackModule)),o.imports&&(f=f.concat(o.imports)),f}).flat(1))}function qT(e){return[...new Set(e)]}function KT(e){let t={},i=Object.keys(e).sort();for(let s of i)t[s]=e[s];return t}function VT(e,t){let i=new Set;return new Set(t),e.reduce((s,o)=>{let f=JSON.stringify(KT(o));return i.has(f)||(i.add(f),s.push({key:f,link:o})),s},[])}function Sm(){let e=M.useContext(xo);return ym(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function YT(){let e=M.useContext(Dh);return ym(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var xm=M.createContext(void 0);xm.displayName="FrameworkContext";function wm(){let e=M.useContext(xm);return ym(e,"You must render this element inside a <HydratedRouter> element"),e}function XT(e,t){let i=M.useContext(xm),[s,o]=M.useState(!1),[f,p]=M.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:_,onTouchStart:g}=t,S=M.useRef(null);M.useEffect(()=>{if(e==="render"&&p(!0),e==="viewport"){let w=b=>{b.forEach(v=>{p(v.isIntersecting)})},m=new IntersectionObserver(w,{threshold:.5});return S.current&&m.observe(S.current),()=>{m.disconnect()}}},[e]),M.useEffect(()=>{if(s){let w=setTimeout(()=>{p(!0)},100);return()=>{clearTimeout(w)}}},[s]);let C=()=>{o(!0)},T=()=>{o(!1),p(!1)};return i?e!=="intent"?[f,S,{}]:[f,S,{onFocus:bl(c,C),onBlur:bl(h,T),onMouseEnter:bl(d,C),onMouseLeave:bl(_,T),onTouchStart:bl(g,C)}]:[!1,S,{}]}function bl(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function ZT({page:e,...t}){let i=uT(),{router:s}=Sm(),o=M.useMemo(()=>nx(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?i?M.createElement(QT,{page:e,matches:o,...t}):M.createElement(eA,{page:e,matches:o,...t}):null}function JT(e){let{manifest:t,routeModules:i}=wm(),[s,o]=M.useState([]);return M.useEffect(()=>{let f=!1;return WT(e,t,i).then(p=>{f||o(p)}),()=>{f=!0}},[e,t,i]),s}function QT({page:e,matches:t,...i}){let s=Vi(),{future:o}=wm(),{basename:f}=Sm(),p=M.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=_x(e,f,o.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,d=[];for(let _ of t)typeof _.route.shouldRevalidate=="function"?h=!0:d.push(_.route.id);return h&&d.length>0&&c.searchParams.set("_routes",d.join(",")),[c.pathname+c.search]},[f,o.v8_trailingSlashAwareDataRequests,e,s,t]);return M.createElement(M.Fragment,null,p.map(c=>M.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...i})))}function eA({page:e,matches:t,...i}){let s=Vi(),{future:o,manifest:f,routeModules:p}=wm(),{basename:c}=Sm(),{loaderData:h,matches:d}=YT(),_=M.useMemo(()=>sb(e,t,d,f,s,"data"),[e,t,d,f,s]),g=M.useMemo(()=>sb(e,t,d,f,s,"assets"),[e,t,d,f,s]),S=M.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,m=!1;if(t.forEach(v=>{let x=f.routes[v.route.id];!x||!x.hasLoader||(!_.some(k=>k.route.id===v.route.id)&&v.route.id in h&&p[v.route.id]?.shouldRevalidate||x.hasClientLoader?m=!0:w.add(v.route.id))}),w.size===0)return[];let b=_x(e,c,o.v8_trailingSlashAwareDataRequests,"data");return m&&w.size>0&&b.searchParams.set("_routes",t.filter(v=>w.has(v.route.id)).map(v=>v.route.id).join(",")),[b.pathname+b.search]},[c,o.v8_trailingSlashAwareDataRequests,h,s,f,_,t,e,p]),C=M.useMemo(()=>GT(g,f),[g,f]),T=JT(g);return M.createElement(M.Fragment,null,S.map(w=>M.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),C.map(w=>M.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),T.map(({key:w,link:m})=>M.createElement("link",{key:w,nonce:i.nonce,...m,crossOrigin:m.crossOrigin??i.crossOrigin})))}function tA(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var nA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{nA&&(window.__reactRouterVersion="7.17.0")}catch{}function iA({basename:e,children:t,useTransitions:i,window:s}){let o=M.useRef();o.current==null&&(o.current=Ik({window:s,v5Compat:!0}));let f=o.current,[p,c]=M.useState({action:f.action,location:f.location}),h=M.useCallback(d=>{i===!1?c(d):M.startTransition(()=>c(d))},[i]);return M.useLayoutEffect(()=>f.listen(h),[f,h]),M.createElement(NT,{basename:e,children:t,location:p.location,navigationType:p.action,navigator:f,useTransitions:i})}var vx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kl=M.forwardRef(function({onClick:t,discover:i="render",prefetch:s="none",relative:o,reloadDocument:f,replace:p,mask:c,state:h,target:d,to:_,preventScrollReset:g,viewTransition:S,defaultShouldRevalidate:C,...T},w){let{basename:m,navigator:b,useTransitions:v}=M.useContext(Li),x=typeof _=="string"&&vx.test(_),k=ox(_,m);_=k.to;let L=_T(_,{relative:o}),R=Vi(),N=null;if(c){let W=Oh(c,[],R.mask?R.mask.pathname:"/",!0);m!=="/"&&(W.pathname=W.pathname==="/"?m:ir([m,W.pathname])),N=b.createHref(W)}let[A,I,K]=XT(s,T),F=aA(_,{replace:p,mask:c,state:h,target:d,preventScrollReset:g,relative:o,viewTransition:S,defaultShouldRevalidate:C,useTransitions:v});function G(W){t&&t(W),W.defaultPrevented||F(W)}let B=!(k.isExternal||f),Y=M.createElement("a",{...T,...K,href:(B?N:void 0)||k.absoluteURL||L,onClick:B?G:t,ref:tA(w,I),target:d,"data-discover":!x&&i==="render"?"true":void 0});return A&&!x?M.createElement(M.Fragment,null,Y,M.createElement(ZT,{page:L})):Y});Kl.displayName="Link";var uh=M.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:s="",end:o=!1,style:f,to:p,viewTransition:c,children:h,...d},_){let g=ac(p,{relative:d.relative}),S=Vi(),C=M.useContext(Dh),{navigator:T,basename:w}=M.useContext(Li),m=C!=null&&hA(g)&&c===!0,b=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,v=S.pathname,x=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;i||(v=v.toLowerCase(),x=x?x.toLowerCase():null,b=b.toLowerCase()),x&&w&&(x=Wr(x,w)||x);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let L=v===b||!o&&v.startsWith(b)&&v.charAt(k)==="/",R=x!=null&&(x===b||!o&&x.startsWith(b)&&x.charAt(b.length)==="/"),N={isActive:L,isPending:R,isTransitioning:m},A=L?t:void 0,I;typeof s=="function"?I=s(N):I=[s,L?"active":null,R?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let K=typeof f=="function"?f(N):f;return M.createElement(Kl,{...d,"aria-current":A,className:I,ref:_,style:K,to:p,viewTransition:c},typeof h=="function"?h(N):h)});uh.displayName="NavLink";var rA=M.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:s,replace:o,state:f,method:p=Wu,action:c,onSubmit:h,relative:d,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:S,...C},T)=>{let{useTransitions:w}=M.useContext(Li),m=cA(),b=uA(c,{relative:d}),v=p.toLowerCase()==="get"?"get":"post",x=typeof c=="string"&&vx.test(c),k=L=>{if(h&&h(L),L.defaultPrevented)return;L.preventDefault();let R=L.nativeEvent.submitter,N=R?.getAttribute("formmethod")||p,A=()=>m(R||L.currentTarget,{fetcherKey:t,method:N,navigate:i,replace:o,state:f,relative:d,preventScrollReset:_,viewTransition:g,defaultShouldRevalidate:S});w&&i!==!1?M.startTransition(()=>A()):A()};return M.createElement("form",{ref:T,method:v,action:b,onSubmit:s?h:k,...C,"data-discover":!x&&e==="render"?"true":void 0})});rA.displayName="Form";function sA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bx(e){let t=M.useContext(xo);return Xt(t,sA(e)),t}function aA(e,{target:t,replace:i,mask:s,state:o,preventScrollReset:f,relative:p,viewTransition:c,defaultShouldRevalidate:h,useTransitions:d}={}){let _=jh(),g=Vi(),S=ac(e,{relative:p});return M.useCallback(C=>{if(PT(C,t)){C.preventDefault();let T=i!==void 0?i:ql(g)===ql(S),w=()=>_(e,{replace:T,mask:s,state:o,preventScrollReset:f,relative:p,viewTransition:c,defaultShouldRevalidate:h});d?M.startTransition(()=>w()):w()}},[g,_,S,i,s,o,t,e,f,p,c,h,d])}var oA=0,lA=()=>`__${String(++oA)}__`;function cA(){let{router:e}=bx("useSubmit"),{basename:t}=M.useContext(Li),i=AT(),s=e.fetch,o=e.navigate;return M.useCallback(async(f,p={})=>{let{action:c,method:h,encType:d,formData:_,body:g}=$T(f,t);if(p.navigate===!1){let S=p.fetcherKey||lA();await s(S,i,p.action||c,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:_,body:g,formMethod:p.method||h,formEncType:p.encType||d,flushSync:p.flushSync})}else await o(p.action||c,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:_,body:g,formMethod:p.method||h,formEncType:p.encType||d,replace:p.replace,state:p.state,fromRouteId:i,flushSync:p.flushSync,viewTransition:p.viewTransition})},[s,o,t,i])}function uA(e,{relative:t}={}){let{basename:i}=M.useContext(Li),s=M.useContext(_r);Xt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),f={...ac(e||".",{relative:t})},p=Vi();if(e==null){f.search=p.search;let c=new URLSearchParams(f.search),h=c.getAll("index");if(h.some(_=>_==="")){c.delete("index"),h.filter(g=>g).forEach(g=>c.append("index",g));let _=c.toString();f.search=_?`?${_}`:""}}return(!e||e===".")&&o.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(f.pathname=f.pathname==="/"?i:ir([i,f.pathname])),ql(f)}function hA(e,{relative:t}={}){let i=M.useContext(ux);Xt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=bx("useViewTransitionState"),o=ac(e,{relative:t});if(!i.isTransitioning)return!1;let f=Wr(i.currentLocation.pathname,s)||i.currentLocation.pathname,p=Wr(i.nextLocation.pathname,s)||i.nextLocation.pathname;return lh(o.pathname,p)!=null||lh(o.pathname,f)!=null}var pr=tx();const dA="fleet-console.canvas.",Cm="fleet-console.canvas.backgroundAnimation",Em="fleet-console.canvas.perimeterAnimation",yx="fleet-console.canvas.maximized",fA=400,ag=640,og=400,ab=40,ob=96,pA=.25,gA=1,sp=.2,lb=.5,mA=.001,no={x:0,y:0,zoom:1},oo={viewport:no,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},lg=new Set,cg=new Set,ug=new Set,hg=new Set,dg=new Set,Vl=new Map;let Ai=null,As=null,Xe=oo,lo=WA(),co=KA(),Hl=XA(),Qn=null,ks=no,ta=null,hh=0;function km(e){return lg.add(e),()=>{lg.delete(e)}}function go(){return Xe}function fg(){return Qn}function _A(){return Ai}function Sx(){return M.useSyncExternalStore(km,go,go)}function vA(){return M.useSyncExternalStore(MA,hb,hb)}function bA(){return M.useSyncExternalStore(NA,db,db)}function xx(){return M.useSyncExternalStore(OA,fb,fb)}function wx(){return M.useSyncExternalStore(DA,pb,pb)}function Cx(){return M.useSyncExternalStore(km,gb,gb)}function Ri(e){Xe={viewport:e.viewport??Xe.viewport,operations:e.operations??Xe.operations,operationOrder:e.operationOrder??Xe.operationOrder,operationAccent:e.operationAccent??Xe.operationAccent,minimized:e.minimized??Xe.minimized,collapsedGroups:e.collapsedGroups??Xe.collapsedGroups},HA(),kx()}function yA(e){const t=Xe.collapsedGroups.includes(e)?Xe.collapsedGroups.filter(i=>i!==e):[...Xe.collapsedGroups,e];Ri({collapsedGroups:t})}function SA(){return M.useSyncExternalStore(km,mb,mb)}function pg(e){Am();const t=Rm(e);ks=t,Ri({viewport:t})}function Ex(e){const t=Rm(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||zA()){pg(t);return}ks=t,ta===null&&(ta=window.requestAnimationFrame(Rx))}function gg(e,t){const i=aa();Ri({operations:{...Xe.operations,[e]:{...Lm(t,i),zIndex:i}}})}function xA(e){Xe.minimized.includes(e)||(Qn===e&&mo(),Ri({minimized:[...Xe.minimized,e]}))}function wA(e){if(!Xe.minimized.includes(e))return;Qn===e&&mo();const t=Xe.minimized.filter(o=>o!==e),i=Xe.operations[e];if(!i){Ri({minimized:t});return}const s=aa();Ri({minimized:t,operations:{...Xe.operations,[e]:{...i,zIndex:s}}})}function ap(e){Ri({operationOrder:Nx(e)})}function aa(){return hh+=1,hh}function CA(e){const t=Xe.operations[e];if(t)return t;const i=Object.keys(Xe.operations).length,s={x:i*ab,y:i*ab,width:ag,height:og,zIndex:aa()};return Ri({operations:{...Xe.operations,[e]:s}}),s}function EA(e){const t=new Set(e),i={};let s=!1;for(const[_,g]of Object.entries(Xe.operations))t.has(_)?i[_]=g:s=!0;const o=Xe.minimized.filter(_=>t.has(_)),f=o.length!==Xe.minimized.length,p=Xe.operationOrder.filter(_=>t.has(_)),c=p.length!==Xe.operationOrder.length,h=Object.fromEntries(Object.entries(Xe.operationAccent).filter(([_])=>t.has(_))),d=Object.keys(h).length!==Object.keys(Xe.operationAccent).length;Qn&&(!t.has(Qn)||o.includes(Qn))&&mo(),(s||f||c||d)&&Ri({operations:i,minimized:o,operationOrder:p,operationAccent:h})}function kA(e){$A(),Am(),IA(),Ai=e,Xe=e?FA(e):oo;const t=e?Vl.get(e)??null:null,i=Qn!==t;Qn=t,ks=Xe.viewport,hh=Math.max(hh,Ox(Xe.operations)),kx(),i&&Tm()}function cb(e,t){const i=Xe.operations[e];if(!i)return;const s=Math.max(pA,Math.min(gA,Math.min((t.width-ob)/i.width,(t.height-ob)/i.height))),o={x:t.width/2-(i.x+i.width/2)*s,y:t.height/2-(i.y+i.height/2)*s,zoom:s};Am(),ks=o;const f=aa(),p=Xe.minimized.includes(e);Ri({viewport:o,operations:{...Xe.operations,[e]:{...Lm(i,f),zIndex:f}},...p?{minimized:Xe.minimized.filter(c=>c!==e)}:{}})}function TA(){lo=!lo,qA(lo),Tx()}function AA(){co=!co,YA(co),Ax()}function RA(e){e==="local"&&(lo&&!GA()&&(lo=!1,Tx()),co&&!VA()&&(co=!1,Ax()))}function ub(){LA(!Hl)}function LA(e){Hl!==e&&(Hl=e,ZA(Hl),jA())}function $l(e){Ai&&Vl.set(Ai,e);const t=BA(e),i=!PA(Xe.minimized,t),s=Qn!==e;s&&(Qn=e),i&&Ri({minimized:t}),s&&Tm()}function mo(){Ai&&Vl.delete(Ai),Qn!==null&&(Qn=null,Tm())}function MA(e){return cg.add(e),()=>{cg.delete(e)}}function hb(){return lo}function NA(e){return ug.add(e),()=>{ug.delete(e)}}function db(){return co}function kx(){for(const e of lg)e()}function Tx(){for(const e of cg)e()}function Ax(){for(const e of ug)e()}function OA(e){return hg.add(e),()=>{hg.delete(e)}}function fb(){return Hl}function DA(e){return dg.add(e),()=>{dg.delete(e)}}function pb(){return Qn}function gb(){return Xe.minimized}function mb(){return Xe.collapsedGroups}function jA(){for(const e of hg)e()}function Tm(){for(const e of dg)e()}function IA(){Ai&&(Qn?Vl.set(Ai,Qn):Vl.delete(Ai))}function BA(e){return Object.keys(Xe.operations).filter(t=>t!==e)}function PA(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}function Rx(){const e=Xe.viewport,t=ks.x-e.x,i=ks.y-e.y,s=ks.zoom-e.zoom;if(Math.abs(t)<lb&&Math.abs(i)<lb&&Math.abs(s)<mA){ta=null,Ri({viewport:ks});return}Ri({viewport:{x:e.x+t*sp,y:e.y+i*sp,zoom:e.zoom+s*sp}}),ta=typeof window<"u"?window.requestAnimationFrame(Rx):null}function Am(){ta===null||typeof window>"u"||(window.cancelAnimationFrame(ta),ta=null)}function zA(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function HA(){!Ai||typeof window>"u"||(UA(),As=window.setTimeout(()=>{As=null,Lx(Ai,Xe)},fA))}function $A(){!As||!Ai||typeof window>"u"||(window.clearTimeout(As),As=null,Lx(Ai,Xe))}function UA(){!As||typeof window>"u"||(window.clearTimeout(As),As=null)}function FA(e){if(typeof window>"u")return oo;try{const t=window.localStorage.getItem(Mx(e));if(!t)return oo;const i=JSON.parse(t);return JA(i)}catch{return oo}}function Lx(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(Mx(e),JSON.stringify(t))}catch{}}function WA(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(Cm);return e===null?!0:e==="true"}catch{return!0}}function GA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Cm)!==null}catch{return!1}}function qA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Cm,String(e))}catch{}}function KA(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(Em);return e===null?!0:e==="true"}catch{return!0}}function VA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Em)!==null}catch{return!1}}function YA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Em,String(e))}catch{}}function XA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(yx)==="true"}catch{return!1}}function ZA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yx,String(e))}catch{}}function Mx(e){return`${dA}${e}`}function JA(e){if(!_o(e))return oo;const t=t3(e.operations);return{viewport:Rm(e.viewport),operations:t,operationOrder:Nx(e.operationOrder),operationAccent:QA(e.operationAccent),minimized:e3(e.minimized,t),collapsedGroups:i3(e.collapsedGroups)}}function Nx(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}function QA(e){if(!_o(e))return{};const t={};for(const[i,s]of Object.entries(e))typeof s=="string"&&(t[i]=s);return t}function e3(e,t){if(!Array.isArray(e))return[];const i=new Set,s=[];for(const o of e)typeof o!="string"||i.has(o)||!(o in t)||(i.add(o),s.push(o));return s}function Rm(e){if(!_o(e))return no;const t=Ul(e.x,no.x),i=Ul(e.y,no.y),s=mg(e.zoom,no.zoom);return{x:t,y:i,zoom:s}}function t3(e){if(!_o(e))return{};const t={};for(const[i,s]of Object.entries(e))_o(s)&&(t[i]=Lm(s,n3(t)));return t}function Lm(e,t){return _o(e)?{x:Ul(e.x,0),y:Ul(e.y,0),width:mg(e.width,ag),height:mg(e.height,og),zIndex:Ul(e.zIndex,t)}:{x:0,y:0,width:ag,height:og,zIndex:t}}function n3(e){return Ox(e)+1}function Ox(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Ul(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function mg(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function _o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function i3(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}const r3=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class ut extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function s3(e){const t=await fetch("/api/v1/theaters",{signal:e});await gi(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new ut(t.status,"Invalid Theater response");return{theaters:i.theaters.map(s=>zx(s,t.status))}}async function a3(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/status${i}`,{signal:t});return await gi(s),d3(await s.json(),s.status)}async function Dx(e={}){const t=e.force?"?force=true":"",i=await fetch(`/api/v1/updates/release-notes${t}`,{signal:e.signal});return await gi(i),p3(await i.json(),i.status)}async function o3(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await gi(t),f3(await t.json(),t.status)}async function jx(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await gi(i);const s=await i.json();return zx(s,i.status)}async function l3(e,t){const i=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await gi(i),v3(await i.json(),i.status)}async function Ix(e,t){const i=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await gi(i);const s=await i.json();if(typeof s.folderGrantId!="string")throw new ut(i.status,"Invalid folder grant response");return s.folderGrantId}async function c3(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await gi(i)}async function fi(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/operations${i}`,{signal:t});await gi(s);const o=await s.json();if(!Array.isArray(o.operations))throw new ut(s.status,"Invalid operations response");return o.operations.map(f=>Px(f,s.status))}async function Xs(e,t){const s=await fetch("/api/v1/operations/groups",{signal:t});await gi(s);const o=await s.json();if(!Array.isArray(o.groups))throw new ut(s.status,"Invalid groups response");return o.groups.map(f=>Mm(f,s.status))}async function u3(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await gi(i);const s=await i.json();return Mm(s.group,i.status)}async function op(e,t,i){const s=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await gi(s);const o=await s.json();return Mm(o.group,s.status)}async function h3(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await gi(i)}async function Bx(e,t,i){return qu(e,{title:t},i)}async function qu(e,t,i){const s=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await gi(s);const o=await s.json();return Px(o.operation,s.status)}function Px(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||Yl(i)||Yl(i.payload))throw new ut(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,accent:typeof i.accent=="string"?i.accent:null,groupId:i.groupId===null?null:typeof i.groupId=="string"?i.groupId:void 0,ts:i.ts}}function Mm(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.name!="string"||typeof i.color!="string"||typeof i.order!="number"||typeof i.createdAt!="number")throw new ut(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function zx(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string"||typeof i.createdAt!="string"||typeof i.lastOpenedAt!="string"||typeof i.hasWiki!="boolean"||typeof i.activeAdmiralCount!="number"||Yl(i))throw new ut(t,"Invalid Theater response");return i}function d3(e,t){const i=e;if(!i||typeof i.workspaces!="number"||typeof i.version!="string"||i.channel!=="stable"&&i.channel!=="local"&&i.channel!=="unknown"||typeof i.updateAvailable!="boolean"||typeof i.port!="number"||i.portMode!=="dynamic"&&i.portMode!=="static"||i.requestedPort!==null&&typeof i.requestedPort!="number"||typeof i.effectivePort!="number"||typeof i.portHonored!="boolean"||i.wikiServerStatus!=="available"&&i.wikiServerStatus!=="unavailable"&&i.wikiServerStatus!=="unknown")throw new ut(t,"Invalid status response");return{workspaces:i.workspaces,version:i.version,channel:i.channel,updateAvailable:i.updateAvailable,latestVersion:typeof i.latestVersion=="string"?i.latestVersion:void 0,port:i.port,portMode:i.portMode,requestedPort:i.requestedPort,effectivePort:i.effectivePort,portHonored:i.portHonored,wikiServerStatus:i.wikiServerStatus}}function f3(e,t){const i=e;if(!i||i.status!=="accepted")throw new ut(t,"Invalid update response");return{status:"accepted"}}function p3(e,t){const i=e;if(!i||!Array.isArray(i.notes)||i.sourceRef!=="main"||typeof i.fetchedAt!="number"||typeof i.stale!="boolean"||"url"in i||"token"in i||"path"in i)throw new ut(t,"Invalid release notes response");return{notes:i.notes.map(s=>g3(s,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function g3(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections))throw new ut(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(s=>m3(s,t))}}function m3(e,t){const i=e;if(!i||i.heading!=="Added"&&i.heading!=="Changed"&&i.heading!=="Fixed"&&i.heading!=="Removed"&&i.heading!=="Breaking Changes"||!Array.isArray(i.items))throw new ut(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(s=>_3(s,t))}}function _3(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(s=>typeof s=="string")||typeof i.text!="string")throw new ut(t,"Invalid release notes response");return{packageTags:i.packageTags,text:i.text}}function v3(e,t){const i=e;if(!i||typeof i.path!="string"||i.parentPath!==null&&typeof i.parentPath!="string"||!Array.isArray(i.roots)||!Array.isArray(i.entries)||Yl(i))throw new ut(t,"Invalid folder list response");return{path:i.path,parentPath:i.parentPath??null,roots:i.roots.filter(s=>typeof s=="string"),entries:i.entries.map(s=>b3(s,t)),truncated:i.truncated===!0?!0:void 0}}function b3(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||Yl(i))throw new ut(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function Yl(e){if(!e||typeof e!="object")return!1;const t=e;return r3.some(i=>i in t)}async function gi(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const i=await e.json();typeof i.error=="string"?t=i.error:typeof i.message=="string"&&(t=i.message)}catch{}throw new ut(e.status,t)}const y3="__unassigned__";function S3(e){const t=new Map(e.theaters.map(s=>[s.id,s])),i=[];for(const s of e.operations)s.theaterId&&i.push(C3(s,t.get(s.theaterId)));return i}function x3(e,t){const i=Hx(t);return i.length===0?e:e.filter(s=>{const o=E3(s);return i.every(f=>o.includes(f))})}function w3(e){const t=[],i=new Map;for(const s of e){const o=s.theaterId??y3,f=i.get(o);if(f!==void 0){const p=t[f];p&&(t[f]={...p,entries:[...p.entries,s]});continue}i.set(o,t.length),t.push({theaterId:s.theaterId,theaterLabel:s.theaterLabel,entries:[s]})}return t}function Hx(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function C3(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function E3(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const _g="fleet-console.activeTheaterId",$x="fleet-console.commissioningSeen",Ux="fleet-console.whatsNewSeenVersion",Fx="fleet-console.notificationPreferences",Wx=1,k3="maritime",xu={globalMute:!1,dnd:!1,mutedTheaterIds:{}},vg=new Set;let _b=0,bg=null,Ue={connection:"connecting",connectionError:null,activeTheme:k3,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,operationNotifications:{},notificationPreferences:J3(),codexReader:null,codexReaderExpanded:!1};function yg(){return Ue}function T3(e){return vg.add(e),()=>{vg.delete(e)}}function tt(e){Ue={...Ue,...e},V3()}function A3(e){Ue.operationsViewActive!==e&&tt({operationsViewActive:e})}function Gx(e){L3(e),tt({activeTheme:e})}function R3(e){RA(e.channel),tt({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...ew({...Ue,version:e.version})})}function qx(){tt({releaseNotesLoading:!0,releaseNotesError:null})}function Kx(e){const t={...Ue,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Ue.selectedReleaseNoteKey&&nw(e.notes,Ue.selectedReleaseNoteKey)?Ue.selectedReleaseNoteKey:tw(e.notes)};tt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...ew(t)})}function Vx(e){tt({releaseNotesLoading:!1,releaseNotesError:e})}function L3(e){if(!(typeof document>"u")){if(e==="maritime"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}function M3(e){const t=Qx(e,Ue.activeTheaterId);tt({theaters:e,activeTheaterId:t})}function N3(e){M3(e.theaters)}function pi(e){tt({operations:e,operationsHydrated:!0})}function O3(e){const t=Ue.operations.findIndex(s=>s.id===e.id);if(t===-1)return;const i=[...Ue.operations];i[t]=e,tt({operations:i})}function Zs(e){tt({groups:e})}function D3(e){Bh(e),tt({activeTheaterId:e})}function fr(e){Ue.activeOperationId!==e&&tt({activeOperationId:e})}function j3(e,t){if(t==="idle"){Yx(e);return}Ue.operationStatus[e]!==t&&tt({operationStatus:{...Ue.operationStatus,[e]:t}})}function Yx(e){if(!(e in Ue.operationStatus))return;const t={...Ue.operationStatus};delete t[e],tt({operationStatus:t})}function I3(e){if(!e.operationId)return;const t=Ue.operations.find(p=>p.id===e.operationId);if(!t)return;const i=t.theaterId??null,s=Ue.theaters.find(p=>p.id===i)?.label??i??"Unknown",o=t.title,f=X3(e.kind);_b+=1,tt({operationNotifications:{...Ue.operationNotifications,[e.operationId]:{kind:f,operationId:e.operationId,theaterId:i,theaterLabel:s,operationLabel:o,lastRaisedSeq:_b}}})}function Xx(){tt({addingTheater:!0,theaterError:null})}function Zx(e){const t=[e,...Ue.theaters.filter(i=>i.id!==e.id)];Bh(e.id),tt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function B3(){tt({addingTheater:!1,theaterError:null})}function Sg(e){tt({addingTheater:!1,theaterError:e})}function Xl(e){const t=Ue.operations.find(i=>i.id===e);t&&(Bh(t.theaterId),tt({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:Jx(Ue.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function vb(){Ue.pendingOperationFocus!==null&&tt({pendingOperationFocus:null})}function P3(e,t,i){if(e.length===0)return null;const s=t?e.indexOf(t):-1,o=s===-1?i>0?0:e.length-1:(s+i+e.length)%e.length;return e[o]??null}function Nm(e,t){if(t.length===0)return[...e].sort(xg);const i=new Map(t.map((s,o)=>[s,o]));return[...e].sort((s,o)=>{const f=i.get(s.id),p=i.get(o.id);return f!==void 0&&p!==void 0?f-p:f!==void 0?-1:p!==void 0?1:xg(s,o)})}function z3(e,t,i,s=[]){const o=Nm(e,i),f=new Set(s),p=[...t].sort((h,d)=>h.order-d.order||h.createdAt-d.createdAt),c=new Map;for(const h of p)c.set(h.id,[]);c.set(null,[]);for(const h of o){const d=h.groupId??null;d!==null&&c.has(d)?c.get(d).push(h):c.get(null).push(h)}return[...p.filter(h=>!f.has(h.id)).flatMap(h=>c.get(h.id)??[]),...c.get(null)??[]]}function xg(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function lp(){tt({operationSearchOpen:!1})}function H3(){tt({operationSearchOpen:!Ue.operationSearchOpen})}function $3(){Ue.releaseNotes.length===0||Ue.whatsNewOpen||tt({whatsNewOpen:!0,selectedReleaseNoteKey:Ue.selectedReleaseNoteKey??tw(Ue.releaseNotes)})}function wu(){Ue.whatsNewOpen&&(Ue.automaticWhatsNewVersion&&nR(Ue.automaticWhatsNewVersion),tt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function bb(e){nw(Ue.releaseNotes,e)&&tt({selectedReleaseNoteKey:e})}function yl(){eR(!0),Ue.onboardingOpen&&tt({onboardingOpen:!1})}function $r(e){tt({codexReader:e,codexReaderExpanded:!1})}function Ku(){Ue.codexReader!==null&&tt({codexReaderExpanded:!0})}function U3(){tt({codexReaderExpanded:!1})}function yb(){tt({codexReader:null,codexReaderExpanded:!1})}function Sb(){if(Ue.bootstrapped)return;const e=Ue.theaters.length===0&&!Q3();tt({bootstrapped:!0,onboardingOpen:e?!0:Ue.onboardingOpen})}function xb(e){const t=Ue.theaters.filter(p=>p.id!==e),i=Qx(t,Ue.activeTheaterId===e?null:Ue.activeTheaterId),s=Y3(Ue.operationNotifications,e),o=new Set(Ue.operations.filter(p=>p.theaterId===e).map(p=>p.id)),f=Ue.activeOperationId&&o.has(Ue.activeOperationId)?null:Ue.activeOperationId;Bh(i),tt({theaters:t,activeTheaterId:i,activeOperationId:f,operationNotifications:s})}function F3(e){const t=Jx(Ue.operationNotifications,e);t!==Ue.operationNotifications&&tt({operationNotifications:t})}function W3(e){const t={...Ue.notificationPreferences,globalMute:e};Dm(t),tt({notificationPreferences:t})}function G3(e){const t={...Ue.notificationPreferences,dnd:e};Dm(t),tt({notificationPreferences:t})}function q3(e){const t={...Ue.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...Ue.notificationPreferences,mutedTheaterIds:t};Dm(i),tt({notificationPreferences:i})}function K3(e){return S3(e)}function V3(){for(const e of vg)e()}function Jx(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function Y3(e,t){let i=!1;const s={};for(const[o,f]of Object.entries(e)){if(f.theaterId===t){i=!0;continue}s[o]=f}return i?s:e}function Qx(e,t){const i=new Set(e.map(o=>o.id)),s=Z3();return s&&i.has(s)?s:t&&i.has(t)?t:e[0]?.id??null}function X3(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function ew(e){const t=e.releaseNotes.findIndex(s=>s.version!=="Unreleased"),i=t>=0?e.releaseNotes[t]:void 0;return!i||!e.version||i.version!==e.version||tR()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:Om(i.version,t)}}function tw(e){return e[0]?Om(e[0].version,0):null}function nw(e,t){return e.some((i,s)=>Om(i.version,s)===t)}function Om(e,t){return`${e}:${t}`}function Z3(){if(typeof window>"u")return null;try{return window.localStorage.getItem(_g)}catch{return null}}function Bh(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(_g,e):window.localStorage.removeItem(_g)}catch{}}function J3(){if(typeof window>"u")return xu;try{const e=window.localStorage.getItem(Fx);if(!e)return xu;const t=JSON.parse(e);return iR(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:xu}catch{return xu}}function Q3(){if(typeof window>"u")return!1;try{return window.localStorage.getItem($x)==="1"}catch{return!1}}function eR(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem($x,"1")}catch{}}function tR(){if(bg!==null)return bg;if(typeof window>"u")return null;try{return window.localStorage.getItem(Ux)}catch{return null}}function nR(e){if(bg=e,!(typeof window>"u"))try{window.localStorage.setItem(Ux,e)}catch{}}function Dm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Fx,JSON.stringify({version:Wx,preferences:e}))}catch{}}function iR(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==Wx||!t.preferences||typeof t.preferences!="object")return!1;const i=t.preferences;return typeof i.globalMute=="boolean"&&typeof i.dnd=="boolean"&&!!i.mutedTheaterIds&&typeof i.mutedTheaterIds=="object"}const Cu="directory-browser-sectors";function wg({open:e,onCancel:t,onConfirm:i}){const[s,o]=M.useState(null),[f,p]=M.useState(null),[c,h]=M.useState(null),[d,_]=M.useState(""),[g,S]=M.useState(""),[C,T]=M.useState(0),w=M.useRef(null),m=M.useRef(null),b=async(W,z)=>{p(W),h(null),_(""),T(0);try{const V=await l3(W,z);o(V)}catch(V){if(V instanceof DOMException&&V.name==="AbortError")return;h(V instanceof ut?V.message:String(V))}finally{p(null)}};M.useEffect(()=>{if(!e)return;const W=new AbortController;return b(null,W.signal),()=>W.abort()},[e]),M.useEffect(()=>{e&&w.current?.focus()},[e,s?.path]);const v=s?.entries??[],x=M.useMemo(()=>{const W=d.trim().toLowerCase();return W===""?v:v.filter(z=>z.name.toLowerCase().includes(W))},[v,d]),k=M.useMemo(()=>s?rR(s):[],[s]),L=s?wb(s.path):null,R=s?.roots??[],N=R.length>1,A=x.length===0?-1:Math.min(C,x.length-1);if(M.useEffect(()=>{if(A<0)return;m.current?.querySelector(`[data-index="${A}"]`)?.scrollIntoView({block:"nearest"})},[A,s?.path]),!e)return null;const I=W=>{W.accessible&&f===null&&b(W.path)},K=()=>{s?.parentPath!=null&&f===null&&b(s.parentPath)},F=()=>{const W=g.trim();W!==""&&f===null&&b(W)},G=s?.path??null,B=A>=0?`${Cu}-${A}`:void 0,Y=W=>{switch(W.key){case"Escape":d!==""?_(""):t();return;case"ArrowDown":W.preventDefault(),T(z=>Math.min(z+1,Math.max(x.length-1,0)));return;case"ArrowUp":W.preventDefault(),T(z=>Math.max(z-1,0));return;case"Enter":{W.preventDefault();const z=x[A];z&&I(z);return}case"Backspace":d===""&&(W.preventDefault(),K());return;default:return}};return pr.createPortal(u.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[u.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),u.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Establish Theater of Operations",onKeyDown:Y,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(oR,{})}),u.jsxs("div",{className:"directory-browser-heading",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Theater of Operations"}),u.jsx("h2",{children:"Establish Theater"})]}),u.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),N?u.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Stations"}),u.jsx("div",{className:"directory-browser-root-chips",children:R.map(W=>{const z=L!=null&&wb(W)===L;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${z?"is-active":""}`,"aria-current":z?"location":void 0,disabled:f!==null,title:W,onClick:()=>{f===null&&b(W)},onKeyDown:V=>V.stopPropagation(),children:aR(W)},W)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:k.map((W,z)=>{const V=z===k.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[z>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${V?"is-current":""}`,"aria-current":V?"location":void 0,disabled:V||f!==null,title:W.path,onClick:()=>{b(W.path)},children:W.label})]},W.path)})}),u.jsxs("div",{className:"directory-browser-toolbar",children:[u.jsxs("div",{className:"directory-browser-filter",children:[u.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:u.jsx(cR,{})}),u.jsx("input",{ref:w,type:"text",className:"directory-browser-filter-input",placeholder:"Filter sectors…","aria-label":"Filter folders","aria-controls":Cu,value:d,spellCheck:!1,autoComplete:"off",onChange:W=>{_(W.target.value),T(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||f!==null,title:"Up one sector (Backspace)",onClick:K,children:[u.jsx(uR,{}),u.jsx("span",{children:"Up"})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.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:g,spellCheck:!1,autoComplete:"off",onChange:W=>S(W.target.value),onKeyDown:W=>{W.stopPropagation(),W.key==="Enter"&&(W.preventDefault(),F())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:g.trim()===""||f!==null,onClick:F,onKeyDown:W=>W.stopPropagation(),children:"Go"})]}),c?u.jsx("p",{className:"directory-browser-error",role:"alert",children:c}):null,u.jsx("div",{className:"directory-browser-list",id:Cu,role:"listbox","aria-label":"Folders","aria-busy":f!==null,"aria-activedescendant":B,ref:m,children:f!==null?u.jsxs("p",{className:"directory-browser-state is-live",children:[u.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Scouting…"]}):x.length===0?u.jsx("p",{className:"directory-browser-state",children:d!==""?"No sectors match the filter.":"No sectors to advance into."}):x.map((W,z)=>u.jsxs("div",{id:`${Cu}-${z}`,"data-index":z,role:"option","aria-selected":z===A,"aria-disabled":!W.accessible,className:`directory-browser-sector ${z===A?"is-active":""} ${W.accessible?"":"is-locked"}`,title:W.path,onClick:()=>{T(z),I(W)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(lR,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:W.name}),W.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(hR,{})," Locked"]})]},W.path))}),s?.truncated?u.jsx("p",{className:"directory-browser-note",children:"Charting first 500 sectors only."}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),u.jsx("span",{className:"directory-browser-target-path",title:G??"",children:G??"Scouting…"})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:G===null||f!==null,onClick:()=>G&&i(G),children:"Establish Theater"})]})]})]})]}),document.body)}function rR(e){if(sR(e)==="/"){const p=[{label:"/",path:"/"}];let c="";for(const h of e.path.split("/").filter(Boolean))c+=`/${h}`,p.push({label:h,path:c});return p}const i=/^([A-Za-z]:)\\?/.exec(e.path),s=i?`${i[1]}\\`:e.roots[0]??"C:\\",o=[{label:s,path:s}];let f=s.replace(/\\$/,"");for(const p of e.path.slice(s.length).split("\\").filter(Boolean))f+=`\\${p}`,o.push({label:p,path:f});return o}function sR(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function wb(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function aR(e){return e.replace(/[\\/]+$/,"")||e}function oR(){return u.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),u.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 lR(){return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.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 cR(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function uR(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 hR(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.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"})]})}const dR=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function fR({state:e}){const[t,i]=M.useState(!1),s=M.useRef(null),o=M.useRef(null),f=M.useRef(null),p=e.theaters.length>0;if(M.useEffect(()=>{if(e.onboardingOpen)return s.current=document.activeElement,o.current?.focus(),()=>{const _=s.current;s.current=null,_?.focus?.()}},[e.onboardingOpen]),M.useEffect(()=>{if(!e.onboardingOpen)return;const _=g=>{t||(g.key==="Escape"?(g.preventDefault(),yl()):g.key==="Tab"&&pR(g,f.current),g.stopImmediatePropagation())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const c=()=>{i(!0)},h=()=>{i(!1)},d=async _=>{i(!1),Xx();try{const g=await Ix(_),S=await jx(g);Zx(S)}catch(g){Sg(g instanceof Error?g.message:String(g))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:yl,"aria-label":"Close Commissioning guide"}),u.jsxs("section",{className:"commissioning-card",ref:f,children:[u.jsxs("header",{className:"commissioning-header",children:[u.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),u.jsx("h2",{id:"commissioning-title",children:"Bring your fleet online"}),u.jsx("p",{children:"Three steps to go from an empty bridge to live carrier operations."})]}),u.jsxs("ol",{className:"commissioning-steps",children:[u.jsxs("li",{className:`commissioning-step commissioning-step--primary ${p?"is-complete":"is-current"}`,children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:p?"✓":"01"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Register a Theater"}),u.jsx("p",{children:"A Theater is a project directory the fleet operates in. Choose the folder you want to work from."}),p?u.jsx(Kl,{ref:_=>{o.current=_},className:"commissioning-primary-action",to:"/operations",onClick:yl,children:"Go to Operations →"}):u.jsx("button",{ref:_=>{o.current=_},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:c,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Open an Operation"}),u.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."}),u.jsx(Kl,{className:"commissioning-secondary-link",to:"/operations",onClick:yl,children:"Go to Operations"})]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Observe carriers"}),u.jsx("p",{children:"Carriers are specialist agents your Admiral dispatches. Their sorties stream here in real time as they run."})]})]})]}),u.jsxs("footer",{className:"commissioning-footer",children:[u.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),u.jsx("button",{type:"button",className:"commissioning-skip",onClick:yl,children:"Skip for now"})]})]}),u.jsx(wg,{open:t,onCancel:h,onConfirm:d})]})}function pR(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(dR)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}const gR="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",Cb="operation-search-listbox",iw="__unassigned__";function mR({state:e}){const t=jh(),[i,s]=M.useState(""),[o,f]=M.useState(0),p=M.useRef(null),c=M.useRef(null),h=M.useRef(null),d=M.useRef(new Map),_=M.useMemo(()=>K3(e),[e]),g=M.useMemo(()=>x3(_,i),[_,i]),S=M.useMemo(()=>w3(g),[g]),C=M.useMemo(()=>Hx(i),[i]),T=Eb(o,g.length),w=g[T]?kb(g[T].operationId):void 0;if(M.useEffect(()=>{if(!e.operationSearchOpen)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=v,h.current?.focus()}},[e.operationSearchOpen]),M.useEffect(()=>{if(!e.operationSearchOpen){s(""),f(0);return}f(0)},[e.operationSearchOpen,i]),M.useEffect(()=>{if(!e.operationSearchOpen)return;const v=g[T];v&&d.current.get(v.operationId)?.scrollIntoView({block:"nearest"})},[T,g,e.operationSearchOpen]),!e.operationSearchOpen)return null;const m=v=>{Xl(v),t("/operations"),lp()},b=v=>{if(v.key==="Escape"){v.preventDefault(),lp();return}if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault(),f(x=>Eb(x+(v.key==="ArrowDown"?1:-1),g.length));return}if(v.key==="Enter"){const x=g[T];if(!x)return;v.preventDefault(),m(x.operationId);return}v.key==="Tab"&&yR(v,c.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:v=>{v.target===v.currentTarget&&lp()},children:u.jsxs("section",{ref:c,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:b,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(SR,{}),u.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:i,onChange:v=>s(v.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":Cb,"aria-activedescendant":w,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:Cb,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:S.length>0?S.map(v=>{const x=vR(v.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":x,children:[u.jsx("h2",{id:x,className:"operation-search-section-heading",children:cp(v.theaterLabel,C)}),v.entries.map(k=>{const L=g.indexOf(k),R=L===T;return u.jsxs("button",{id:kb(k.operationId),ref:N=>{N?d.current.set(k.operationId,N):d.current.delete(k.operationId)},type:"button",className:`operation-search-result ${R?"is-active":""}`,role:"option","aria-selected":R,onMouseEnter:()=>f(L),onClick:()=>m(k.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:cp(k.operationName,C)}),u.jsx("small",{children:_R(k)})]}),u.jsx("span",{className:"operation-search-theater",children:cp(k.theaterLabel,C)})]},k.operationId)})]},v.theaterId??iw)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function Eb(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function _R(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function vR(e){return`operation-search-heading-${rw(e??iw)}`}function kb(e){return`operation-search-option-${rw(e)}`}function rw(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function cp(e,t){if(t.length===0)return e;const i=[];let s=0;for(;s<e.length;){const o=bR(e,t,s);if(!o){i.push(e.slice(s));break}o.start>s&&i.push(e.slice(s,o.start)),i.push(u.jsx("mark",{children:e.slice(o.start,o.end)},`${o.start}-${o.end}`)),s=o.end}return i}function bR(e,t,i){const s=e.toLocaleLowerCase();let o=null;for(const f of t){const p=s.indexOf(f,i);p!==-1&&(!o||p<o.start)&&(o={start:p,end:p+f.length})}return o}function yR(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(gR)).filter(f=>f.offsetParent!==null);if(i.length===0)return;const s=i[0],o=i[i.length-1];if(e.shiftKey&&document.activeElement===s){e.preventDefault(),o?.focus();return}!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s?.focus())}function SR(){return u.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:u.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"})})}const xR=1400,wR="https://github.com/sbluemin/fleet-harness",CR="https://github.com/sbluemin/fleet-harness/stargazers",ER="https://api.github.com/repos/sbluemin/fleet-harness",jm="fleet-console.github-stars",kR=360*60*1e3;function TR({state:e}){const t=Vi().pathname,i=xx(),s=t.startsWith("/operations"),o=e.releaseNotes.find(c=>c.version!=="Unreleased")?.version??null,f=e.automaticWhatsNewVersion!==null&&e.automaticWhatsNewVersion===o,p=()=>{$3()};return u.jsxs(u.Fragment,{children:[u.jsxs("footer",{className:"statusbar",role:"contentinfo","aria-label":"Console status",children:[u.jsx("div",{className:"statusbar-left",children:s?u.jsx("button",{type:"button",className:"statusbar-collapse",onClick:ub,"aria-label":"Hide status bar",title:"Hide status bar",children:u.jsx(HR,{})}):null}),u.jsxs("div",{className:"statusbar-right",children:[e.updateAvailable?u.jsx(AR,{latestVersion:e.latestVersion}):null,s?null:u.jsxs("span",{className:"statusbar-routes",role:"group","aria-label":"Console routes",children:[u.jsx(uh,{to:"/carrier-settings",className:({isActive:c})=>`statusbar-route-link${c?" is-active":""}`,"aria-label":"Carriers",title:"Carriers",children:u.jsx(PR,{})}),u.jsx(uh,{to:"/settings",className:({isActive:c})=>`statusbar-route-link${c?" is-active":""}`,"aria-label":"Settings",title:"Settings",children:u.jsx(zR,{})})]}),u.jsx(Kl,{className:"statusbar-brand",to:"/operations","aria-label":"Operations",children:u.jsx("span",{className:"statusbar-wordmark",children:"Fleet"})}),u.jsx(RR,{}),u.jsxs("button",{type:"button",className:"statusbar-version",onMouseDown:c=>c.preventDefault(),onClick:p,disabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale),"aria-label":`What's new for version ${e.version}`,title:`What's new v${e.version}`,children:[f?u.jsx("span",{className:"statusbar-version-dot","aria-hidden":"true"}):null,u.jsxs("span",{children:["v",e.version]})]})]})]}),s&&i?pr.createPortal(u.jsx("button",{type:"button",className:"statusbar-reveal",onClick:ub,"aria-label":"Show status bar",title:"Show status bar",children:u.jsx($R,{})}),document.body):null]})}function AR({latestVersion:e}){const[t,i]=M.useState("idle"),[s,o]=M.useState(null),f=M.useRef(null),p=LR(t,s,e);M.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);const c=async()=>{if(!p.disabled){f.current!==null&&(window.clearTimeout(f.current),f.current=null),i("applying"),o(null);try{if((await o3()).status!=="accepted"){i("error"),o("invalid_response");return}i("accepted"),f.current=window.setTimeout(()=>{f.current=null,i("completed")},xR)}catch(h){const d=h instanceof ut?h.message:"network_error";o(d),i(NR(d)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`statusbar-update statusbar-update--${p.tone}`,onClick:c,disabled:p.disabled,title:p.title,"aria-live":"polite",children:p.label})}function RR(){const e=OR(),t=e.count!==null;return u.jsxs("div",{className:"statusbar-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"statusbar-github-link",href:wR,target:"_blank",rel:"noopener noreferrer","aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(UR,{})}),u.jsxs("a",{className:"statusbar-github-stars",href:CR,target:"_blank",rel:"noopener noreferrer","aria-label":t?`GitHub stars ${e.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(FR,{}),t?u.jsx("span",{className:"statusbar-github-stars-count",children:BR(e.count)}):null]})]})}function LR(e,t,i){const s=i?`Latest version ${i}`:"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"?MR(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:s,tone:"warn",disabled:!1}}function MR(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",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 NR(e){return e==="local_channel"||e==="update_already_in_progress"||e==="update_not_available"}function OR(){const[e,t]=M.useState(()=>{const i=DR();return i===null?{count:null,status:"idle"}:{count:i,status:"ready"}});return M.useEffect(()=>{if(jR())return;let i=!1;return t(s=>s.status==="ready"?s:{...s,status:"loading"}),fetch(ER,{headers:{Accept:"application/vnd.github+json"}}).then(s=>s.ok?s.json():Promise.reject(new Error(`status ${s.status}`))).then(s=>{if(i)return;const o=typeof s.stargazers_count=="number"?s.stargazers_count:null;if(o===null){t(f=>({count:f.count,status:f.count===null?"error":"ready"}));return}IR(o),t({count:o,status:"ready"})}).catch(()=>{i||t(s=>({count:s.count,status:s.count===null?"error":"ready"}))}),()=>{i=!0}},[]),e}function DR(){try{const e=window.localStorage.getItem(jm);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function jR(){try{const e=window.localStorage.getItem(jm);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<kR}catch{return!1}}function IR(e){try{window.localStorage.setItem(jm,JSON.stringify({count:e,at:Date.now()}))}catch{}}function BR(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function PR(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),u.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function zR(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function HR(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.2 6.4 8 10.2 11.8 6.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function $R(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.2 9.6 8 5.8 11.8 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function UR(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 FR(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 WR({open:e,title:t,message:i,tone:s="info",onDismiss:o}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${s}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),i?u.jsx("p",{className:"app-toast-message",children:i}):null]}),o?u.jsx("button",{type:"button",className:"app-toast-close",onClick:o,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}const GR=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Sl=10;function qR({state:e}){const t=M.useRef(null),i=M.useRef(null),s=M.useRef(null),o=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!o&&t.current===null&&(t.current=document.activeElement),M.useEffect(()=>{if(!e.whatsNewOpen||o)return;const w=m=>{m.key==="Escape"?(m.preventDefault(),wu()):m.key==="Tab"&&YR(m,s.current),m.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",w,!0),()=>{window.removeEventListener("keydown",w,!0);const m=t.current;t.current=null,m?.focus?.()}},[e.whatsNewOpen,o]),!e.whatsNewOpen||o||e.releaseNotes.length===0)return null;const f=e.selectedReleaseNoteKey??Ga(e.releaseNotes[0]?.version??"",0),p=e.releaseNotes.findIndex((w,m)=>Ga(w.version,m)===f),c=e.releaseNotes[p]??e.releaseNotes[0],h=Ga(c.version,p>=0?p:0),d=()=>{qx(),Dx({force:!0}).then(Kx).catch(w=>Vx(w instanceof Error?w.message:String(w)))},_=Math.max(1,Math.ceil(e.releaseNotes.length/Sl)),g=Math.min(_-1,Math.floor((p>=0?p:0)/Sl)),S=g*Sl,C=e.releaseNotes.slice(S,S+Sl),T=w=>{const m=g+w;if(m<0||m>=_)return;const b=m*Sl,v=e.releaseNotes[b];v&&bb(Ga(v.version,b))};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:wu,"aria-label":"Close What's new"}),u.jsxs("section",{className:"whatsnew-card",ref:s,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:"What's new"}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",c.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[c.date?u.jsxs("time",{className:"whatsnew-date",dateTime:c.date,children:["Released ",c.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:wu,"aria-label":"Close What's new",children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx("select",{"aria-label":"Release version",value:h,onChange:w=>bb(w.currentTarget.value),children:C.map((w,m)=>{const b=S+m;return u.jsxs("option",{value:Ga(w.version,b),children:[w.version==="Unreleased"?"Unreleased":`v${w.version}`,w.date?` · ${w.date}`:""]},Ga(w.version,b))})}),_>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>T(-1),disabled:g===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[g+1," / ",_]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>T(1),disabled:g>=_-1,"aria-label":"Older versions",children:"›"})]}):null,u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:d,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,c.sections.map((w,m)=>u.jsx(KR,{section:w,index:m},w.heading))]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:wu,children:"Close"})})]})]})}function KR({section:e,index:t}){const i=e.heading.toLowerCase().replaceAll(" ","-"),s={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${i}`,style:s,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((o,f)=>u.jsx("li",{children:u.jsx(VR,{item:o})},`${o.text}:${f}`))})]})}function VR({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,i)=>u.jsx("span",{className:`whatsnew-package-chip whatsnew-package-chip--${i%2===0?"brass":"aurora"}`,children:t},`${t}:${i}`)),u.jsx("span",{children:e.text})]})}function Ga(e,t){return`${e}:${t}`}function YR(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(GR)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function Gr(){return M.useSyncExternalStore(T3,yg,yg)}function Ph(e=()=>{}){return{...QS(e),notifications:{emit:i=>I3(i),dismiss:i=>F3(i)},status:{set:(i,s)=>j3(i,s),clear:i=>Yx(i)}}}const Tb=250,XR=5e3,Ab=1,ZR=1013,JR=4e3,QR=4001;function eL(e){const t=new AbortController,i=new TextEncoder;let s=Tb,o=null,f=null,p=null,c=!1;const h=()=>{f?.dispose(),f=null},d=(S,C)=>{p={cols:S,rows:C},o?.readyState===Ab&&o.send(JSON.stringify({type:"resize",cols:S,rows:C}))},_=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:S}=await nL(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await g(tL(S,e.location,e.wsPath),e),s=Tb}catch(S){if(t.signal.aborted)return;e.onStatus?.("connecting",S instanceof Error?S.message:String(S))}await rL(s,t.signal),s=Math.min(s*2,XR)}},g=async(S,C)=>{await new Promise((T,w)=>{const m=(C.webSocketFactory??iL)(S);o=m,m.binaryType="arraybuffer",m.onopen=()=>{C.onStatus?.("live"),h(),f=C.terminal.onData(b=>{m.readyState===Ab&&m.send(i.encode(b))}),p&&d(p.cols,p.rows)},m.onmessage=b=>{b.data instanceof ArrayBuffer&&C.terminal.write(new Uint8Array(b.data))},m.onerror=()=>{w(new Error("Terminal WebSocket error"))},m.onclose=b=>{h(),o===m&&(o=null);const v=b?.code;v===JR?(t.abort(),C.onStatus?.("closed","terminal_replaced")):v===QR?(t.abort(),C.onStatus?.("closed","terminal_closed"),C.onExit?.()):v===ZR&&(t.abort(),C.onStatus?.("closed","terminal_unavailable")),T()}})};return{start:()=>{c||(c=!0,_())},resize:d,dispose:()=>{t.abort(),h(),e.onStatus?.("closed"),o?.close(),o=null}}}function tL(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function nL(e,t,i){const s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:i});if(!s.ok)throw new Error(`Terminal ticket request failed: ${s.status}`);const o=await s.json();if(typeof o.ticket!="string"||typeof o.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:o.ticket,ttlMs:o.ttlMs}}function iL(e){return new WebSocket(e)}async function rL(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}var up={exports:{}},Rb;function sL(){return Rb||(Rb=1,(function(e,t){(function(i,s){e.exports=s()})(self,(()=>(()=>{var i={};return(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.FitAddon=void 0,s.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const f=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(f._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,f=o._renderService.dimensions;if(f.css.cell.width===0||f.css.cell.height===0)return;const p=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),d=Math.max(0,parseInt(c.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),g=h-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),S=d-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(S/f.css.cell.width)),rows:Math.max(1,Math.floor(g/f.css.cell.height))}}}})(),i})()))})(up)),up.exports}var aL=sL(),Vu={exports:{}},oL=Vu.exports,Lb;function lL(){return Lb||(Lb=1,(function(e,t){(function(i,s){e.exports=s()})(oL,(()=>(()=>{var i={433:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV11=void 0;const d=h(938),_=[[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]],g=[[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]],S=[[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]],C=[[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]];let T;function w(m,b){let v,x=0,k=b.length-1;if(m<b[0][0]||m>b[k][1])return!1;for(;k>=x;)if(v=x+k>>1,m>b[v][1])x=v+1;else{if(!(m<b[v][0]))return!0;k=v-1}return!1}c.UnicodeV11=class{constructor(){if(this.version="11",!T){T=new Uint8Array(65536),T.fill(1),T[0]=0,T.fill(0,1,32),T.fill(0,127,160);for(let m=0;m<_.length;++m)T.fill(0,_[m][0],_[m][1]+1);for(let m=0;m<S.length;++m)T.fill(2,S[m][0],S[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?T[m]:w(m,g)?0:w(m,C)?2:1}charProperties(m,b){let v=this.wcwidth(m),x=v===0&&b!==0;if(x){const k=d.UnicodeService.extractWidth(b);k===0?x=!1:k>v&&(v=k)}return d.UnicodeService.createPropertyValue(0,v,x)}}},345:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===h)return void this._listeners.splice(d,1)}}})),this._event}fire(h,d){const _=[];for(let g=0;g<this._listeners.length;g++)_.push(this._listeners[g]);for(let g=0;g<_.length;g++)_[g].call(void 0,h,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,d){return h((_=>d.fire(_)))},c.runAndSubscribe=function(h,d){return d(void 0),h((_=>d(_)))}},490:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const d=h(938),_=[[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]],g=[[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]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<_.length;++C)S.fill(0,_[C][0],_[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let m,b=0,v=w.length-1;if(T<w[0][0]||T>w[v][1])return!1;for(;v>=b;)if(m=b+v>>1,T>w[m][1])b=m+1;else{if(!(T<w[m][0]))return!0;v=m-1}return!1})(C,g)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),m=w===0&&T!==0;if(m){const b=d.UnicodeService.extractWidth(T);b===0?m=!1:b>w&&(w=b)}return d.UnicodeService.createPropertyValue(0,w,m)}}},938:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const d=h(345),_=h(490);class g{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,T,w=!1){return(16777215&C)<<3|(3&T)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;const C=new _.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let T=0,w=0;const m=C.length;for(let b=0;b<m;++b){let v=C.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=m)return T+this.wcwidth(v);const L=C.charCodeAt(b);56320<=L&&L<=57343?v=1024*(v-55296)+L-56320+65536:T+=this.wcwidth(L)}const x=this.charProperties(v,w);let k=g.extractWidth(x);g.extractShouldJoin(x)&&(k-=g.extractWidth(w)),T+=k,w=x}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}c.UnicodeService=g}},s={};function o(p){var c=s[p];if(c!==void 0)return c.exports;var h=s[p]={exports:{}};return i[p](h,h.exports,o),h.exports}var f={};return(()=>{var p=f;Object.defineProperty(p,"__esModule",{value:!0}),p.Unicode11Addon=void 0;const c=o(433);p.Unicode11Addon=class{activate(h){h.unicode.register(new c.UnicodeV11)}dispose(){}}})(),f})()))})(Vu)),Vu.exports}var cL=lL();var uL=(e,t,i,s)=>{for(var o=t,f=e.length-1,p;f>=0;f--)(p=e[f])&&(o=p(o)||o);return o},hL=(e,t)=>(i,s)=>t(i,s,e),dL=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Mb.isErrorNoTelemetry(e)?new Mb(e.message+`
12
+
13
+ `+e.stack):new Error(e.message+`
14
+
15
+ `+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)}},fL=new dL;function hp(e){pL(e)||fL.onUnexpectedError(e)}var Cg="Canceled";function pL(e){return e instanceof gL?!0:e instanceof Error&&e.name===Cg&&e.message===Cg}var gL=class extends Error{constructor(){super(Cg),this.name=this.message}},Mb=class Eg extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Eg)return t;let i=new Eg;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},mL;(e=>{function t(f){return f<0}e.isLessThan=t;function i(f){return f<=0}e.isLessThanOrEqual=i;function s(f){return f>0}e.isGreaterThan=s;function o(f){return f===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(mL||={});function _L(e,t){let i=this,s=!1,o;return function(){return s||(s=!0,t||(o=e.apply(i,arguments))),o}}var sw;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*o(k){yield k}e.single=o;function f(k){return t(k)?k:o(k)}e.wrap=f;function p(k){return k||i}e.from=p;function*c(k){for(let L=k.length-1;L>=0;L--)yield k[L]}e.reverse=c;function h(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=h;function d(k){return k[Symbol.iterator]().next().value}e.first=d;function _(k,L){let R=0;for(let N of k)if(L(N,R++))return!0;return!1}e.some=_;function g(k,L){for(let R of k)if(L(R))return R}e.find=g;function*S(k,L){for(let R of k)L(R)&&(yield R)}e.filter=S;function*C(k,L){let R=0;for(let N of k)yield L(N,R++)}e.map=C;function*T(k,L){let R=0;for(let N of k)yield*L(N,R++)}e.flatMap=T;function*w(...k){for(let L of k)yield*L}e.concat=w;function m(k,L,R){let N=R;for(let A of k)N=L(N,A);return N}e.reduce=m;function*b(k,L,R=k.length){for(L<0&&(L+=k.length),R<0?R+=k.length:R>k.length&&(R=k.length);L<R;L++)yield k[L]}e.slice=b;function v(k,L=Number.POSITIVE_INFINITY){let R=[];if(L===0)return[R,k];let N=k[Symbol.iterator]();for(let A=0;A<L;A++){let I=N.next();if(I.done)return[R,e.empty()];R.push(I.value)}return[R,{[Symbol.iterator](){return N}}]}e.consume=v;async function x(k){let L=[];for await(let R of k)L.push(R);return Promise.resolve(L)}e.asyncToArray=x})(sw||={});function aw(e){if(sw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ow(...e){return Wn(()=>aw(e))}function Wn(e){return{dispose:_L(()=>{e()})}}var lw=class cw{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{aw(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?cw.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)}};lw.DISABLE_DISPOSED_WARNING=!1;var uo=lw,sr=class{constructor(){this._store=new uo,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)}};sr.None=Object.freeze({dispose(){}});var xl=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}},Im=typeof process<"u"&&"title"in process,zh=Im?"node":navigator.userAgent,vL=Im?"node":navigator.platform,bL=zh.includes("Firefox"),yL=zh.includes("Edge"),uw=/^((?!chrome|android).)*safari/i.test(zh);function SL(){if(!uw)return 0;let e=zh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}vL.indexOf("Linux")>=0;var xL="",Tn=0,An=0,Rn=0,un=0,Fi={css:"#00000000",rgba:0},Zn;(e=>{function t(o,f,p,c){return c!==void 0?`#${Vs(o)}${Vs(f)}${Vs(p)}${Vs(c)}`:`#${Vs(o)}${Vs(f)}${Vs(p)}`}e.toCss=t;function i(o,f,p,c=255){return(o<<24|f<<16|p<<8|c)>>>0}e.toRgba=i;function s(o,f,p,c){return{css:e.toCss(o,f,p,c),rgba:e.toRgba(o,f,p,c)}}e.toColor=s})(Zn||={});var Dl;(e=>{function t(h,d){if(un=(d.rgba&255)/255,un===1)return{css:d.css,rgba:d.rgba};let _=d.rgba>>24&255,g=d.rgba>>16&255,S=d.rgba>>8&255,C=h.rgba>>24&255,T=h.rgba>>16&255,w=h.rgba>>8&255;Tn=C+Math.round((_-C)*un),An=T+Math.round((g-T)*un),Rn=w+Math.round((S-w)*un);let m=Zn.toCss(Tn,An,Rn),b=Zn.toRgba(Tn,An,Rn);return{css:m,rgba:b}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,d,_){let g=na.ensureContrastRatio(h.rgba,d.rgba,_);if(g)return Zn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=s;function o(h){let d=(h.rgba|255)>>>0;return[Tn,An,Rn]=na.toChannels(d),{css:Zn.toCss(Tn,An,Rn),rgba:d}}e.opaque=o;function f(h,d){return un=Math.round(d*255),[Tn,An,Rn]=na.toChannels(h.rgba),{css:Zn.toCss(Tn,An,Rn,un),rgba:Zn.toRgba(Tn,An,Rn,un)}}e.opacity=f;function p(h,d){return un=h.rgba&255,f(h,un*d/255)}e.multiplyOpacity=p;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(Dl||={});var wL;(e=>{let t,i;try{let o=document.createElement("canvas");o.width=1,o.height=1;let f=o.getContext("2d",{willReadFrequently:!0});f&&(t=f,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return Tn=parseInt(o.slice(1,2).repeat(2),16),An=parseInt(o.slice(2,3).repeat(2),16),Rn=parseInt(o.slice(3,4).repeat(2),16),Zn.toColor(Tn,An,Rn);case 5:return Tn=parseInt(o.slice(1,2).repeat(2),16),An=parseInt(o.slice(2,3).repeat(2),16),Rn=parseInt(o.slice(3,4).repeat(2),16),un=parseInt(o.slice(4,5).repeat(2),16),Zn.toColor(Tn,An,Rn,un);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let f=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(f)return Tn=parseInt(f[1]),An=parseInt(f[2]),Rn=parseInt(f[3]),un=Math.round((f[5]===void 0?1:parseFloat(f[5]))*255),Zn.toColor(Tn,An,Rn,un);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Tn,An,Rn,un]=t.getImageData(0,0,1,1).data,un!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Zn.toRgba(Tn,An,Rn,un),css:o}}e.toColor=s})(wL||={});var Vn;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,o,f){let p=s/255,c=o/255,h=f/255,d=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),_=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return d*.2126+_*.7152+g*.0722}e.relativeLuminance2=i})(Vn||={});var na;(e=>{function t(p,c){if(un=(c&255)/255,un===1)return c;let h=c>>24&255,d=c>>16&255,_=c>>8&255,g=p>>24&255,S=p>>16&255,C=p>>8&255;return Tn=g+Math.round((h-g)*un),An=S+Math.round((d-S)*un),Rn=C+Math.round((_-C)*un),Zn.toRgba(Tn,An,Rn)}e.blend=t;function i(p,c,h){let d=Vn.relativeLuminance(p>>8),_=Vn.relativeLuminance(c>>8);if(Ir(d,_)<h){if(_<d){let C=s(p,c,h),T=Ir(d,Vn.relativeLuminance(C>>8));if(T<h){let w=o(p,c,h),m=Ir(d,Vn.relativeLuminance(w>>8));return T>m?C:w}return C}let g=o(p,c,h),S=Ir(d,Vn.relativeLuminance(g>>8));if(S<h){let C=s(p,c,h),T=Ir(d,Vn.relativeLuminance(C>>8));return S>T?g:C}return g}}e.ensureContrastRatio=i;function s(p,c,h){let d=p>>24&255,_=p>>16&255,g=p>>8&255,S=c>>24&255,C=c>>16&255,T=c>>8&255,w=Ir(Vn.relativeLuminance2(S,C,T),Vn.relativeLuminance2(d,_,g));for(;w<h&&(S>0||C>0||T>0);)S-=Math.max(0,Math.ceil(S*.1)),C-=Math.max(0,Math.ceil(C*.1)),T-=Math.max(0,Math.ceil(T*.1)),w=Ir(Vn.relativeLuminance2(S,C,T),Vn.relativeLuminance2(d,_,g));return(S<<24|C<<16|T<<8|255)>>>0}e.reduceLuminance=s;function o(p,c,h){let d=p>>24&255,_=p>>16&255,g=p>>8&255,S=c>>24&255,C=c>>16&255,T=c>>8&255,w=Ir(Vn.relativeLuminance2(S,C,T),Vn.relativeLuminance2(d,_,g));for(;w<h&&(S<255||C<255||T<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),w=Ir(Vn.relativeLuminance2(S,C,T),Vn.relativeLuminance2(d,_,g));return(S<<24|C<<16|T<<8|255)>>>0}e.increaseLuminance=o;function f(p){return[p>>24&255,p>>16&255,p>>8&255,p&255]}e.toChannels=f})(na||={});function Vs(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ir(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function yn(e){if(!e)throw new Error("value must not be falsy");return e}function Bm(e){return 57508<=e&&e<=57558}function CL(e){return 57520<=e&&e<=57527}function EL(e){return 57344<=e&&e<=63743}function kL(e){return 9472<=e&&e<=9631}function TL(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 AL(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!TL(e)&&!Bm(e)&&!EL(e)}function hw(e){return Bm(e)||kL(e)}function RL(){return{css:{canvas:Eu(),cell:Eu()},device:{canvas:Eu(),cell:Eu(),char:{width:0,height:0,left:0,top:0}}}}function Eu(){return{width:0,height:0}}function LL(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Bn=0,kn=0,hr=!1,Br=!1,ku=!1,hi,dp=0,ML=class{constructor(e,t,i,s,o,f){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=o,this._themeService=f,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,kn=0,Bn=0,Br=!1,hr=!1,ku=!1,hi=this._themeService.colors,dp=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));dp=t*s%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",o=>{o.backgroundColorRGB&&(kn=o.backgroundColorRGB.rgba>>8&16777215,Br=!0),o.foregroundColorRGB&&(Bn=o.foregroundColorRGB.rgba>>8&16777215,hr=!0)}),ku=this._selectionRenderModel.isCellSelected(this._terminal,t,i),ku){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:kn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:kn=(this.result.fg&16777215)<<8|255;break;default:kn=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:kn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:kn=(this.result.bg&16777215)<<8|255;break}kn=na.blend(kn,(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else kn=(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Br=!0,hi.selectionForeground&&(Bn=hi.selectionForeground.rgba>>8&16777215,hr=!0),hw(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Bn=(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Bn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Bn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Bn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Bn=(this.result.fg&16777215)<<8|255;break;default:Bn=this._themeService.colors.foreground.rgba}Bn=na.blend(Bn,(this._coreBrowserService.isFocused?hi.selectionBackgroundOpaque:hi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}hr=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",o=>{o.backgroundColorRGB&&(kn=o.backgroundColorRGB.rgba>>8&16777215,Br=!0),o.foregroundColorRGB&&(Bn=o.foregroundColorRGB.rgba>>8&16777215,hr=!0)}),Br&&(ku?kn=e.bg&-16777216&-134217729|kn|50331648:kn=e.bg&-16777216|kn|50331648),hr&&(Bn=e.fg&-16777216&-67108865|Bn|50331648),this.result.fg&67108864&&(Br&&!hr&&((this.result.bg&50331648)===0?Bn=this.result.fg&-134217728|hi.background.rgba>>8&16777215&16777215|50331648:Bn=this.result.fg&-134217728|this.result.bg&67108863,hr=!0),!Br&&hr&&((this.result.fg&50331648)===0?kn=this.result.bg&-67108864|hi.foreground.rgba>>8&16777215&16777215|50331648:kn=this.result.bg&-67108864|this.result.fg&67108863,Br=!0)),hi=void 0,this.result.bg=Br?kn:this.result.bg,this.result.fg=hr?Bn:this.result.fg,this.result.ext&=536870911,this.result.ext|=dp<<29&3758096384}},NL=.5,dw=bL||yL?"bottom":"ideographic",OL={"▀":[{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}]},DL={"░":[[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]]},jL={"─":{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`}},Zl={"":{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}};Zl[""]=Zl[""];Zl[""]=Zl[""];function IL(e,t,i,s,o,f,p,c){let h=OL[t];if(h)return BL(e,h,i,s,o,f),!0;let d=DL[t];if(d)return PL(e,d,i,s,o,f),!0;let _=jL[t];if(_)return zL(e,_,i,s,o,f,c),!0;let g=Zl[t];return g?(HL(e,g,i,s,o,f,p,c),!0):!1}function BL(e,t,i,s,o,f){for(let p=0;p<t.length;p++){let c=t[p],h=o/8,d=f/8;e.fillRect(i+c.x*h,s+c.y*d,c.w*h,c.h*d)}}var Nb=new Map;function PL(e,t,i,s,o,f){let p=Nb.get(t);p||(p=new Map,Nb.set(t,p));let c=e.fillStyle;if(typeof c!="string")throw new Error(`Unexpected fillStyle type "${c}"`);let h=p.get(c);if(!h){let d=t[0].length,_=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=d,g.height=_;let S=yn(g.getContext("2d")),C=new ImageData(d,_),T,w,m,b;if(c.startsWith("#"))T=parseInt(c.slice(1,3),16),w=parseInt(c.slice(3,5),16),m=parseInt(c.slice(5,7),16),b=c.length>7&&parseInt(c.slice(7,9),16)||1;else if(c.startsWith("rgba"))[T,w,m,b]=c.substring(5,c.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${c}" when drawing pattern glyph`);for(let v=0;v<_;v++)for(let x=0;x<d;x++)C.data[(v*d+x)*4]=T,C.data[(v*d+x)*4+1]=w,C.data[(v*d+x)*4+2]=m,C.data[(v*d+x)*4+3]=t[v][x]*(b*255);S.putImageData(C,0,0),h=yn(e.createPattern(g,null)),p.set(c,h)}e.fillStyle=h,e.fillRect(i,s,o,f)}function zL(e,t,i,s,o,f,p){e.strokeStyle=e.fillStyle;for(let[c,h]of Object.entries(t)){e.beginPath(),e.lineWidth=p*Number.parseInt(c);let d;if(typeof h=="function"){let _=.15/f*o;d=h(.15,_)}else d=h;for(let _ of d.split(" ")){let g=_[0],S=fw[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let C=_.substring(1).split(",");!C[0]||!C[1]||S(e,pw(C,o,f,i,s,!0,p))}e.stroke(),e.closePath()}}function HL(e,t,i,s,o,f,p,c){let h=new Path2D;h.rect(i,s,o,f),e.clip(h),e.beginPath();let d=p/12;e.lineWidth=c*d;for(let _ of t.d.split(" ")){let g=_[0],S=fw[g];if(!S){console.error(`Could not find drawing instructions for "${g}"`);continue}let C=_.substring(1).split(",");!C[0]||!C[1]||S(e,pw(C,o,f,i,s,!1,c,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Ob(e,t,i=0){return Math.max(Math.min(e,t),i)}var fw={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 pw(e,t,i,s,o,f,p,c=0,h=0){let d=e.map(_=>parseFloat(_)||parseInt(_));if(d.length<2)throw new Error("Too few arguments for instruction");for(let _=0;_<d.length;_+=2)d[_]*=t-c*p-h*p,f&&d[_]!==0&&(d[_]=Ob(Math.round(d[_]+.5)-.5,t,0)),d[_]+=s+c*p;for(let _=1;_<d.length;_+=2)d[_]*=i,f&&d[_]!==0&&(d[_]=Ob(Math.round(d[_]+.5)-.5,i,0)),d[_]+=o;return d}var Db=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},jb=class{constructor(){this._data=new Db}set(e,t,i,s,o){this._data.get(e,t)||this._data.set(e,t,new Db),this._data.get(e,t).set(i,s,o)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},gw=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,i=0,s=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),o=e.timeRemaining(),i*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},$L=class extends gw{_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())}}},UL=class extends gw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},FL=!Im&&"requestIdleCallback"in window?UL:$L,io=class mw{constructor(){this.fg=0,this.bg=0,this.extended=new _w}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 mw;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}},_w=class vw{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 vw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},WL=globalThis.performance&&typeof globalThis.performance.now=="function",GL=class bw{static create(t){return new bw(t)}constructor(t){this._now=WL&&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}},Ur;(e=>{e.None=()=>sr.None;function t(G,B){return g(G,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function i(G){return(B,Y=null,W)=>{let z=!1,V;return V=G(X=>{if(!z)return V?V.dispose():z=!0,B.call(Y,X)},null,W),z&&V.dispose(),V}}e.once=i;function s(G,B,Y){return d((W,z=null,V)=>G(X=>W.call(z,B(X)),null,V),Y)}e.map=s;function o(G,B,Y){return d((W,z=null,V)=>G(X=>{B(X),W.call(z,X)},null,V),Y)}e.forEach=o;function f(G,B,Y){return d((W,z=null,V)=>G(X=>B(X)&&W.call(z,X),null,V),Y)}e.filter=f;function p(G){return G}e.signal=p;function c(...G){return(B,Y=null,W)=>{let z=ow(...G.map(V=>V(X=>B.call(Y,X))));return _(z,W)}}e.any=c;function h(G,B,Y,W){let z=Y;return s(G,V=>(z=B(z,V),z),W)}e.reduce=h;function d(G,B){let Y,W={onWillAddFirstListener(){Y=G(z.fire,z)},onDidRemoveLastListener(){Y?.dispose()}},z=new Gt(W);return B?.add(z),z.event}function _(G,B){return B instanceof Array?B.push(G):B&&B.add(G),G}function g(G,B,Y=100,W=!1,z=!1,V,X){let j,P,D,U=0,q,Q={leakWarningThreshold:V,onWillAddFirstListener(){j=G(ie=>{U++,P=B(P,ie),W&&!D&&(re.fire(P),P=void 0),q=()=>{let Z=P;P=void 0,D=void 0,(!W||U>1)&&re.fire(Z),U=0},typeof Y=="number"?(clearTimeout(D),D=setTimeout(q,Y)):D===void 0&&(D=0,queueMicrotask(q))})},onWillRemoveListener(){z&&U>0&&q?.()},onDidRemoveLastListener(){q=void 0,j.dispose()}},re=new Gt(Q);return X?.add(re),re.event}e.debounce=g;function S(G,B=0,Y){return e.debounce(G,(W,z)=>W?(W.push(z),W):[z],B,void 0,!0,void 0,Y)}e.accumulate=S;function C(G,B=(W,z)=>W===z,Y){let W=!0,z;return f(G,V=>{let X=W||!B(V,z);return W=!1,z=V,X},Y)}e.latch=C;function T(G,B,Y){return[e.filter(G,B,Y),e.filter(G,W=>!B(W),Y)]}e.split=T;function w(G,B=!1,Y=[],W){let z=Y.slice(),V=G(P=>{z?z.push(P):j.fire(P)});W&&W.add(V);let X=()=>{z?.forEach(P=>j.fire(P)),z=null},j=new Gt({onWillAddFirstListener(){V||(V=G(P=>j.fire(P)),W&&W.add(V))},onDidAddFirstListener(){z&&(B?setTimeout(X):X())},onDidRemoveLastListener(){V&&V.dispose(),V=null}});return W&&W.add(j),j.event}e.buffer=w;function m(G,B){return(Y,W,z)=>{let V=B(new v);return G(function(X){let j=V.evaluate(X);j!==b&&Y.call(W,j)},void 0,z)}}e.chain=m;let b=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(Y=>(B(Y),Y)),this}filter(B){return this.steps.push(Y=>B(Y)?Y:b),this}reduce(B,Y){let W=Y;return this.steps.push(z=>(W=B(W,z),W)),this}latch(B=(Y,W)=>Y===W){let Y=!0,W;return this.steps.push(z=>{let V=Y||!B(z,W);return Y=!1,W=z,V?z:b}),this}evaluate(B){for(let Y of this.steps)if(B=Y(B),B===b)break;return B}}function x(G,B,Y=W=>W){let W=(...j)=>X.fire(Y(...j)),z=()=>G.on(B,W),V=()=>G.removeListener(B,W),X=new Gt({onWillAddFirstListener:z,onDidRemoveLastListener:V});return X.event}e.fromNodeEventEmitter=x;function k(G,B,Y=W=>W){let W=(...j)=>X.fire(Y(...j)),z=()=>G.addEventListener(B,W),V=()=>G.removeEventListener(B,W),X=new Gt({onWillAddFirstListener:z,onDidRemoveLastListener:V});return X.event}e.fromDOMEventEmitter=k;function L(G){return new Promise(B=>i(G)(B))}e.toPromise=L;function R(G){let B=new Gt;return G.then(Y=>{B.fire(Y)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=R;function N(G,B){return G(Y=>B.fire(Y))}e.forward=N;function A(G,B,Y){return B(Y),G(W=>B(W))}e.runAndSubscribe=A;class I{constructor(B,Y){this._observable=B,this._counter=0,this._hasChanged=!1;let W={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new Gt(W),Y&&Y.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,Y){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function K(G,B){return new I(G,B).emitter.event}e.fromObservable=K;function F(G){return(B,Y,W)=>{let z=0,V=!1,X={beginUpdate(){z++},endUpdate(){z--,z===0&&(G.reportChanges(),V&&(V=!1,B.call(Y)))},handlePossibleChange(){},handleChange(){V=!0}};G.addObserver(X),G.reportChanges();let j={dispose(){G.removeObserver(X)}};return W instanceof uo?W.add(j):Array.isArray(W)&&W.push(j),j}}e.fromObservableLight=F})(Ur||={});var kg=class Tg{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Tg._idPool++}`,Tg.all.add(this)}start(t){this._stopWatch=new GL,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}}};kg.all=new Set,kg._idPool=0;var qL=kg,KL=-1,yw=class Sw{constructor(t,i,s=(Sw._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[f,p]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${p}):`;console.warn(c),console.warn(f);let h=new XL(c,f);this._errorHandler(h)}return()=>{let f=this._stacks.get(t.value)||0;this._stacks.set(t.value,f-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,o]of this._stacks)(!t||i<o)&&(t=[s,o],i=o);return t}};yw._idPool=1;var VL=yw,YL=class xw{constructor(t){this.value=t}static create(){let t=new Error;return new xw(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},XL=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ZL=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},JL=0,fp=class{constructor(t){this.value=t,this.id=JL++}},QL=2,eM,Gt=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new VL(t?.onListenerError??hp,this._options?.leakWarningThreshold??KL):void 0,this._perfMon=this._options?._profName?new qL(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,i,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let c=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(c);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new ZL(`${c}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||hp)(d),sr.None}if(this._disposed)return sr.None;i&&(t=t.bind(i));let o=new fp(t),f;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=YL.create(),f=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof fp?(this._deliveryQueue??=new tM,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let p=Wn(()=>{f?.(),this._removeListener(o)});return s instanceof uo?s.add(p):Array.isArray(s)&&s.push(p),p},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 i=this._listeners,s=i.indexOf(t);if(s===-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--,i[s]=void 0;let o=this._deliveryQueue.current===this;if(this._size*QL<=i.length){let f=0;for(let p=0;p<i.length;p++)i[p]?i[f++]=i[p]:o&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=f}}_deliver(t,i){if(!t)return;let s=this._options?.onListenerError||hp;if(!s){t.value(i);return}try{t.value(i)}catch(o){s(o)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[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 fp)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},tM=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ib={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}},wl=2,Cl,Ss=class Ja{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new jb,this._cacheMapCombined=new jb,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new io,this._textureSize=512,this._onAddTextureAtlasCanvas=new Gt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Gt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=ww(t,this._config.deviceCellWidth*4+wl*2,this._config.deviceCellHeight+wl*2),this._tmpCtx=yn(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 FL;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}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(Ja.maxAtlasPages&&this._pages.length>=Math.max(4,Ja.maxAtlasPages)){let i=this._pages.filter(d=>d.canvas.width*2<=(Ja.maxTextureSize||4096)).sort((d,_)=>_.canvas.width!==d.canvas.width?_.canvas.width-d.canvas.width:_.percentageUsed-d.percentageUsed),s=-1,o=0;for(let d=0;d<i.length;d++)if(i[d].canvas.width!==o)s=d,o=i[d].canvas.width;else if(d-s===3)break;let f=i.slice(s,s+4),p=f.map(d=>d.glyphs[0].texturePage).sort((d,_)=>d>_?1:-1),c=this.pages.length-f.length,h=this._mergePages(f,c);h.version++;for(let d=p.length-1;d>=0;d--)this._deletePage(p[d]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new pp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let s=t[0].canvas.width*2,o=new pp(this._document,s,t);for(let[f,p]of t.entries()){let c=f*p.canvas.width%s,h=Math.floor(f/2)*p.canvas.height;o.ctx.drawImage(p.canvas,c,h);for(let _ of p.glyphs)_.texturePage=i,_.sizeClipSpace.x=_.size.x/s,_.sizeClipSpace.y=_.size.y/s,_.texturePosition.x+=c,_.texturePosition.y+=h,_.texturePositionClipSpace.x=_.texturePosition.x/s,_.texturePositionClipSpace.y=_.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(p.canvas);let d=this._activePages.indexOf(p);d!==-1&&this._activePages.splice(d,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let o of s.glyphs)o.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,o,f,p){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,o,f,p)}getRasterizedGlyph(t,i,s,o,f,p){return this._getFromCacheMap(this._cacheMap,t,i,s,o,f,p)}_getFromCacheMap(t,i,s,o,f,p,c){return Cl=t.get(i,s,o,f),Cl||(Cl=this._drawToCache(i,s,o,f,p,c),t.set(i,s,o,f,Cl)),Cl}_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,i,s,o){if(this._config.allowTransparency)return Fi;let f;switch(t){case 16777216:case 33554432:f=this._getColorFromAnsiIndex(i);break;case 50331648:let p=io.toColorRGB(i);f=Zn.toColor(p[0],p[1],p[2]);break;default:s?f=Dl.opaque(this._config.colors.foreground):f=this._config.colors.background;break}return this._config.allowTransparency||(f=Dl.opaque(f)),f}_getForegroundColor(t,i,s,o,f,p,c,h,d,_){let g=this._getMinimumContrastColor(t,i,s,o,f,p,c,d,h,_);if(g)return g;let S;switch(f){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&p<8&&(p+=8),S=this._getColorFromAnsiIndex(p);break;case 50331648:let C=io.toColorRGB(p);S=Zn.toColor(C[0],C[1],C[2]);break;default:c?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Dl.opaque(S)),h&&(S=Dl.multiplyOpacity(S,NL)),S}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,s,o,f,p,c,h,d,_){if(this._config.minimumContrastRatio===1||_)return;let g=this._getContrastCache(d),S=g.getColor(t,o);if(S!==void 0)return S||void 0;let C=this._resolveBackgroundRgba(i,s,c),T=this._resolveForegroundRgba(f,p,c,h),w=na.ensureContrastRatio(C,T,this._config.minimumContrastRatio/(d?2:1));if(!w){g.setColor(t,o,null);return}let m=Zn.toColor(w>>24&255,w>>16&255,w>>8&255);return g.setColor(t,o,m),m}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,o,f,p){let c=typeof t=="number"?String.fromCharCode(t):t;p&&this._tmpCanvas.parentElement!==p&&(this._tmpCanvas.style.display="none",p.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+wl*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let d=Math.min(this._config.deviceCellHeight+wl*4,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return Ib;let _=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),C=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),w=!!this._workAttributeData.isStrikethrough(),m=!!this._workAttributeData.isOverline(),b=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),x=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(g){let P=b;b=x,x=P;let D=v;v=k,k=D}let L=this._getBackgroundColor(k,x,g,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let R=_?this._config.fontWeightBold:this._config.fontWeight,N=C?"italic":"";this._tmpCtx.font=`${N} ${R} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=dw;let A=c.length===1&&Bm(c.charCodeAt(0)),I=c.length===1&&CL(c.charCodeAt(0)),K=this._getForegroundColor(i,k,x,s,v,b,g,S,_,hw(c.charCodeAt(0)));this._tmpCtx.fillStyle=K.css;let F=I?0:wl*2,G=!1;this._config.customGlyphs!==!1&&(G=IL(this._tmpCtx,c,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!A,Y;if(typeof t=="number"?Y=this._unicodeService.wcwidth(t):Y=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=P%2===1?.5:0;if(this._tmpCtx.lineWidth=P,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${io.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let Z=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Z<8&&(Z+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Z).css}this._tmpCtx.beginPath();let U=F,q=Math.ceil(F+this._config.deviceCharHeight)-D-(f?P*2:0),Q=q+P,re=q+P*2,ie=this._workAttributeData.getUnderlineVariantOffset();for(let Z=0;Z<Y;Z++){this._tmpCtx.save();let H=U+Z*this._config.deviceCellWidth,oe=U+(Z+1)*this._config.deviceCellWidth,fe=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,q),this._tmpCtx.lineTo(oe,q),this._tmpCtx.moveTo(H,re),this._tmpCtx.lineTo(oe,re);break;case 3:let Se=P<=1?re:Math.ceil(F+this._config.deviceCharHeight-P/2)-D,ye=P<=1?q:Math.ceil(F+this._config.deviceCharHeight+P/2)-D,De=new Path2D;De.rect(H,q,this._config.deviceCellWidth,re-q),this._tmpCtx.clip(De),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,Q),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ye,H,ye,H,Q),this._tmpCtx.bezierCurveTo(H,Se,fe,Se,fe,Q),this._tmpCtx.bezierCurveTo(fe,ye,oe,ye,oe,Q),this._tmpCtx.bezierCurveTo(oe,Se,oe+this._config.deviceCellWidth/2,Se,oe+this._config.deviceCellWidth/2,Q);break;case 4:let Fe=ie===0?0:ie>=P?P*2-ie:P-ie;ie>=P||Fe===0?(this._tmpCtx.setLineDash([Math.round(P),Math.round(P)]),this._tmpCtx.moveTo(H+Fe,q),this._tmpCtx.lineTo(oe,q)):(this._tmpCtx.setLineDash([Math.round(P),Math.round(P)]),this._tmpCtx.moveTo(H,q),this._tmpCtx.lineTo(H+Fe,q),this._tmpCtx.moveTo(H+Fe+P,q),this._tmpCtx.lineTo(oe,q)),ie=LL(oe-H,P,ie);break;case 5:let Be=.6,Ke=.3,ke=oe-H,dt=Math.floor(Be*ke),Pt=Math.floor(Ke*ke),Ct=ke-dt-Pt;this._tmpCtx.setLineDash([dt,Pt,Ct]),this._tmpCtx.moveTo(H,q),this._tmpCtx.lineTo(oe,q);break;default:this._tmpCtx.moveTo(H,q),this._tmpCtx.lineTo(oe,q);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!G&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Z=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Z&&Z.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(U,q-Math.ceil(P/2),this._config.deviceCellWidth*Y,re-q+Math.ceil(P/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(c,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(m){let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=P%2===1?.5:0;this._tmpCtx.lineWidth=P,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*Y,F+D),this._tmpCtx.stroke()}if(G||this._tmpCtx.fillText(c,F,F+this._config.deviceCharHeight),c==="_"&&!this._config.allowTransparency){let P=gp(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),L,K,B);if(P)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,F,F+this._config.deviceCharHeight-D),P=gp(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),L,K,B),!!P);D++);}if(w){let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=P,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*Y,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let W=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),z;if(this._config.allowTransparency?z=nM(W):z=gp(W,L,K,B),z)return Ib;let V=this._findGlyphBoundingBox(W,this._workBoundingBox,h,I,G,F),X,j;for(;;){if(this._activePages.length===0){let P=this._createNewPage();X=P,j=P.currentRow,j.height=V.size.y;break}X=this._activePages[this._activePages.length-1],j=X.currentRow;for(let P of this._activePages)V.size.y<=P.currentRow.height&&(X=P,j=P.currentRow);for(let P=this._activePages.length-1;P>=0;P--)for(let D of this._activePages[P].fixedRows)D.height<=j.height&&V.size.y<=D.height&&(X=this._activePages[P],j=D);if(V.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new pp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),X=this._overflowSizePage,j=this._overflowSizePage.currentRow,j.x+V.size.x>=X.canvas.width&&(j.x=0,j.y+=j.height,j.height=0);break}if(j.y+V.size.y>=X.canvas.height||j.height>V.size.y+2){let P=!1;if(X.currentRow.y+X.currentRow.height+V.size.y>=X.canvas.height){let D;for(let U of this._activePages)if(U.currentRow.y+U.currentRow.height+V.size.y<U.canvas.height){D=U;break}if(D)X=D;else if(Ja.maxAtlasPages&&this._pages.length>=Ja.maxAtlasPages&&j.y+V.size.y<=X.canvas.height&&j.height>=V.size.y&&j.x+V.size.x<=X.canvas.width)P=!0;else{let U=this._createNewPage();X=U,j=U.currentRow,j.height=V.size.y,P=!0}}P||(X.currentRow.height>0&&X.fixedRows.push(X.currentRow),j={x:0,y:X.currentRow.y+X.currentRow.height,height:V.size.y},X.fixedRows.push(j),X.currentRow={x:0,y:j.y+j.height,height:0})}if(j.x+V.size.x<=X.canvas.width)break;j===X.currentRow?(j.x=0,j.y+=j.height,j.height=0):X.fixedRows.splice(X.fixedRows.indexOf(j),1)}return V.texturePage=this._pages.indexOf(X),V.texturePosition.x=j.x,V.texturePosition.y=j.y,V.texturePositionClipSpace.x=j.x/X.canvas.width,V.texturePositionClipSpace.y=j.y/X.canvas.height,V.sizeClipSpace.x/=X.canvas.width,V.sizeClipSpace.y/=X.canvas.height,j.height=Math.max(j.height,V.size.y),j.x+=V.size.x,X.ctx.putImageData(W,V.texturePosition.x-this._workBoundingBox.left,V.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,V.size.x,V.size.y),X.addGlyph(V),X.version++,V}_findGlyphBoundingBox(t,i,s,o,f,p){i.top=0;let c=o?this._config.deviceCellHeight:this._tmpCanvas.height,h=o?this._config.deviceCellWidth:s,d=!1;for(let _=0;_<c;_++){for(let g=0;g<h;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.top=_,d=!0;break}}if(d)break}i.left=0,d=!1;for(let _=0;_<p+h;_++){for(let g=0;g<c;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.left=_,d=!0;break}}if(d)break}i.right=h,d=!1;for(let _=p+h-1;_>=p;_--){for(let g=0;g<c;g++){let S=g*this._tmpCanvas.width*4+_*4+3;if(t.data[S]!==0){i.right=_,d=!0;break}}if(d)break}i.bottom=c,d=!1;for(let _=c-1;_>=0;_--){for(let g=0;g<h;g++){let S=_*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.bottom=_,d=!0;break}}if(d)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+p+(o||f?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+p+(o||f?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},pp=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=ww(e,t,t),this.ctx=yn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.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 gp(e,t,i,s){let o=t.rgba>>>24,f=t.rgba>>>16&255,p=t.rgba>>>8&255,c=i.rgba>>>24,h=i.rgba>>>16&255,d=i.rgba>>>8&255,_=Math.floor((Math.abs(o-c)+Math.abs(f-h)+Math.abs(p-d))/12),g=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===o&&e.data[S+1]===f&&e.data[S+2]===p||s&&Math.abs(e.data[S]-o)+Math.abs(e.data[S+1]-f)+Math.abs(e.data[S+2]-p)<_?e.data[S+3]=0:g=!1;return g}function nM(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function ww(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function iM(e,t,i,s,o,f,p,c){let h={foreground:f.foreground,background:f.background,cursor:Fi,cursorAccent:Fi,selectionForeground:Fi,selectionBackgroundTransparent:Fi,selectionBackgroundOpaque:Fi,selectionInactiveBackgroundTransparent:Fi,selectionInactiveBackgroundOpaque:Fi,overviewRulerBorder:Fi,scrollbarSliderBackground:Fi,scrollbarSliderHoverBackground:Fi,scrollbarSliderActiveBackground:Fi,ansi:f.ansi.slice(),contrastCache:f.contrastCache,halfContrastCache:f.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:p,deviceMaxTextureSize:c,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:h}}function Bb(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].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 rM(e){return(e&50331648)===16777216||(e&50331648)===33554432}var qi=[];function Cw(e,t,i,s,o,f,p,c,h){let d=iM(s,o,f,p,t,i,c,h);for(let S=0;S<qi.length;S++){let C=qi[S],T=C.ownedBy.indexOf(e);if(T>=0){if(Bb(C.config,d))return C.atlas;C.ownedBy.length===1?(C.atlas.dispose(),qi.splice(S,1)):C.ownedBy.splice(T,1);break}}for(let S=0;S<qi.length;S++){let C=qi[S];if(Bb(C.config,d))return C.ownedBy.push(e),C.atlas}let _=e._core,g={atlas:new Ss(document,d,_.unicodeService),config:d,ownedBy:[e]};return qi.push(g),g.atlas}function Pb(e){for(let t=0;t<qi.length;t++){let i=qi[t].ownedBy.indexOf(e);if(i!==-1){qi[t].ownedBy.length===1?(qi[t].atlas.dispose(),qi.splice(t,1)):qi[t].ownedBy.splice(i,1);break}}}var Tu=600,sM=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=Tu){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Tu-(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=Tu-(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})},Tu)},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 zb(e,t,i){let s=new t.ResizeObserver(o=>{let f=o.find(h=>h.target===e);if(!f)return;if(!("devicePixelContentBoxSize"in f)){s?.disconnect(),s=void 0;return}let p=f.devicePixelContentBoxSize[0].inlineSize,c=f.devicePixelContentBoxSize[0].blockSize;p>0&&c>0&&i(p,c)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Wn(()=>s?.disconnect())}function aM(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Hb=class Ew extends io{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _w,this.combinedData=""}static fromCharData(t){let i=new Ew;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?aM(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},kw=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function Tw(e,t,i){let s=yn(e.createProgram());if(e.attachShader(s,yn($b(e,e.VERTEX_SHADER,t))),e.attachShader(s,yn($b(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function $b(e,t,i){let s=yn(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function oM(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let o=0;o<e.length;o++)s[o]=e[o];return s}var lM=class{constructor(e){this.texture=e,this.version=-1}},cM=`#version 300 es
18
+ layout (location = 0) in vec2 a_unitquad;
19
+ layout (location = 1) in vec2 a_cellpos;
20
+ layout (location = 2) in vec2 a_offset;
21
+ layout (location = 3) in vec2 a_size;
22
+ layout (location = 4) in float a_texpage;
23
+ layout (location = 5) in vec2 a_texcoord;
24
+ layout (location = 6) in vec2 a_texsize;
25
+
26
+ uniform mat4 u_projection;
27
+ uniform vec2 u_resolution;
28
+
29
+ out vec2 v_texcoord;
30
+ flat out int v_texpage;
31
+
32
+ void main() {
33
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
34
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
35
+ v_texpage = int(a_texpage);
36
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
37
+ }`;function uM(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
38
+ precision lowp float;
39
+
40
+ in vec2 v_texcoord;
41
+ flat in int v_texpage;
42
+
43
+ uniform sampler2D u_texture[${e}];
44
+
45
+ out vec4 outColor;
46
+
47
+ void main() {
48
+ if (v_texpage == 0) {
49
+ outColor = texture(u_texture[0], v_texcoord);
50
+ } ${t}
51
+ }`}var xs=11,qa=xs*Float32Array.BYTES_PER_ELEMENT,hM=2,on=0,Wt,mp=0,El=0,dM=class extends sr{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;Ss.maxAtlasPages===void 0&&(Ss.maxAtlasPages=Math.min(32,yn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),Ss.maxTextureSize=yn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=yn(Tw(o,cM,uM(Ss.maxAtlasPages))),this._register(Wn(()=>o.deleteProgram(this._program))),this._projectionLocation=yn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=yn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=yn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let f=new Float32Array([0,0,1,0,0,1,1,1]),p=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(p))),o.bindBuffer(o.ARRAY_BUFFER,p),o.bufferData(o.ARRAY_BUFFER,f,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,c,o.STATIC_DRAW),this._attributesBuffer=yn(o.createBuffer()),this._register(Wn(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,qa,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,qa,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,qa,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,qa,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,qa,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,qa,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let d=new Int32Array(Ss.maxAtlasPages);for(let _=0;_<Ss.maxAtlasPages;_++)d[_]=_;o.uniform1iv(this._textureLocation,d),o.uniformMatrix4fv(this._projectionLocation,!1,kw),this._atlasTextures=[];for(let _=0;_<Ss.maxAtlasPages;_++){let g=new lM(yn(o.createTexture()));this._register(Wn(()=>o.deleteTexture(g.texture))),o.activeTexture(o.TEXTURE0+_),o.bindTexture(o.TEXTURE_2D,g.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[_]=g}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(e,t,i,s,o,f,p,c,h){this._updateCell(this._vertices.attributes,e,t,i,s,o,f,p,c,h)}_updateCell(e,t,i,s,o,f,p,c,h,d){if(on=(i*this._terminal.cols+t)*xs,s===0||s===void 0){e.fill(0,on,on+xs-1-hM);return}this._atlas&&(c&&c.length>1?Wt=this._atlas.getRasterizedGlyphCombinedChar(c,o,f,p,!1,this._terminal.element):Wt=this._atlas.getRasterizedGlyph(s,o,f,p,!1,this._terminal.element),mp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==d&&Wt.offset.x>mp?(El=Wt.offset.x-mp,e[on]=-(Wt.offset.x-El)+this._dimensions.device.char.left,e[on+1]=-Wt.offset.y+this._dimensions.device.char.top,e[on+2]=(Wt.size.x-El)/this._dimensions.device.canvas.width,e[on+3]=Wt.size.y/this._dimensions.device.canvas.height,e[on+4]=Wt.texturePage,e[on+5]=Wt.texturePositionClipSpace.x+El/this._atlas.pages[Wt.texturePage].canvas.width,e[on+6]=Wt.texturePositionClipSpace.y,e[on+7]=Wt.sizeClipSpace.x-El/this._atlas.pages[Wt.texturePage].canvas.width,e[on+8]=Wt.sizeClipSpace.y):(e[on]=-Wt.offset.x+this._dimensions.device.char.left,e[on+1]=-Wt.offset.y+this._dimensions.device.char.top,e[on+2]=Wt.size.x/this._dimensions.device.canvas.width,e[on+3]=Wt.size.y/this._dimensions.device.canvas.height,e[on+4]=Wt.texturePage,e[on+5]=Wt.texturePositionClipSpace.x,e[on+6]=Wt.texturePositionClipSpace.y,e[on+7]=Wt.sizeClipSpace.x,e[on+8]=Wt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&AL(s,h,Wt.size.x,this._dimensions.device.cell.width)&&(e[on+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*xs;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let s=0;s<e.rows;s++)for(let o=0;o<e.cols;o++)this._vertices.attributes[i+9]=o/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=xs}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<e.lineLengths.length;o++){let f=o*this._terminal.cols*xs,p=this._vertices.attributes.subarray(f,f+e.lineLengths[o]*xs);i.set(p,s),s+=p.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(t,this._atlas,o);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/xs)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},fM=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let o=e.buffers.active.ydisp,f=t[1]-o,p=i[1]-o,c=Math.max(f,0),h=Math.min(p,e.rows-1);if(c>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=f,this.viewportEndRow=p,this.viewportCappedStartRow=c,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function pM(){return new fM}var dh=4,Yu=1,Xu=2,_p=3,gM=2147483648,mM=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=pM()}resize(e,t){let i=e*t*dh;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},_M=`#version 300 es
52
+ layout (location = 0) in vec2 a_position;
53
+ layout (location = 1) in vec2 a_size;
54
+ layout (location = 2) in vec4 a_color;
55
+ layout (location = 3) in vec2 a_unitquad;
56
+
57
+ uniform mat4 u_projection;
58
+
59
+ out vec4 v_color;
60
+
61
+ void main() {
62
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
63
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
64
+ v_color = a_color;
65
+ }`,vM=`#version 300 es
66
+ precision lowp float;
67
+
68
+ in vec4 v_color;
69
+
70
+ out vec4 outColor;
71
+
72
+ void main() {
73
+ outColor = v_color;
74
+ }`,Hr=8,vp=Hr*Float32Array.BYTES_PER_ELEMENT,bM=20*Hr,Ub=class{constructor(){this.attributes=new Float32Array(bM),this.count=0}},Pr=0,Fb=0,Wb=0,Gb=0,qb=0,Kb=0,Vb=0,yM=class extends sr{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new Ub,this._verticesCursor=new Ub;let o=this._gl;this._program=yn(Tw(o,_M,vM)),this._register(Wn(()=>o.deleteProgram(this._program))),this._projectionLocation=yn(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let f=new Float32Array([0,0,1,0,0,1,1,1]),p=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(p))),o.bindBuffer(o.ARRAY_BUFFER,p),o.bufferData(o.ARRAY_BUFFER,f,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,c,o.STATIC_DRAW),this._attributesBuffer=yn(o.createBuffer()),this._register(Wn(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,vp,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,vp,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,vp,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),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,kw),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,i=this._vertices,s=1,o,f,p,c,h,d,_,g,S,C,T;for(o=0;o<t.rows;o++){for(p=-1,c=0,h=0,d=!1,f=0;f<t.cols;f++)_=(o*t.cols+f)*dh,g=e.cells[_+Yu],S=e.cells[_+Xu],C=!!(S&67108864),(g!==c||S!==h&&(d||C))&&((c!==0||d&&h!==0)&&(T=s++*Hr,this._updateRectangle(i,T,h,c,p,f,o)),p=f,c=g,h=S,d=C);(c!==0||d&&h!==0)&&(T=s++*Hr,this._updateRectangle(i,T,h,c,p,t.cols,o))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,o=0;(i.style==="bar"||i.style==="outline")&&(s=o++*Hr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=o++*Hr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=o++*Hr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=o++*Hr,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=o}_updateRectangle(e,t,i,s,o,f,p){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Pr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Pr=(i&16777215)<<8;break;default:Pr=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Pr=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Pr=(s&16777215)<<8;break;default:Pr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=oM(e.attributes,this._terminal.rows*this._terminal.cols*Hr)),Fb=o*this._dimensions.device.cell.width,Wb=p*this._dimensions.device.cell.height,Gb=(Pr>>24&255)/255,qb=(Pr>>16&255)/255,Kb=(Pr>>8&255)/255,Vb=1,this._addRectangle(e.attributes,t,Fb,Wb,(f-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Gb,qb,Kb,Vb)}_addRectangle(e,t,i,s,o,f,p,c,h,d){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=f/this._dimensions.device.canvas.height,e[t+4]=p,e[t+5]=c,e[t+6]=h,e[t+7]=d}_addRectangleFloat(e,t,i,s,o,f,p){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=f/this._dimensions.device.canvas.height,e[t+4]=p[0],e[t+5]=p[1],e[t+6]=p[2],e[t+7]=p[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])}},SM=class extends sr{constructor(e,t,i,s,o,f,p,c){super(),this._container=t,this._alpha=o,this._coreBrowserService=f,this._optionsService=p,this._themeService=c,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(e,h),this.reset(e)})),this._register(Wn(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=yn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Cw(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+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(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=dw,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},xM=class extends SM{constructor(e,t,i,s,o,f,p){super(i,e,"link",t,!0,o,f,p),this._register(s.onShowLinkUnderline(c=>this._handleShowLinkUnderline(c))),this._register(s.onHideLinkUnderline(c=>this._handleHideLinkUnderline(c)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&rM(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},Js=typeof window=="object"?window:globalThis,Ag=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Gt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Gt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Ag.INSTANCE=new Ag;var Aw=Ag;function wM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Aw.INSTANCE.onDidChangeZoomLevel;Aw.INSTANCE.onDidChangeFullscreen;var Co=typeof navigator=="object"?navigator.userAgent:"";Co.indexOf("Firefox")>=0;Co.indexOf("AppleWebKit")>=0;var CM=Co.indexOf("Chrome")>=0;!CM&&Co.indexOf("Safari")>=0;Co.indexOf("Electron/")>=0;Co.indexOf("Android")>=0;var bp=!1;if(typeof Js.matchMedia=="function"){let e=Js.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Js.matchMedia("(display-mode: fullscreen)");bp=e.matches,wM(Js,e,({matches:i})=>{bp&&t.matches||(bp=i)})}var ro="en",yp=!1,Rw=!1,Au,Zu=ro,Yb=ro,EM,zr,ia=globalThis,ki;typeof ia.vscode<"u"&&typeof ia.vscode.process<"u"?ki=ia.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ki=process);var kM=typeof ki?.versions?.electron=="string",TM=kM&&ki?.type==="renderer";if(typeof ki=="object"){ki.platform,ki.platform,yp=ki.platform==="linux",yp&&ki.env.SNAP&&ki.env.SNAP_REVISION,ki.env.CI||ki.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Au=ro,Zu=ro;let e=ki.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Au=t.userLocale,Yb=t.osLocale,Zu=t.resolvedLanguage||ro,EM=t.languagePack?.translationsConfigFile}catch{}Rw=!0}else typeof navigator=="object"&&!TM?(zr=navigator.userAgent,zr.indexOf("Windows")>=0,zr.indexOf("Macintosh")>=0,(zr.indexOf("Macintosh")>=0||zr.indexOf("iPad")>=0||zr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,yp=zr.indexOf("Linux")>=0,zr?.indexOf("Mobi")>=0,Zu=globalThis._VSCODE_NLS_LANGUAGE||ro,Au=navigator.language.toLowerCase(),Yb=Au):console.error("Unable to resolve platform.");var Xb=Rw,mr=zr,vs=Zu,AM;(e=>{function t(){return vs}e.value=t;function i(){return vs.length===2?vs==="en":vs.length>=3?vs[0]==="e"&&vs[1]==="n"&&vs[2]==="-":!1}e.isDefaultVariant=i;function s(){return vs==="en"}e.isDefault=s})(AM||={});var RM=typeof ia.postMessage=="function"&&!ia.importScripts;(()=>{if(RM){let e=[];ia.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,o=e.length;s<o;s++){let f=e[s];if(f.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),f.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),ia.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var LM=!!(mr&&mr.indexOf("Chrome")>=0);mr&&mr.indexOf("Firefox")>=0;!LM&&mr&&mr.indexOf("Safari")>=0;mr&&mr.indexOf("Edg/")>=0;mr&&mr.indexOf("Android")>=0;var Ka=typeof navigator=="object"?navigator:{};Xb||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ka&&Ka.clipboard&&Ka.clipboard.writeText,Xb||Ka&&Ka.clipboard&&Ka.clipboard.readText;var Pm=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}},Sp=new Pm,Zb=new Pm,Jb=new Pm;new Array(230);var MM;(e=>{function t(c){return Sp.keyCodeToStr(c)}e.toString=t;function i(c){return Sp.strToKeyCode(c)}e.fromString=i;function s(c){return Zb.keyCodeToStr(c)}e.toUserSettingsUS=s;function o(c){return Jb.keyCodeToStr(c)}e.toUserSettingsGeneral=o;function f(c){return Zb.strToKeyCode(c)||Jb.strToKeyCode(c)}e.fromUserSettings=f;function p(c){if(c>=98&&c<=113)return null;switch(c){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Sp.keyCodeToStr(c)}e.toElectronAccelerator=p})(MM||={});var Lw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),NM;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof OM?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ur.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Lw})})(NM||={});var OM=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?Lw:(this._emitter||(this._emitter=new Gt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},DM;(e=>{async function t(s){let o,f=await Promise.all(s.map(p=>p.then(c=>c,c=>{o||(o=c)})));if(typeof o<"u")throw o;return f}e.settled=t;function i(s){return new Promise(async(o,f)=>{try{await s(o,f)}catch(p){f(p)}})}e.withAsyncBody=i})(DM||={});var Qb=class Wi{static fromArray(t){return new Wi(i=>{i.emitMany(t)})}static fromPromise(t){return new Wi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Wi(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Wi(async i=>{await Promise.all(t.map(async s=>{for await(let o of s)i.emitOne(o)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Gt,queueMicrotask(async()=>{let s={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(s)),this.resolve()}catch(o){this.reject(o)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ur.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Wi(async s=>{for await(let o of t)s.emitOne(i(o))})}map(t){return Wi.map(this,t)}static filter(t,i){return new Wi(async s=>{for await(let o of t)i(o)&&s.emitOne(o)})}filter(t){return Wi.filter(this,t)}static coalesce(t){return Wi.filter(t,i=>!!i)}coalesce(){return Wi.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Wi.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())}};Qb.EMPTY=Qb.fromArray([]);var{getWindow:jM}=(function(){let e=new Map,t={window:Js,disposables:new uo};e.set(Js.vscodeWindowId,t);let i=new Gt,s=new Gt,o=new Gt;function f(p,c){return(typeof p=="number"?e.get(p):void 0)??(c?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:s.event,registerWindow(p){if(e.has(p.vscodeWindowId))return sr.None;let c=new uo,h={window:p,disposables:c.add(new uo)};return e.set(p.vscodeWindowId,h),c.add(Wn(()=>{e.delete(p.vscodeWindowId),s.fire(p)})),c.add(Rg(p,BM.BEFORE_UNLOAD,()=>{o.fire(p)})),i.fire(h),c},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(p){return p.vscodeWindowId},hasWindow(p){return e.has(p)},getWindowById:f,getWindow(p){let c=p;if(c?.ownerDocument?.defaultView)return c.ownerDocument.defaultView.window;let h=p;return h?.view?h.view.window:Js},getDocument(p){return jM(p).document}}})(),IM=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Rg(e,t,i,s){return new IM(e,t,i,s)}var BM={BEFORE_UNLOAD:"beforeunload"},PM=class extends sr{constructor(e,t,i,s,o,f,p,c,h){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=f,this._optionsService=p,this._themeService=c,this._cursorBlinkStateManager=new xl,this._charAtlasDisposable=this._register(new xl),this._observerDisposable=this._register(new xl),this._model=new mM,this._workCell=new Hb,this._workCell2=new Hb,this._rectangleRenderer=this._register(new xl),this._glyphRenderer=this._register(new xl),this._onChangeTextureAtlas=this._register(new Gt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Gt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Gt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Gt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Gt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ML(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new xM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,p,this._themeService)],this.dimensions=RL(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(p.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Rg(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(Rg(this._canvas,"webglcontextrestored",_=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Pb(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=zb(this._canvas,this._coreBrowserService.window,(_,g)=>this._setCanvasDevicePixelDimensions(_,g)),this._register(this._coreBrowserService.onWindowChange(_=>{this._observerDisposable.value=zb(this._canvas,_,(g,S)=>this._setCanvasDevicePixelDimensions(g,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Wn(()=>{for(let _ of this._renderLayers)_.dispose();this._canvas.parentElement?.removeChild(this._canvas),Pb(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(e,t){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 e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new yM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new dM(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 e=Cw(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!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ow(Ur.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ur.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){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,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),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 sM(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,o,f,p,c,h,d,_=0,g=!0,S,C,T,w,m,b,v,x,k;e=ey(e,i.rows-1,0),t=ey(t,i.rows-1,0);let L=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",R=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=R-i.buffer.ydisp,A=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,K=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(f=e;f<=t;f++)for(p=f+i.buffer.ydisp,c=i.buffer.lines.get(p),this._model.lineLengths[f]=0,T=R===p,_=0,h=this._characterJoinerService.getJoinedCharacters(p),x=0;x<i.cols;x++){if(o=this._cellColorResolver.result.bg,c.loadCell(x,s),x===0&&(o=this._cellColorResolver.result.bg),d=!1,g=x>=_,S=x,h.length>0&&x===h[0][0]&&g){C=h.shift();let G=this._model.selection.isCellSelected(this._terminal,C[0],p);for(v=C[0]+1;v<C[1];v++)g&&=G===this._model.selection.isCellSelected(this._terminal,v,p);g&&=!T||A<C[0]||A>=C[1],g?(d=!0,s=new zM(s,c.translateToString(!0,C[0],C[1]),C[1]-C[0]),S=C[1]-1):_=C[1]}if(w=s.getChars(),m=s.getCode(),v=(f*i.cols+x)*dh,this._cellColorResolver.resolve(s,x,p,this.dimensions.device.cell.width),K&&p===R&&(x===A&&(this._model.cursor={x:A,y:N,width:s.getWidth(),style:this._coreBrowserService.isFocused?L:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=A+s.getWidth()-1),x>=A&&x<=I&&(this._coreBrowserService.isFocused&&L==="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)),m!==0&&(this._model.lineLengths[f]=x+1),!(this._model.cells[v]===m&&this._model.cells[v+Yu]===this._cellColorResolver.result.bg&&this._model.cells[v+Xu]===this._cellColorResolver.result.fg&&this._model.cells[v+_p]===this._cellColorResolver.result.ext)&&(F=!0,w.length>1&&(m|=gM),this._model.cells[v]=m,this._model.cells[v+Yu]=this._cellColorResolver.result.bg,this._model.cells[v+Xu]=this._cellColorResolver.result.fg,this._model.cells[v+_p]=this._cellColorResolver.result.ext,b=s.getWidth(),this._glyphRenderer.value.updateCell(x,f,m,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,w,b,o),d)){for(s=this._workCell,x++;x<=S;x++)k=(f*i.cols+x)*dh,this._glyphRenderer.value.updateCell(x,f,0,0,0,0,xL,0,0),this._model.cells[k]=0,this._model.cells[k+Yu]=this._cellColorResolver.result.bg,this._model.cells[k+Xu]=this._cellColorResolver.result.fg,this._model.cells[k+_p]=this._cellColorResolver.result.ext;x--}}F&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},zM=class extends io{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}};function ey(e,t,i=0){return Math.max(Math.min(e,t),i)}var ty="di$target",ny="di$dependencies",xp=new Map;function vr(e){if(xp.has(e))return xp.get(e);let t=function(i,s,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");HM(t,i,o)};return t._id=e,xp.set(e,t),t}function HM(e,t,i){t[ty]===t?t[ny].push({id:e,index:i}):(t[ny]=[{id:e,index:i}],t[ty]=t)}vr("BufferService");vr("CoreMouseService");vr("CoreService");vr("CharsetService");vr("InstantiationService");vr("LogService");var $M=vr("OptionsService");vr("OscLinkService");vr("UnicodeService");vr("DecorationService");var UM={trace:0,debug:1,info:2,warn:3,error:4,off:5},FM="xterm.js: ",iy=class extends sr{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=UM[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":FM)+t,...i)}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)}};iy=uL([hL(0,$M)],iy);var WM=class extends sr{constructor(e){if(uw&&SL()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Gt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Gt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Gt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Gt),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,o=t,f=o._renderService,p=o._characterJoinerService,c=o._charSizeService,h=o._coreBrowserService,d=o._decorationService;o._logService;let _=o._themeService;this._renderer=this._register(new PM(e,p,c,h,i,d,s,_,this._preserveDrawingBuffer)),this._register(Ur.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ur.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ur.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ur.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),f.setRenderer(this._renderer),this._register(Wn(()=>{if(this._terminal._core._store._isDisposed)return;let g=this._terminal._core._renderService;g.setRenderer(this._terminal._core._createRenderer()),g.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},wp={exports:{}},ry;function GM(){return ry||(ry=1,(function(e,t){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,c,h){var d=this&&this.__decorate||function(v,x,k,L){var R,N=arguments.length,A=N<3?x:L===null?L=Object.getOwnPropertyDescriptor(x,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,x,k,L);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(x,k,A):R(x,k))||A);return N>3&&A&&Object.defineProperty(x,k,A),A},_=this&&this.__param||function(v,x){return function(k,L){x(k,L,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const g=h(9042),S=h(9924),C=h(844),T=h(4725),w=h(2585),m=h(3656);let b=c.AccessibilityManager=class extends C.Disposable{constructor(v,x,k,L){super(),this._terminal=v,this._coreBrowserService=k,this._renderService=L,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let R=0;R<this._terminal.rows;R++)this._rowElements[R]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[R]);if(this._topBoundaryFocusListener=R=>this._handleBoundaryFocus(R,0),this._bottomBoundaryFocusListener=R=>this._handleBoundaryFocus(R,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(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((R=>this._handleResize(R.rows)))),this.register(this._terminal.onRender((R=>this._refreshRows(R.start,R.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((R=>this._handleChar(R)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
75
+ `)))),this.register(this._terminal.onA11yTab((R=>this._handleTab(R)))),this.register(this._terminal.onKey((R=>this._handleKey(R.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,m.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let x=0;x<v;x++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
76
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=g.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,x){this._liveRegionDebouncer.refresh(v,x,this._terminal.rows)}_renderRows(v,x){const k=this._terminal.buffer,L=k.lines.length.toString();for(let R=v;R<=x;R++){const N=k.lines.get(k.ydisp+R),A=[],I=N?.translateToString(!0,void 0,void 0,A)||"",K=(k.ydisp+R+1).toString(),F=this._rowElements[R];F&&(I.length===0?(F.innerText=" ",this._rowColumns.set(F,[0,1])):(F.textContent=I,this._rowColumns.set(F,A)),F.setAttribute("aria-posinset",K),F.setAttribute("aria-setsize",L))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,x){const k=v.target,L=this._rowElements[x===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(x===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==L)return;let R,N;if(x===0?(R=k,N=this._rowElements.pop(),this._rowContainer.removeChild(N)):(R=this._rowElements.shift(),N=k,this._rowContainer.removeChild(R)),R.removeEventListener("focus",this._topBoundaryFocusListener),N.removeEventListener("focus",this._bottomBoundaryFocusListener),x===0){const A=this._createAccessibilityTreeNode();this._rowElements.unshift(A),this._rowContainer.insertAdjacentElement("afterbegin",A)}else{const A=this._createAccessibilityTreeNode();this._rowElements.push(A),this._rowContainer.appendChild(A)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(x===0?-1:1),this._rowElements[x===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let x={node:v.anchorNode,offset:v.anchorOffset},k={node:v.focusNode,offset:v.focusOffset};if((x.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||x.node===k.node&&x.offset>k.offset)&&([x,k]=[k,x]),x.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(x={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(x.node))return;const L=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(L)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:L,offset:L.textContent?.length??0}),!this._rowContainer.contains(k.node))return;const R=({node:I,offset:K})=>{const F=I instanceof Text?I.parentNode:I;let G=parseInt(F?.getAttribute("aria-posinset"),10)-1;if(isNaN(G))return console.warn("row is invalid. Race condition?"),null;const B=this._rowColumns.get(F);if(!B)return console.warn("columns is null. Race condition?"),null;let Y=K<B.length?B[K]:B.slice(-1)[0]+1;return Y>=this._terminal.cols&&(++G,Y=0),{row:G,column:Y}},N=R(x),A=R(k);if(N&&A){if(N.row>A.row||N.row===A.row&&N.column>=A.column)throw new Error("invalid range");this._terminal.select(N.column,N.row,(A.row-N.row)*this._terminal.cols-N.column+A.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let x=this._rowContainer.children.length;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=d([_(1,w.IInstantiationService),_(2,T.ICoreBrowserService),_(3,T.IRenderService)],b)},3614:(p,c)=>{function h(S){return S.replace(/\r?\n/g,"\r")}function d(S,C){return C?"\x1B[200~"+S+"\x1B[201~":S}function _(S,C,T,w){S=d(S=h(S),T.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(S,!0),C.value=""}function g(S,C,T){const w=T.getBoundingClientRect(),m=S.clientX-w.left-10,b=S.clientY-w.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${m}px`,C.style.top=`${b}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(c,"__esModule",{value:!0}),c.rightClickHandler=c.moveTextAreaUnderMouseCursor=c.paste=c.handlePasteEvent=c.copyHandler=c.bracketTextForPaste=c.prepareTextForTerminal=void 0,c.prepareTextForTerminal=h,c.bracketTextForPaste=d,c.copyHandler=function(S,C){S.clipboardData&&S.clipboardData.setData("text/plain",C.selectionText),S.preventDefault()},c.handlePasteEvent=function(S,C,T,w){S.stopPropagation(),S.clipboardData&&_(S.clipboardData.getData("text/plain"),C,T,w)},c.paste=_,c.moveTextAreaUnderMouseCursor=g,c.rightClickHandler=function(S,C,T,w,m){g(S,C,T),m&&w.rightClickSelect(S),C.value=w.selectionText,C.select()}},7239:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const d=h(1505);c.ColorContrastCache=class{constructor(){this._color=new d.TwoKeyMap,this._css=new d.TwoKeyMap}setCss(_,g,S){this._css.set(_,g,S)}getCss(_,g){return this._css.get(_,g)}setColor(_,g,S){this._color.set(_,g,S)}getColor(_,g){return this._color.get(_,g)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(h,d,_,g){h.addEventListener(d,_,g);let S=!1;return{dispose:()=>{S||(S=!0,h.removeEventListener(d,_,g))}}}},3551:function(p,c,h){var d=this&&this.__decorate||function(b,v,x,k){var L,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,x,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(v,x,N):L(v,x))||N);return R>3&&N&&Object.defineProperty(v,x,N),N},_=this&&this.__param||function(b,v){return function(x,k){v(x,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const g=h(3656),S=h(8460),C=h(844),T=h(2585),w=h(4725);let m=c.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(b,v,x,k,L){super(),this._element=b,this._mouseService=v,this._renderService=x,this._bufferService=k,this._linkProviderService=L,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,g.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,g.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,g.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,g.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const x=b.composedPath();for(let k=0;k<x.length;k++){const L=x[k];if(L.classList.contains("xterm"))break;if(L.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((k=>{k?.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let x=!1;for(const[k,L]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(k)&&(x=this._checkLinkProviderResult(k,b,x)):L.provideLinks(b.y,(R=>{if(this._isMouseOut)return;const N=R?.map((A=>({link:A})));this._activeProviderReplies?.set(k,N),x=this._checkLinkProviderResult(k,b,x),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const x=new Set;for(let k=0;k<v.size;k++){const L=v.get(k);if(L)for(let R=0;R<L.length;R++){const N=L[R],A=N.link.range.start.y<b?0:N.link.range.start.x,I=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let K=A;K<=I;K++){if(x.has(K)){L.splice(R--,1);break}x.add(K)}}}}_checkLinkProviderResult(b,v,x){if(!this._activeProviderReplies)return x;const k=this._activeProviderReplies.get(b);let L=!1;for(let R=0;R<b;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(L=!0);if(!L&&k){const R=k.find((N=>this._linkAtPosition(N.link,v)));R&&(x=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!x)for(let R=0;R<this._activeProviderReplies.size;R++){const N=this._activeProviderReplies.get(R)?.find((A=>this._linkAtPosition(A.link,v)));if(N){x=!0,this._handleNewLink(N);break}}return x}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:x=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==x&&(this._currentLink.state.decorations.pointerCursor=x,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",x))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:x=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==x&&(this._currentLink.state.decorations.underline=x,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,x))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((x=>{if(!this._currentLink)return;const k=x.start===0?0:x.start+1+this._bufferService.buffer.ydisp,L=this._bufferService.buffer.ydisp+1+x.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=L&&(this._clearCurrentLink(k,L),this._lastMouseEvent)){const R=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);R&&this._askForLink(R,!1)}}))))}_linkHover(b,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(x,v.text)}_fireUnderlineEvent(b,v){const x=b.range,k=this._bufferService.buffer.ydisp,L=this._createLinkUnderlineEvent(x.start.x-1,x.start.y-k-1,x.end.x,x.end.y-k-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(L)}_linkLeave(b,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(x,v.text)}_linkAtPosition(b,v){const x=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,L=v.y*this._bufferService.cols+v.x;return x<=L&&L<=k}_positionFromMouseEvent(b,v,x){const k=x.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,x,k,L){return{x1:b,y1:v,x2:x,y2:k,cols:this._bufferService.cols,fg:L}}};c.Linkifier=m=d([_(1,w.IMouseService),_(2,w.IRenderService),_(3,T.IBufferService),_(4,w.ILinkProviderService)],m)},9042:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.tooMuchOutput=c.promptLabel=void 0,c.promptLabel="Terminal input",c.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(p,c,h){var d=this&&this.__decorate||function(w,m,b,v){var x,k=arguments.length,L=k<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,v);else for(var R=w.length-1;R>=0;R--)(x=w[R])&&(L=(k<3?x(L):k>3?x(m,b,L):x(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},_=this&&this.__param||function(w,m){return function(b,v){m(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const g=h(511),S=h(2585);let C=c.OscLinkProvider=class{constructor(w,m,b){this._bufferService=w,this._optionsService=m,this._oscLinkService=b}provideLinks(w,m){const b=this._bufferService.buffer.lines.get(w-1);if(!b)return void m(void 0);const v=[],x=this._optionsService.rawOptions.linkHandler,k=new g.CellData,L=b.getTrimmedLength();let R=-1,N=-1,A=!1;for(let I=0;I<L;I++)if(N!==-1||b.hasContent(I)){if(b.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=I,R=k.extended.urlId;continue}A=k.extended.urlId!==R}else N!==-1&&(A=!0);if(A||N!==-1&&I===L-1){const K=this._oscLinkService.getLinkData(R)?.uri;if(K){const F={start:{x:N+1,y:w},end:{x:I+(A||I!==L-1?0:1),y:w}};let G=!1;if(!x?.allowNonHttpProtocols)try{const B=new URL(K);["http:","https:"].includes(B.protocol)||(G=!0)}catch{G=!0}G||v.push({text:K,range:F,activate:(B,Y)=>x?x.activate(B,Y,F):T(0,Y),hover:(B,Y)=>x?.hover?.(B,Y,F),leave:(B,Y)=>x?.leave?.(B,Y,F)})}A=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=I,R=k.extended.urlId):(N=-1,R=-1)}}m(v)}};function T(w,m){if(confirm(`Do you want to navigate to ${m}?
77
+
78
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=m}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=C=d([_(0,S.IBufferService),_(1,S.IOptionsService),_(2,S.IOscLinkService)],C)},6193:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,d){this._renderCallback=h,this._coreBrowserService=d,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,d,_){this._rowCount=_,h=h!==void 0?h:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d,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)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,d),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const d=h(3614),_=h(3656),g=h(3551),S=h(9042),C=h(3730),T=h(1680),w=h(3107),m=h(5744),b=h(2950),v=h(1296),x=h(428),k=h(4269),L=h(5114),R=h(8934),N=h(3230),A=h(9312),I=h(4725),K=h(6731),F=h(8055),G=h(8969),B=h(8460),Y=h(844),W=h(6114),z=h(8437),V=h(2584),X=h(7399),j=h(5941),P=h(9074),D=h(2585),U=h(5435),q=h(4567),Q=h(779);class re extends G.CoreTerminal{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}constructor(Z={}){super(Z),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new Y.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(P.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Q.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((H,oe)=>this.refresh(H,oe)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((H=>this._reportWindowsOptions(H)))),this.register(this._inputHandler.onColor((H=>this._handleColorEvent(H)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((H=>this._afterResize(H.cols,H.rows)))),this.register((0,Y.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(Z){if(this._themeService)for(const H of Z){let oe,fe="";switch(H.index){case 256:oe="foreground",fe="10";break;case 257:oe="background",fe="11";break;case 258:oe="cursor",fe="12";break;default:oe="ansi",fe="4;"+H.index}switch(H.type){case 0:const Se=F.color.toColorRGB(oe==="ansi"?this._themeService.colors.ansi[H.index]:this._themeService.colors[oe]);this.coreService.triggerDataEvent(`${V.C0.ESC}]${fe};${(0,j.toRgbString)(Se)}${V.C1_ESCAPED.ST}`);break;case 1:if(oe==="ansi")this._themeService.modifyColors((ye=>ye.ansi[H.index]=F.channels.toColor(...H.color)));else{const ye=oe;this._themeService.modifyColors((De=>De[ye]=F.channels.toColor(...H.color)))}break;case 2:this._themeService.restoreColor(H.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Z){Z?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(q.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Z){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.C0.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(V.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Z=this.buffer.ybase+this.buffer.y,H=this.buffer.lines.get(Z);if(!H)return;const oe=Math.min(this.buffer.x,this.cols-1),fe=this._renderService.dimensions.css.cell.height,Se=H.getWidth(oe),ye=this._renderService.dimensions.css.cell.width*Se,De=this.buffer.y*this._renderService.dimensions.css.cell.height,Fe=oe*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Fe+"px",this.textarea.style.top=De+"px",this.textarea.style.width=ye+"px",this.textarea.style.height=fe+"px",this.textarea.style.lineHeight=fe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(H=>{this.hasSelection()&&(0,d.copyHandler)(H,this._selectionService)})));const Z=H=>(0,d.handlePasteEvent)(H,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",Z)),this.register((0,_.addDisposableDomListener)(this.element,"paste",Z)),W.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(H=>{H.button===2&&(0,d.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(H=>{(0,d.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(H=>{H.button===1&&(0,d.moveTextAreaUnderMouseCursor)(H,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(Z=>this._keyUp(Z)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(Z=>this._keyDown(Z)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(Z=>this._keyPress(Z)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(Z=>this._compositionHelper.compositionupdate(Z)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(Z=>this._inputEvent(Z)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Z){if(!Z)throw new Error("Terminal requires a parent element.");if(Z.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Z.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"),Z.appendChild(this.element);const H=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),H.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),H.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),W.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(L.CoreBrowserService,this.textarea,Z.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(x.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(K.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(R.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(g.Linkifier,this.screenElement)),this.element.appendChild(H);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(T.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(A.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),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(q.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Z=this,H=this.element;function oe(ye){const De=Z._mouseService.getMouseReportCoords(ye,Z.screenElement);if(!De)return!1;let Fe,Be;switch(ye.overrideType||ye.type){case"mousemove":Be=32,ye.buttons===void 0?(Fe=3,ye.button!==void 0&&(Fe=ye.button<3?ye.button:3)):Fe=1&ye.buttons?0:4&ye.buttons?1:2&ye.buttons?2:3;break;case"mouseup":Be=0,Fe=ye.button<3?ye.button:3;break;case"mousedown":Be=1,Fe=ye.button<3?ye.button:3;break;case"wheel":if(Z._customWheelEventHandler&&Z._customWheelEventHandler(ye)===!1||Z.viewport.getLinesScrolled(ye)===0)return!1;Be=ye.deltaY<0?0:1,Fe=4;break;default:return!1}return!(Be===void 0||Fe===void 0||Fe>4)&&Z.coreMouseService.triggerMouseEvent({col:De.col,row:De.row,x:De.x,y:De.y,button:Fe,action:Be,ctrl:ye.ctrlKey,alt:ye.altKey,shift:ye.shiftKey})}const fe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Se={mouseup:ye=>(oe(ye),ye.buttons||(this._document.removeEventListener("mouseup",fe.mouseup),fe.mousedrag&&this._document.removeEventListener("mousemove",fe.mousedrag)),this.cancel(ye)),wheel:ye=>(oe(ye),this.cancel(ye,!0)),mousedrag:ye=>{ye.buttons&&oe(ye)},mousemove:ye=>{ye.buttons||oe(ye)}};this.register(this.coreMouseService.onProtocolChange((ye=>{ye?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ye)),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()),8&ye?fe.mousemove||(H.addEventListener("mousemove",Se.mousemove),fe.mousemove=Se.mousemove):(H.removeEventListener("mousemove",fe.mousemove),fe.mousemove=null),16&ye?fe.wheel||(H.addEventListener("wheel",Se.wheel,{passive:!1}),fe.wheel=Se.wheel):(H.removeEventListener("wheel",fe.wheel),fe.wheel=null),2&ye?fe.mouseup||(fe.mouseup=Se.mouseup):(this._document.removeEventListener("mouseup",fe.mouseup),fe.mouseup=null),4&ye?fe.mousedrag||(fe.mousedrag=Se.mousedrag):(this._document.removeEventListener("mousemove",fe.mousedrag),fe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(H,"mousedown",(ye=>{if(ye.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ye))return oe(ye),fe.mouseup&&this._document.addEventListener("mouseup",fe.mouseup),fe.mousedrag&&this._document.addEventListener("mousemove",fe.mousedrag),this.cancel(ye)}))),this.register((0,_.addDisposableDomListener)(H,"wheel",(ye=>{if(!fe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ye)===!1)return!1;if(!this.buffer.hasScrollback){const De=this.viewport.getLinesScrolled(ye);if(De===0)return;const Fe=V.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ye.deltaY<0?"A":"B");let Be="";for(let Ke=0;Ke<Math.abs(De);Ke++)Be+=Fe;return this.coreService.triggerDataEvent(Be,!0),this.cancel(ye,!0)}return this.viewport.handleWheel(ye)?this.cancel(ye):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(H,"touchstart",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ye),this.cancel(ye)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(H,"touchmove",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ye)?void 0:this.cancel(ye)}),{passive:!1}))}refresh(Z,H){this._renderService?.refreshRows(Z,H)}updateCursorStyle(Z){this._selectionService?.shouldColumnSelect(Z)?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(Z,H,oe=0){oe===1?(super.scrollLines(Z,H,oe),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(Z)}paste(Z){(0,d.paste)(Z,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Z){this._customKeyEventHandler=Z}attachCustomWheelEventHandler(Z){this._customWheelEventHandler=Z}registerLinkProvider(Z){return this._linkProviderService.registerLinkProvider(Z)}registerCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const H=this._characterJoinerService.register(Z);return this.refresh(0,this.rows-1),H}deregisterCharacterJoiner(Z){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Z)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Z){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Z)}registerDecoration(Z){return this._decorationService.registerDecoration(Z)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Z,H,oe){this._selectionService.setSelection(Z,H,oe)}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(Z,H){this._selectionService?.selectLines(Z,H)}_keyDown(Z){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;const H=this.browser.isMac&&this.options.macOptionIsMeta&&Z.altKey;if(!H&&!this._compositionHelper.keydown(Z))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;H||Z.key!=="Dead"&&Z.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const oe=(0,X.evaluateKeyboardEvent)(Z,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Z),oe.type===3||oe.type===2){const fe=this.rows-1;return this.scrollLines(oe.type===2?-fe:fe),this.cancel(Z,!0)}return oe.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Z)||(oe.cancel&&this.cancel(Z,!0),!oe.key||!!(Z.key&&!Z.ctrlKey&&!Z.altKey&&!Z.metaKey&&Z.key.length===1&&Z.key.charCodeAt(0)>=65&&Z.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(oe.key!==V.C0.ETX&&oe.key!==V.C0.CR||(this.textarea.value=""),this._onKey.fire({key:oe.key,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(oe.key,!0),!this.optionsService.rawOptions.screenReaderMode||Z.altKey||Z.ctrlKey?this.cancel(Z,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Z,H){const oe=Z.isMac&&!this.options.macOptionIsMeta&&H.altKey&&!H.ctrlKey&&!H.metaKey||Z.isWindows&&H.altKey&&H.ctrlKey&&!H.metaKey||Z.isWindows&&H.getModifierState("AltGraph");return H.type==="keypress"?oe:oe&&(!H.keyCode||H.keyCode>47)}_keyUp(Z){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1||((function(H){return H.keyCode===16||H.keyCode===17||H.keyCode===18})(Z)||this.focus(),this.updateCursorStyle(Z),this._keyPressHandled=!1)}_keyPress(Z){let H;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Z)===!1)return!1;if(this.cancel(Z),Z.charCode)H=Z.charCode;else if(Z.which===null||Z.which===void 0)H=Z.keyCode;else{if(Z.which===0||Z.charCode===0)return!1;H=Z.which}return!(!H||(Z.altKey||Z.ctrlKey||Z.metaKey)&&!this._isThirdLevelShift(this.browser,Z)||(H=String.fromCharCode(H),this._onKey.fire({key:H,domEvent:Z}),this._showCursor(),this.coreService.triggerDataEvent(H,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Z){if(Z.data&&Z.inputType==="insertText"&&(!Z.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const H=Z.data;return this.coreService.triggerDataEvent(H,!0),this.cancel(Z),!0}return!1}resize(Z,H){Z!==this.cols||H!==this.rows?super.resize(Z,H):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Z,H){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}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 Z=1;Z<this.rows;Z++)this.buffer.lines.push(this.buffer.getBlankLine(z.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const Z=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=Z,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(V.C0.ESC+"[I"):this.coreService.triggerDataEvent(V.C0.ESC+"[O")}_reportWindowsOptions(Z){if(this._renderService)switch(Z){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const H=this._renderService.dimensions.css.canvas.width.toFixed(0),oe=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[4;${oe};${H}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const fe=this._renderService.dimensions.css.cell.width.toFixed(0),Se=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[6;${Se};${fe}t`)}}cancel(Z,H){if(this.options.cancelEvents||H)return Z.preventDefault(),Z.stopPropagation(),!1}}c.Terminal=re},9924:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,d=1e3){this._renderCallback=h,this._debounceThresholdMS=d,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,d,_){this._rowCount=_,h=h!==void 0?h:0,d=d!==void 0?d:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,d):d;const g=Date.now();if(g-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=g,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=g-this._lastRefreshMs,C=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),d=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,d)}}},1680:function(p,c,h){var d=this&&this.__decorate||function(b,v,x,k){var L,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,x,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(v,x,N):L(v,x))||N);return R>3&&N&&Object.defineProperty(v,x,N),N},_=this&&this.__param||function(b,v){return function(x,k){v(x,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const g=h(3656),S=h(4725),C=h(8460),T=h(844),w=h(2585);let m=c.Viewport=class extends T.Disposable{constructor(b,v,x,k,L,R,N,A){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=x,this._optionsService=k,this._charSizeService=L,this._renderService=R,this._coreBrowserService=N,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const x=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&x<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){let x,k="";const L=[],R=v??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let A=b;A<R;A++){const I=N.get(A);if(!I)continue;const K=N.get(A+1)?.isWrapped;if(k+=I.translateToString(!K),!K||A===N.length-1){const F=document.createElement("div");F.textContent=k,L.push(F),k.length>0&&(x=F),k=""}}return{bufferElements:L,cursorElement:x}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const x=this._optionsService.rawOptions.fastScrollModifier;return x==="alt"&&v.altKey||x==="ctrl"&&v.ctrlKey||x==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};c.Viewport=m=d([_(2,w.IBufferService),_(3,w.IOptionsService),_(4,S.ICharSizeService),_(5,S.IRenderService),_(6,S.ICoreBrowserService),_(7,S.IThemeService)],m)},3107:function(p,c,h){var d=this&&this.__decorate||function(w,m,b,v){var x,k=arguments.length,L=k<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,v);else for(var R=w.length-1;R>=0;R--)(x=w[R])&&(L=(k<3?x(L):k>3?x(m,b,L):x(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},_=this&&this.__param||function(w,m){return function(b,v){m(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const g=h(4725),S=h(844),C=h(2585);let T=c.BufferDecorationRenderer=class extends S.Disposable{constructor(w,m,b,v,x){super(),this._screenElement=w,this._bufferService=m,this._coreBrowserService=b,this._decorationService=v,this._renderService=x,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((k=>this._removeDecoration(k)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){const m=this._coreBrowserService.mainDocument.createElement("div");m.classList.add("xterm-decoration"),m.classList.toggle("xterm-decoration-top-layer",w?.options?.layer==="top"),m.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,m.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",m.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",m.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=w.options.x??0;return b&&b>this._bufferService.cols&&(m.style.display="none"),this._refreshXPosition(w,m),m}_refreshStyle(w){const m=w.marker.line-this._bufferService.buffers.active.ydisp;if(m<0||m>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let b=this._decorationElements.get(w);b||(b=this._createElement(w),w.element=b,this._decorationElements.set(w,b),this._container.appendChild(b),w.onDispose((()=>{this._decorationElements.delete(w),b.remove()}))),b.style.top=m*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(b)}}_refreshXPosition(w,m=w.element){if(!m)return;const b=w.options.x??0;(w.options.anchor||"left")==="right"?m.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":m.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){this._decorationElements.get(w)?.remove(),this._decorationElements.delete(w),w.dispose()}};c.BufferDecorationRenderer=T=d([_(1,C.IBufferService),_(2,g.ICoreBrowserService),_(3,C.IDecorationService),_(4,g.IRenderService)],T)},5871:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorZoneStore=void 0,c.ColorZoneStore=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(h){if(h.options.overviewRulerOptions){for(const d of this._zones)if(d.color===h.options.overviewRulerOptions.color&&d.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(d,h.marker.line))return;if(this._lineAdjacentToZone(d,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(d,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,d){return d>=h.startBufferLine&&d<=h.endBufferLine}_lineAdjacentToZone(h,d,_){return d>=h.startBufferLine-this._linePadding[_||"full"]&&d<=h.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(h,d){h.startBufferLine=Math.min(h.startBufferLine,d),h.endBufferLine=Math.max(h.endBufferLine,d)}}},5744:function(p,c,h){var d=this&&this.__decorate||function(x,k,L,R){var N,A=arguments.length,I=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(x,k,L,R);else for(var K=x.length-1;K>=0;K--)(N=x[K])&&(I=(A<3?N(I):A>3?N(k,L,I):N(k,L))||I);return A>3&&I&&Object.defineProperty(k,L,I),I},_=this&&this.__param||function(x,k){return function(L,R){k(L,R,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const g=h(5871),S=h(4725),C=h(844),T=h(2585),w={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=c.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(x,k,L,R,N,A,I){super(),this._viewportElement=x,this._screenElement=k,this._bufferService=L,this._decorationService=R,this._renderService=N,this._optionsService=A,this._coreBrowserService=I,this._colorZoneStore=new g.ColorZoneStore,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);const K=this._canvas.getContext("2d");if(!K)throw new Error("Ctx cannot be null");this._ctx=K,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const x=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);m.full=this._canvas.width,m.left=x,m.center=k,m.right=x,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=m.left,b.right=m.left+m.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const x=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(x,12),6)*this._coreBrowserService.dpr);w.left=k,w.center=k,w.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.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(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const x=this._colorZoneStore.zones;for(const k of x)k.position!=="full"&&this._renderColorZone(k);for(const k of x)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(x){this._ctx.fillStyle=x.color,this._ctx.fillRect(b[x.position||"full"],Math.round((this._canvas.height-1)*(x.startBufferLine/this._bufferService.buffers.active.lines.length)-w[x.position||"full"]/2),m[x.position||"full"],Math.round((this._canvas.height-1)*((x.endBufferLine-x.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[x.position||"full"]))}_queueRefresh(x,k){this._shouldUpdateDimensions=x||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=v=d([_(2,T.IBufferService),_(3,T.IDecorationService),_(4,S.IRenderService),_(5,T.IOptionsService),_(6,S.ICoreBrowserService)],v)},2950:function(p,c,h){var d=this&&this.__decorate||function(w,m,b,v){var x,k=arguments.length,L=k<3?m:v===null?v=Object.getOwnPropertyDescriptor(m,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,v);else for(var R=w.length-1;R>=0;R--)(x=w[R])&&(L=(k<3?x(L):k>3?x(m,b,L):x(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},_=this&&this.__param||function(w,m){return function(b,v){m(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const g=h(4725),S=h(2585),C=h(2584);let T=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,m,b,v,x,k){this._textarea=w,this._compositionView=m,this._bufferService=b,this._optionsService=v,this._coreService=x,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const m={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,m.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(m.start,m.end):this._textarea.value.substring(m.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const m=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(m,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const m=this._textarea.value,b=m.replace(w,"");this._dataAlreadySent=b,m.length>w.length?this._coreService.triggerDataEvent(b,!0):m.length<w.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):m.length===w.length&&m!==w&&this._coreService.triggerDataEvent(m,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const m=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,x=m*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=x+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=x+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=T=d([_(2,S.IBufferService),_(3,S.IOptionsService),_(4,S.ICoreService),_(5,g.IRenderService)],T)},9806:(p,c)=>{function h(d,_,g){const S=g.getBoundingClientRect(),C=d.getComputedStyle(g),T=parseInt(C.getPropertyValue("padding-left")),w=parseInt(C.getPropertyValue("padding-top"));return[_.clientX-S.left-T,_.clientY-S.top-w]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(d,_,g,S,C,T,w,m,b){if(!T)return;const v=h(d,_,g);return v?(v[0]=Math.ceil((v[0]+(b?w/2:0))/w),v[1]=Math.ceil(v[1]/m),v[0]=Math.min(Math.max(v[0],1),S+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),C),v):void 0}},9504:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const d=h(2584);function _(m,b,v,x){const k=m-g(m,v),L=b-g(b,v),R=Math.abs(k-L)-(function(N,A,I){let K=0;const F=N-g(N,I),G=A-g(A,I);for(let B=0;B<Math.abs(F-G);B++){const Y=S(N,A)==="A"?-1:1;I.buffer.lines.get(F+Y*B)?.isWrapped&&K++}return K})(m,b,v);return w(R,T(S(m,b),x))}function g(m,b){let v=0,x=b.buffer.lines.get(m),k=x?.isWrapped;for(;k&&m>=0&&m<b.rows;)v++,x=b.buffer.lines.get(--m),k=x?.isWrapped;return v}function S(m,b){return m>b?"A":"B"}function C(m,b,v,x,k,L){let R=m,N=b,A="";for(;R!==v||N!==x;)R+=k?1:-1,k&&R>L.cols-1?(A+=L.buffer.translateBufferLineToString(N,!1,m,R),R=0,m=0,N++):!k&&R<0&&(A+=L.buffer.translateBufferLineToString(N,!1,0,m+1),R=L.cols-1,m=R,N--);return A+L.buffer.translateBufferLineToString(N,!1,m,R)}function T(m,b){const v=b?"O":"[";return d.C0.ESC+v+m}function w(m,b){m=Math.floor(m);let v="";for(let x=0;x<m;x++)v+=b;return v}c.moveToCellSequence=function(m,b,v,x){const k=v.buffer.x,L=v.buffer.y;if(!v.buffer.hasScrollback)return(function(A,I,K,F,G,B){return _(I,F,G,B).length===0?"":w(C(A,I,A,I-g(I,G),!1,G).length,T("D",B))})(k,L,0,b,v,x)+_(L,b,v,x)+(function(A,I,K,F,G,B){let Y;Y=_(I,F,G,B).length>0?F-g(F,G):I;const W=F,z=(function(V,X,j,P,D,U){let q;return q=_(j,P,D,U).length>0?P-g(P,D):X,V<j&&q<=P||V>=j&&q<P?"C":"D"})(A,I,K,F,G,B);return w(C(A,Y,K,W,z==="C",G).length,T(z,B))})(k,L,m,b,v,x);let R;if(L===b)return R=k>m?"D":"C",w(Math.abs(k-m),T(R,x));R=L>b?"D":"C";const N=Math.abs(L-b);return w((function(A,I){return I.cols-A})(L>b?m:k,v)+(N-1)*v.cols+1+((L>b?k:m)-1),T(R,x))}},1296:function(p,c,h){var d=this&&this.__decorate||function(B,Y,W,z){var V,X=arguments.length,j=X<3?Y:z===null?z=Object.getOwnPropertyDescriptor(Y,W):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(B,Y,W,z);else for(var P=B.length-1;P>=0;P--)(V=B[P])&&(j=(X<3?V(j):X>3?V(Y,W,j):V(Y,W))||j);return X>3&&j&&Object.defineProperty(Y,W,j),j},_=this&&this.__param||function(B,Y){return function(W,z){Y(W,z,B)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const g=h(3787),S=h(2550),C=h(2223),T=h(6171),w=h(6052),m=h(4725),b=h(8055),v=h(8460),x=h(844),k=h(2585),L="xterm-dom-renderer-owner-",R="xterm-rows",N="xterm-fg-",A="xterm-bg-",I="xterm-focus",K="xterm-selection";let F=1,G=c.DomRenderer=class extends x.Disposable{constructor(B,Y,W,z,V,X,j,P,D,U,q,Q,re){super(),this._terminal=B,this._document=Y,this._element=W,this._screenElement=z,this._viewportElement=V,this._helperContainer=X,this._linkifier2=j,this._charSizeService=D,this._optionsService=U,this._bufferService=q,this._coreBrowserService=Q,this._themeService=re,this._terminalClass=F++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(R),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(K),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,T.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ie=>this._injectCss(ie)))),this._injectCss(this._themeService.colors),this._rowFactory=P.createInstance(g.DomRendererRowFactory,document),this._element.classList.add(L+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ie=>this._handleLinkHover(ie)))),this.register(this._linkifier2.onHideLinkUnderline((ie=>this._handleLinkLeave(ie)))),this.register((0,x.toDisposable)((()=>{this._element.classList.remove(L+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(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(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),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/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),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(const W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const Y=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=Y,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(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let Y=`${this._terminalSelector} .${R} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;Y+=`${this._terminalSelector} .${R} .xterm-dim { color: ${b.color.multiplyOpacity(B.foreground,.5).css};}`,Y+=`${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;}`;const W=`blink_underline_${this._terminalClass}`,z=`blink_bar_${this._terminalClass}`,V=`blink_block_${this._terminalClass}`;Y+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,Y+=`@keyframes ${z} { 50% { box-shadow: none; }}`,Y+=`@keyframes ${V} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,Y+=`${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${z} 1s step-end infinite;}${this._terminalSelector} .${R}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,Y+=`${this._terminalSelector} .${K} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${K} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${K} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[X,j]of B.ansi.entries())Y+=`${this._terminalSelector} .${N}${X} { color: ${j.css}; }${this._terminalSelector} .${N}${X}.xterm-dim { color: ${b.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${A}${X} { background-color: ${j.css}; }`;Y+=`${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(B.background).css}; }${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=Y}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,Y){for(let W=this._rowElements.length;W<=Y;W++){const z=this._document.createElement("div");this._rowContainer.appendChild(z),this._rowElements.push(z)}for(;this._rowElements.length>Y;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,Y){this._refreshRowElements(B,Y),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,Y,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,Y,W),this.renderRows(0,this._bufferService.rows-1),!B||!Y)return;this._selectionRenderModel.update(this._terminal,B,Y,W);const z=this._selectionRenderModel.viewportStartRow,V=this._selectionRenderModel.viewportEndRow,X=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(X>=this._bufferService.rows||j<0)return;const P=this._document.createDocumentFragment();if(W){const D=B[0]>Y[0];P.appendChild(this._createSelectionElement(X,D?Y[0]:B[0],D?B[0]:Y[0],j-X+1))}else{const D=z===X?B[0]:0,U=X===V?Y[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(X,D,U));const q=j-X-1;if(P.appendChild(this._createSelectionElement(X+1,0,this._bufferService.cols,q)),X!==j){const Q=V===j?Y[0]:this._bufferService.cols;P.appendChild(this._createSelectionElement(j,0,Q))}}this._selectionContainer.appendChild(P)}_createSelectionElement(B,Y,W,z=1){const V=this._document.createElement("div"),X=Y*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(W-Y);return X+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-X),V.style.height=z*this.dimensions.css.cell.height+"px",V.style.top=B*this.dimensions.css.cell.height+"px",V.style.left=`${X}px`,V.style.width=`${j}px`,V}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(const B of this._rowElements)B.replaceChildren()}renderRows(B,Y){const W=this._bufferService.buffer,z=W.ybase+W.y,V=Math.min(W.x,this._bufferService.cols-1),X=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,P=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=B;D<=Y;D++){const U=D+W.ydisp,q=this._rowElements[D],Q=W.lines.get(U);if(!q||!Q)break;q.replaceChildren(...this._rowFactory.createRow(Q,U,U===z,j,P,V,X,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${L}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,Y,W,z,V,X){W<0&&(B=0),z<0&&(Y=0);const j=this._bufferService.rows-1;W=Math.max(Math.min(W,j),0),z=Math.max(Math.min(z,j),0),V=Math.min(V,this._bufferService.cols);const P=this._bufferService.buffer,D=P.ybase+P.y,U=Math.min(P.x,V-1),q=this._optionsService.rawOptions.cursorBlink,Q=this._optionsService.rawOptions.cursorStyle,re=this._optionsService.rawOptions.cursorInactiveStyle;for(let ie=W;ie<=z;++ie){const Z=ie+P.ydisp,H=this._rowElements[ie],oe=P.lines.get(Z);if(!H||!oe)break;H.replaceChildren(...this._rowFactory.createRow(oe,Z,Z===D,Q,re,U,q,this.dimensions.css.cell.width,this._widthCache,X?ie===W?B:0:-1,X?(ie===z?Y:V)-1:-1))}}};c.DomRenderer=G=d([_(7,k.IInstantiationService),_(8,m.ICharSizeService),_(9,k.IOptionsService),_(10,k.IBufferService),_(11,m.ICoreBrowserService),_(12,m.IThemeService)],G)},3787:function(p,c,h){var d=this&&this.__decorate||function(R,N,A,I){var K,F=arguments.length,G=F<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(R,N,A,I);else for(var B=R.length-1;B>=0;B--)(K=R[B])&&(G=(F<3?K(G):F>3?K(N,A,G):K(N,A))||G);return F>3&&G&&Object.defineProperty(N,A,G),G},_=this&&this.__param||function(R,N){return function(A,I){N(A,I,R)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const g=h(2223),S=h(643),C=h(511),T=h(2585),w=h(8055),m=h(4725),b=h(4269),v=h(6171),x=h(3734);let k=c.DomRendererRowFactory=class{constructor(R,N,A,I,K,F,G){this._document=R,this._characterJoinerService=N,this._optionsService=A,this._coreBrowserService=I,this._coreService=K,this._decorationService=F,this._themeService=G,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(R,N,A){this._selectionStart=R,this._selectionEnd=N,this._columnSelectMode=A}createRow(R,N,A,I,K,F,G,B,Y,W,z){const V=[],X=this._characterJoinerService.getJoinedCharacters(N),j=this._themeService.colors;let P,D=R.getNoBgTrimmedLength();A&&D<F+1&&(D=F+1);let U=0,q="",Q=0,re=0,ie=0,Z=!1,H=0,oe=!1,fe=0;const Se=[],ye=W!==-1&&z!==-1;for(let De=0;De<D;De++){R.loadCell(De,this._workCell);let Fe=this._workCell.getWidth();if(Fe===0)continue;let Be=!1,Ke=De,ke=this._workCell;if(X.length>0&&De===X[0][0]){Be=!0;const lt=X.shift();ke=new b.JoinedCellData(this._workCell,R.translateToString(!0,lt[0],lt[1]),lt[1]-lt[0]),Ke=lt[1]-1,Fe=ke.getWidth()}const dt=this._isCellInSelection(De,N),Pt=A&&De===F,Ct=ye&&De>=W&&De<=z;let Gn=!1;this._decorationService.forEachDecorationAtCell(De,N,void 0,(lt=>{Gn=!0}));let qn=ke.getChars()||S.WHITESPACE_CELL_CHAR;if(qn===" "&&(ke.isUnderline()||ke.isOverline())&&(qn=" "),fe=Fe*B-Y.get(qn,ke.isBold(),ke.isItalic()),P){if(U&&(dt&&oe||!dt&&!oe&&ke.bg===Q)&&(dt&&oe&&j.selectionForeground||ke.fg===re)&&ke.extended.ext===ie&&Ct===Z&&fe===H&&!Pt&&!Be&&!Gn){ke.isInvisible()?q+=S.WHITESPACE_CELL_CHAR:q+=qn,U++;continue}U&&(P.textContent=q),P=this._document.createElement("span"),U=0,q=""}else P=this._document.createElement("span");if(Q=ke.bg,re=ke.fg,ie=ke.extended.ext,Z=Ct,H=fe,oe=dt,Be&&F>=De&&F<=Ke&&(F=De),!this._coreService.isCursorHidden&&Pt&&this._coreService.isCursorInitialized){if(Se.push("xterm-cursor"),this._coreBrowserService.isFocused)G&&Se.push("xterm-cursor-blink"),Se.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(K)switch(K){case"outline":Se.push("xterm-cursor-outline");break;case"block":Se.push("xterm-cursor-block");break;case"bar":Se.push("xterm-cursor-bar");break;case"underline":Se.push("xterm-cursor-underline")}}if(ke.isBold()&&Se.push("xterm-bold"),ke.isItalic()&&Se.push("xterm-italic"),ke.isDim()&&Se.push("xterm-dim"),q=ke.isInvisible()?S.WHITESPACE_CELL_CHAR:ke.getChars()||S.WHITESPACE_CELL_CHAR,ke.isUnderline()&&(Se.push(`xterm-underline-${ke.extended.underlineStyle}`),q===" "&&(q=" "),!ke.isUnderlineColorDefault()))if(ke.isUnderlineColorRGB())P.style.textDecorationColor=`rgb(${x.AttributeData.toColorRGB(ke.getUnderlineColor()).join(",")})`;else{let lt=ke.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ke.isBold()&&lt<8&&(lt+=8),P.style.textDecorationColor=j.ansi[lt].css}ke.isOverline()&&(Se.push("xterm-overline"),q===" "&&(q=" ")),ke.isStrikethrough()&&Se.push("xterm-strikethrough"),Ct&&(P.style.textDecoration="underline");let Zt=ke.getFgColor(),ht=ke.getFgColorMode(),Jt=ke.getBgColor(),zt=ke.getBgColorMode();const Kt=!!ke.isInverse();if(Kt){const lt=Zt;Zt=Jt,Jt=lt;const hn=ht;ht=zt,zt=hn}let nn,ni,xn,Qt=!1;switch(this._decorationService.forEachDecorationAtCell(De,N,void 0,(lt=>{lt.options.layer!=="top"&&Qt||(lt.backgroundColorRGB&&(zt=50331648,Jt=lt.backgroundColorRGB.rgba>>8&16777215,nn=lt.backgroundColorRGB),lt.foregroundColorRGB&&(ht=50331648,Zt=lt.foregroundColorRGB.rgba>>8&16777215,ni=lt.foregroundColorRGB),Qt=lt.options.layer==="top")})),!Qt&&dt&&(nn=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,Jt=nn.rgba>>8&16777215,zt=50331648,Qt=!0,j.selectionForeground&&(ht=50331648,Zt=j.selectionForeground.rgba>>8&16777215,ni=j.selectionForeground)),Qt&&Se.push("xterm-decoration-top"),zt){case 16777216:case 33554432:xn=j.ansi[Jt],Se.push(`xterm-bg-${Jt}`);break;case 50331648:xn=w.channels.toColor(Jt>>16,Jt>>8&255,255&Jt),this._addStyle(P,`background-color:#${L((Jt>>>0).toString(16),"0",6)}`);break;default:Kt?(xn=j.foreground,Se.push(`xterm-bg-${g.INVERTED_DEFAULT_COLOR}`)):xn=j.background}switch(nn||ke.isDim()&&(nn=w.color.multiplyOpacity(xn,.5)),ht){case 16777216:case 33554432:ke.isBold()&&Zt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Zt+=8),this._applyMinimumContrast(P,xn,j.ansi[Zt],ke,nn,void 0)||Se.push(`xterm-fg-${Zt}`);break;case 50331648:const lt=w.channels.toColor(Zt>>16&255,Zt>>8&255,255&Zt);this._applyMinimumContrast(P,xn,lt,ke,nn,ni)||this._addStyle(P,`color:#${L(Zt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(P,xn,j.foreground,ke,nn,ni)||Kt&&Se.push(`xterm-fg-${g.INVERTED_DEFAULT_COLOR}`)}Se.length&&(P.className=Se.join(" "),Se.length=0),Pt||Be||Gn?P.textContent=q:U++,fe!==this.defaultSpacing&&(P.style.letterSpacing=`${fe}px`),V.push(P),De=Ke}return P&&U&&(P.textContent=q),V}_applyMinimumContrast(R,N,A,I,K,F){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const G=this._getContrastCache(I);let B;if(K||F||(B=G.getColor(N.rgba,A.rgba)),B===void 0){const Y=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);B=w.color.ensureContrastRatio(K||N,F||A,Y),G.setColor((K||N).rgba,(F||A).rgba,B??null)}return!!B&&(this._addStyle(R,`color:${B.css}`),!0)}_getContrastCache(R){return R.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(R,N){R.setAttribute("style",`${R.getAttribute("style")||""}${N};`)}_isCellInSelection(R,N){const A=this._selectionStart,I=this._selectionEnd;return!(!A||!I)&&(this._columnSelectMode?A[0]<=I[0]?R>=A[0]&&N>=A[1]&&R<I[0]&&N<=I[1]:R<A[0]&&N>=A[1]&&R>=I[0]&&N<=I[1]:N>A[1]&&N<I[1]||A[1]===I[1]&&N===A[1]&&R>=A[0]&&R<I[0]||A[1]<I[1]&&N===I[1]&&R<I[0]||A[1]<I[1]&&N===A[1]&&R>=A[0])}};function L(R,N,A){for(;R.length<A;)R=N+R;return R}c.DomRendererRowFactory=k=d([_(1,m.ICharacterJoinerService),_(2,T.IOptionsService),_(3,m.ICoreBrowserService),_(4,T.ICoreService),_(5,T.IDecorationService),_(6,m.IThemeService)],k)},2550:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,d){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.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";const _=h.createElement("span");_.classList.add("xterm-char-measure-element");const g=h.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold";const S=h.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const C=h.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[_,g,S,C],this._container.appendChild(_),this._container.appendChild(g),this._container.appendChild(S),this._container.appendChild(C),d.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(h,d,_,g){h===this._font&&d===this._fontSize&&_===this._weight&&g===this._weightBold||(this._font=h,this._fontSize=d,this._weight=_,this._weightBold=g,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${g}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${g}`,this.clear())}get(h,d,_){let g=0;if(!d&&!_&&h.length===1&&(g=h.charCodeAt(0))<256){if(this._flat[g]!==-9999)return this._flat[g];const T=this._measure(h,0);return T>0&&(this._flat[g]=T),T}let S=h;d&&(S+="B"),_&&(S+="I");let C=this._holey.get(S);if(C===void 0){let T=0;d&&(T|=1),_&&(T|=2),C=this._measure(h,T),C>0&&this._holey.set(S,C)}return C}_measure(h,d){const _=this._measureElements[d];return _.textContent=h.repeat(32),_.offsetWidth/32}}},2223:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TEXT_BASELINE=c.DIM_OPACITY=c.INVERTED_DEFAULT_COLOR=void 0;const d=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=d.isFirefox||d.isLegacyEdge?"bottom":"ideographic"},6171:(p,c)=>{function h(_){return 57508<=_&&_<=57558}function d(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(c,"__esModule",{value:!0}),c.computeNextVariantOffset=c.createRenderDimensions=c.treatGlyphAsBackgroundColor=c.allowRescaling=c.isEmoji=c.isRestrictedPowerlineGlyph=c.isPowerlineGlyph=c.throwIfFalsy=void 0,c.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},c.isEmoji=d,c.allowRescaling=function(_,g,S,C){return g===1&&S>Math.ceil(1.5*C)&&_!==void 0&&_>255&&!d(_)&&!h(_)&&!(function(T){return 57344<=T&&T<=63743})(_)},c.treatGlyphAsBackgroundColor=function(_){return h(_)||(function(g){return 9472<=g&&g<=9631})(_)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(_,g,S=0){return(_-(2*Math.round(g)-S))%(2*Math.round(g))}},6052:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{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(_,g,S,C=!1){if(this.selectionStart=g,this.selectionEnd=S,!g||!S||g[0]===S[0]&&g[1]===S[1])return void this.clear();const T=_.buffers.active.ydisp,w=g[1]-T,m=S[1]-T,b=Math.max(w,0),v=Math.min(m,_.rows-1);b>=_.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=w,this.viewportEndRow=m,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=g[0],this.endCol=S[0])}isCellSelected(_,g,S){return!!this.hasSelection&&(S-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?g>=this.startCol&&S>=this.viewportCappedStartRow&&g<this.endCol&&S<=this.viewportCappedEndRow:g<this.startCol&&S>=this.viewportCappedStartRow&&g>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&g>=this.startCol&&g<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&g<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&g>=this.startCol)}}c.createSelectionRenderModel=function(){return new h}},456:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionModel=void 0,c.SelectionModel=class{constructor(h){this._bufferService=h,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.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()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,d=this.selectionEnd;return!(!h||!d)&&(h[1]>d[1]||h[1]===d[1]&&h[0]>d[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(p,c,h){var d=this&&this.__decorate||function(v,x,k,L){var R,N=arguments.length,A=N<3?x:L===null?L=Object.getOwnPropertyDescriptor(x,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,x,k,L);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(x,k,A):R(x,k))||A);return N>3&&A&&Object.defineProperty(x,k,A),A},_=this&&this.__param||function(v,x){return function(k,L){x(k,L,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const g=h(2585),S=h(8460),C=h(844);let T=c.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,x,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new m(v,x,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};c.CharSizeService=T=d([_(2,g.IOptionsService)],T);class w extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(x,k){x!==void 0&&x>0&&k!==void 0&&k>0&&(this._result.width=x,this._result.height=k)}}class m extends w{constructor(x,k,L){super(),this._document=x,this._parentElement=k,this._optionsService=L,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}}class b extends w{constructor(x){super(),this._optionsService=x,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const x=this._ctx.measureText("W");return this._validateAndSet(x.width,x.fontBoundingBoxAscent+x.fontBoundingBoxDescent),this._result}}},4269:function(p,c,h){var d=this&&this.__decorate||function(b,v,x,k){var L,R=arguments.length,N=R<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,x):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,x,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(v,x,N):L(v,x))||N);return R>3&&N&&Object.defineProperty(v,x,N),N},_=this&&this.__param||function(b,v){return function(x,k){v(x,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const g=h(3734),S=h(643),C=h(511),T=h(2585);class w extends g.AttributeData{constructor(v,x,k){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=x,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=w;let m=c.CharacterJoinerService=class Mw{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(v){const x={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(x),x.id}deregister(v){for(let x=0;x<this._characterJoiners.length;x++)if(this._characterJoiners[x].id===v)return this._characterJoiners.splice(x,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const x=this._bufferService.buffer.lines.get(v);if(!x||x.length===0)return[];const k=[],L=x.translateToString(!0);let R=0,N=0,A=0,I=x.getFg(0),K=x.getBg(0);for(let F=0;F<x.getTrimmedLength();F++)if(x.loadCell(F,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==K){if(F-R>1){const G=this._getJoinedRanges(L,A,N,x,R);for(let B=0;B<G.length;B++)k.push(G[B])}R=F,A=N,I=this._workCell.fg,K=this._workCell.bg}N+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const F=this._getJoinedRanges(L,A,N,x,R);for(let G=0;G<F.length;G++)k.push(F[G])}return k}_getJoinedRanges(v,x,k,L,R){const N=v.substring(x,k);let A=[];try{A=this._characterJoiners[0].handler(N)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const K=this._characterJoiners[I].handler(N);for(let F=0;F<K.length;F++)Mw._mergeRanges(A,K[F])}catch(K){console.error(K)}return this._stringRangesToCellRanges(A,L,R),A}_stringRangesToCellRanges(v,x,k){let L=0,R=!1,N=0,A=v[L];if(A){for(let I=k;I<this._bufferService.cols;I++){const K=x.getWidth(I),F=x.getString(I).length||S.WHITESPACE_CELL_CHAR.length;if(K!==0){if(!R&&A[0]<=N&&(A[0]=I,R=!0),A[1]<=N){if(A[1]=I,A=v[++L],!A)break;A[0]<=N?(A[0]=I,R=!0):R=!1}N+=F}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(v,x){let k=!1;for(let L=0;L<v.length;L++){const R=v[L];if(k){if(x[1]<=R[0])return v[L-1][1]=x[1],v;if(x[1]<=R[1])return v[L-1][1]=Math.max(x[1],R[1]),v.splice(L,1),v;v.splice(L,1),L--}else{if(x[1]<=R[0])return v.splice(L,0,x),v;if(x[1]<=R[1])return R[0]=Math.min(x[0],R[0]),v;x[0]<R[1]&&(R[0]=Math.min(x[0],R[0]),k=!0)}}return k?v[v.length-1][1]=x[1]:v.push(x),v}};c.CharacterJoinerService=m=d([_(0,T.IBufferService)],m)},5114:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const d=h(844),_=h(8460),g=h(3656);class S extends d.Disposable{constructor(w,m,b){super(),this._textarea=w,this._window=m,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,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}}c.CoreBrowserService=S;class C extends d.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new d.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,d.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,g.addDisposableDomListener)(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)}}},779:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkProviderService=void 0;const d=h(844);class _ extends d.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,d.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const C=this.linkProviders.indexOf(S);C!==-1&&this.linkProviders.splice(C,1)}}}}c.LinkProviderService=_},8934:function(p,c,h){var d=this&&this.__decorate||function(T,w,m,b){var v,x=arguments.length,k=x<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,w,m,b);else for(var L=T.length-1;L>=0;L--)(v=T[L])&&(k=(x<3?v(k):x>3?v(w,m,k):v(w,m))||k);return x>3&&k&&Object.defineProperty(w,m,k),k},_=this&&this.__param||function(T,w){return function(m,b){w(m,b,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const g=h(4725),S=h(9806);let C=c.MouseService=class{constructor(T,w){this._renderService=T,this._charSizeService=w}getCoords(T,w,m,b,v){return(0,S.getCoords)(window,T,w,m,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(T,w){const m=(0,S.getCoordsRelativeToElement)(window,T,w);if(this._charSizeService.hasValidSize)return m[0]=Math.min(Math.max(m[0],0),this._renderService.dimensions.css.canvas.width-1),m[1]=Math.min(Math.max(m[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(m[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(m[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(m[0]),y:Math.floor(m[1])}}};c.MouseService=C=d([_(0,g.IRenderService),_(1,g.ICharSizeService)],C)},3230:function(p,c,h){var d=this&&this.__decorate||function(v,x,k,L){var R,N=arguments.length,A=N<3?x:L===null?L=Object.getOwnPropertyDescriptor(x,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,x,k,L);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(x,k,A):R(x,k))||A);return N>3&&A&&Object.defineProperty(x,k,A),A},_=this&&this.__param||function(v,x){return function(k,L){x(k,L,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const g=h(6193),S=h(4725),C=h(8460),T=h(844),w=h(7226),m=h(2585);let b=c.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,x,k,L,R,N,A,I){super(),this._rowCount=v,this._charSizeService=L,this._renderer=this.register(new T.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new T.MutableDisposable),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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new g.RenderDebouncer(((K,F)=>this._renderRows(K,F)),A),this.register(this._renderDebouncer),this.register(A.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(N.onResize((()=>this._fullRefresh()))),this.register(N.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(R.onDecorationRegistered((()=>this._fullRefresh()))),this.register(R.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(N.cols,N.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(N.buffer.y,N.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,x),this.register(A.onWindowChange((K=>this._registerIntersectionObserver(K,x))))}_registerIntersectionObserver(v,x){if("IntersectionObserver"in v){const k=new v.IntersectionObserver((L=>this._handleIntersectionChange(L[L.length-1])),{threshold:0});k.observe(x),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.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(v,x,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,x,this._rowCount))}_renderRows(v,x){this._renderer.value&&(v=Math.min(v,this._rowCount-1),x=Math.min(x,this._rowCount-1),this._renderer.value.renderRows(v,x),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:x}),this._onRender.fire({start:v,end:x}),this._isNextRenderRedrawOnly=!0)}resize(v,x){this._rowCount=x,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(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((x=>this.refreshRows(x.start,x.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_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(v,x){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(v,x))):this._renderer.value.handleResize(v,x),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(v,x,k){this._selectionState.start=v,this._selectionState.end=x,this._selectionState.columnSelectMode=k,this._renderer.value?.handleSelectionChanged(v,x,k)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=d([_(2,m.IOptionsService),_(3,S.ICharSizeService),_(4,m.IDecorationService),_(5,m.IBufferService),_(6,S.ICoreBrowserService),_(7,S.IThemeService)],b)},9312:function(p,c,h){var d=this&&this.__decorate||function(A,I,K,F){var G,B=arguments.length,Y=B<3?I:F===null?F=Object.getOwnPropertyDescriptor(I,K):F;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Y=Reflect.decorate(A,I,K,F);else for(var W=A.length-1;W>=0;W--)(G=A[W])&&(Y=(B<3?G(Y):B>3?G(I,K,Y):G(I,K))||Y);return B>3&&Y&&Object.defineProperty(I,K,Y),Y},_=this&&this.__param||function(A,I){return function(K,F){I(K,F,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const g=h(9806),S=h(9504),C=h(456),T=h(4725),w=h(8460),m=h(844),b=h(6114),v=h(4841),x=h(511),k=h(2585),L=" ",R=new RegExp(L,"g");let N=c.SelectionService=class extends m.Disposable{constructor(A,I,K,F,G,B,Y,W,z){super(),this._element=A,this._screenElement=I,this._linkifier=K,this._bufferService=F,this._coreService=G,this._mouseService=B,this._optionsService=Y,this._renderService=W,this._coreBrowserService=z,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new x.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=V=>this._handleMouseMove(V),this._mouseUpListener=V=>this._handleMouseUp(V),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((V=>this._handleTrim(V))),this.register(this._bufferService.buffers.onBufferActivate((V=>this._handleBufferActivate(V)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,m.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!A||!I||A[0]===I[0]&&A[1]===I[1])}get selectionText(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!A||!I)return"";const K=this._bufferService.buffer,F=[];if(this._activeSelectionMode===3){if(A[0]===I[0])return"";const G=A[0]<I[0]?A[0]:I[0],B=A[0]<I[0]?I[0]:A[0];for(let Y=A[1];Y<=I[1];Y++){const W=K.translateBufferLineToString(Y,!0,G,B);F.push(W)}}else{const G=A[1]===I[1]?I[0]:void 0;F.push(K.translateBufferLineToString(A[1],!0,A[0],G));for(let B=A[1]+1;B<=I[1]-1;B++){const Y=K.lines.get(B),W=K.translateBufferLineToString(B,!0);Y?.isWrapped?F[F.length-1]+=W:F.push(W)}if(A[1]!==I[1]){const B=K.lines.get(I[1]),Y=K.translateBufferLineToString(I[1],!0,0,I[0]);B&&B.isWrapped?F[F.length-1]+=Y:F.push(Y)}}return F.map((G=>G.replace(R," "))).join(b.isWindows?`\r
79
+ `:`
80
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(A){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&A&&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(A){const I=this._getMouseBufferCoords(A),K=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!!(K&&F&&I)&&this._areCoordsInSelection(I,K,F)}isCellInSelection(A,I){const K=this._model.finalSelectionStart,F=this._model.finalSelectionEnd;return!(!K||!F)&&this._areCoordsInSelection([A,I],K,F)}_areCoordsInSelection(A,I,K){return A[1]>I[1]&&A[1]<K[1]||I[1]===K[1]&&A[1]===I[1]&&A[0]>=I[0]&&A[0]<K[0]||I[1]<K[1]&&A[1]===K[1]&&A[0]<K[0]||I[1]<K[1]&&A[1]===I[1]&&A[0]>=I[0]}_selectWordAtCursor(A,I){const K=this._linkifier.currentLink?.link?.range;if(K)return this._model.selectionStart=[K.start.x-1,K.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(K,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const F=this._getMouseBufferCoords(A);return!!F&&(this._selectWordAt(F,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,I){this._model.clearSelection(),A=Math.max(A,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const I=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(A){let I=(0,g.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const K=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=K?0:(I>K&&(I-=K),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(A){return b.isMac?A.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:A.shiftKey}handleMouseDown(A){if(this._mouseDownTimeStamp=A.timeStamp,(A.button!==2||!this.hasSelection)&&A.button===0){if(!this._enabled){if(!this.shouldForceSelection(A))return;A.stopPropagation()}A.preventDefault(),this._dragScrollAmount=0,this._enabled&&A.shiftKey?this._handleIncrementalClick(A):A.detail===1?this._handleSingleClick(A):A.detail===2?this._handleDoubleClick(A):A.detail===3&&this._handleTripleClick(A),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()),50)}_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(A){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(A))}_handleSingleClick(A){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(A)?3:0,this._model.selectionStart=this._getMouseBufferCoords(A),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const I=this._getMouseBufferCoords(A);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(A),!this._model.selectionEnd)return void this.refresh(!0);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(A),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const K=this._bufferService.buffer;if(this._model.selectionEnd[1]<K.lines.length){const F=K.lines.get(this._model.selectionEnd[1]);F&&F.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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});const A=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(A.ydisp+this._bufferService.rows,A.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=A.ydisp),this.refresh()}}_handleMouseUp(A){const I=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const K=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(K&&K[0]!==void 0&&K[1]!==void 0){const F=(0,S.moveToCellSequence)(K[0]-1,K[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(F,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,K=!(!A||!I||A[0]===I[0]&&A[1]===I[1]);K?A&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,I,K)):this._oldHasSelection&&this._fireOnSelectionChange(A,I,K)}_fireOnSelectionChange(A,I,K){this._oldSelectionStart=A,this._oldSelectionEnd=I,this._oldHasSelection=K,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(A,I){let K=I;for(let F=0;I>=F;F++){const G=A.loadCell(F,this._workCell).getChars().length;this._workCell.getWidth()===0?K--:G>1&&I!==F&&(K+=G-1)}return K}setSelection(A,I,K){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,I],this._model.selectionStartLength=K,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,I,K=!0,F=!0){if(A[0]>=this._bufferService.cols)return;const G=this._bufferService.buffer,B=G.lines.get(A[1]);if(!B)return;const Y=G.translateBufferLineToString(A[1],!1);let W=this._convertViewportColToCharacterIndex(B,A[0]),z=W;const V=A[0]-W;let X=0,j=0,P=0,D=0;if(Y.charAt(W)===" "){for(;W>0&&Y.charAt(W-1)===" ";)W--;for(;z<Y.length&&Y.charAt(z+1)===" ";)z++}else{let Q=A[0],re=A[0];B.getWidth(Q)===0&&(X++,Q--),B.getWidth(re)===2&&(j++,re++);const ie=B.getString(re).length;for(ie>1&&(D+=ie-1,z+=ie-1);Q>0&&W>0&&!this._isCharWordSeparator(B.loadCell(Q-1,this._workCell));){B.loadCell(Q-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(X++,Q--):Z>1&&(P+=Z-1,W-=Z-1),W--,Q--}for(;re<B.length&&z+1<Y.length&&!this._isCharWordSeparator(B.loadCell(re+1,this._workCell));){B.loadCell(re+1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,re++):Z>1&&(D+=Z-1,z+=Z-1),z++,re++}}z++;let U=W+V-X+P,q=Math.min(this._bufferService.cols,z-W+X+j-P-D);if(I||Y.slice(W,z).trim()!==""){if(K&&U===0&&B.getCodePoint(0)!==32){const Q=G.lines.get(A[1]-1);if(Q&&B.isWrapped&&Q.getCodePoint(this._bufferService.cols-1)!==32){const re=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(re){const ie=this._bufferService.cols-re.start;U-=ie,q+=ie}}}if(F&&U+q===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const Q=G.lines.get(A[1]+1);if(Q?.isWrapped&&Q.getCodePoint(0)!==32){const re=this._getWordAt([0,A[1]+1],!1,!1,!0);re&&(q+=re.length)}}return{start:U,length:q}}}_selectWordAt(A,I){const K=this._getWordAt(A,I);if(K){for(;K.start<0;)K.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[K.start,A[1]],this._model.selectionStartLength=K.length}}_selectToWordAt(A){const I=this._getWordAt(A,!0);if(I){let K=A[1];for(;I.start<0;)I.start+=this._bufferService.cols,K--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,K++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,K]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const I=this._bufferService.buffer.getWrappedRangeForLine(A),K={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(K,this._bufferService.cols)}};c.SelectionService=N=d([_(3,k.IBufferService),_(4,k.ICoreService),_(5,T.IMouseService),_(6,k.IOptionsService),_(7,T.IRenderService),_(8,T.ICoreBrowserService)],N)},4725:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ILinkProviderService=c.IThemeService=c.ICharacterJoinerService=c.ISelectionService=c.IRenderService=c.IMouseService=c.ICoreBrowserService=c.ICharSizeService=void 0;const d=h(8343);c.ICharSizeService=(0,d.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,d.createDecorator)("CoreBrowserService"),c.IMouseService=(0,d.createDecorator)("MouseService"),c.IRenderService=(0,d.createDecorator)("RenderService"),c.ISelectionService=(0,d.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,d.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,d.createDecorator)("ThemeService"),c.ILinkProviderService=(0,d.createDecorator)("LinkProviderService")},6731:function(p,c,h){var d=this&&this.__decorate||function(N,A,I,K){var F,G=arguments.length,B=G<3?A:K===null?K=Object.getOwnPropertyDescriptor(A,I):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(N,A,I,K);else for(var Y=N.length-1;Y>=0;Y--)(F=N[Y])&&(B=(G<3?F(B):G>3?F(A,I,B):F(A,I))||B);return G>3&&B&&Object.defineProperty(A,I,B),B},_=this&&this.__param||function(N,A){return function(I,K){A(I,K,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const g=h(7239),S=h(8055),C=h(8460),T=h(844),w=h(2585),m=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),v=S.css.toColor("#ffffff"),x=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let I=0;I<216;I++){const K=A[I/36%6|0],F=A[I/6%6|0],G=A[I%6];N.push({css:S.channels.toCss(K,F,G),rgba:S.channels.toRgba(K,F,G)})}for(let I=0;I<24;I++){const K=8+10*I;N.push({css:S.channels.toCss(K,K,K),rgba:S.channels.toRgba(K,K,K)})}return N})());let L=c.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new g.ColorContrastCache,this._halfContrastCache=new g.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:m,background:b,cursor:v,cursorAccent:x,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:c.DEFAULT_ANSI_COLORS.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))))}_setTheme(N={}){const A=this._colors;if(A.foreground=R(N.foreground,m),A.background=R(N.background,b),A.cursor=R(N.cursor,v),A.cursorAccent=R(N.cursorAccent,x),A.selectionBackgroundTransparent=R(N.selectionBackground,k),A.selectionBackgroundOpaque=S.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=R(N.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=S.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=N.selectionForeground?R(N.selectionForeground,S.NULL_COLOR):void 0,A.selectionForeground===S.NULL_COLOR&&(A.selectionForeground=void 0),S.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=S.color.opacity(A.selectionBackgroundTransparent,.3)),S.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=S.color.opacity(A.selectionInactiveBackgroundTransparent,.3)),A.ansi=c.DEFAULT_ANSI_COLORS.slice(),A.ansi[0]=R(N.black,c.DEFAULT_ANSI_COLORS[0]),A.ansi[1]=R(N.red,c.DEFAULT_ANSI_COLORS[1]),A.ansi[2]=R(N.green,c.DEFAULT_ANSI_COLORS[2]),A.ansi[3]=R(N.yellow,c.DEFAULT_ANSI_COLORS[3]),A.ansi[4]=R(N.blue,c.DEFAULT_ANSI_COLORS[4]),A.ansi[5]=R(N.magenta,c.DEFAULT_ANSI_COLORS[5]),A.ansi[6]=R(N.cyan,c.DEFAULT_ANSI_COLORS[6]),A.ansi[7]=R(N.white,c.DEFAULT_ANSI_COLORS[7]),A.ansi[8]=R(N.brightBlack,c.DEFAULT_ANSI_COLORS[8]),A.ansi[9]=R(N.brightRed,c.DEFAULT_ANSI_COLORS[9]),A.ansi[10]=R(N.brightGreen,c.DEFAULT_ANSI_COLORS[10]),A.ansi[11]=R(N.brightYellow,c.DEFAULT_ANSI_COLORS[11]),A.ansi[12]=R(N.brightBlue,c.DEFAULT_ANSI_COLORS[12]),A.ansi[13]=R(N.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),A.ansi[14]=R(N.brightCyan,c.DEFAULT_ANSI_COLORS[14]),A.ansi[15]=R(N.brightWhite,c.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const I=Math.min(A.ansi.length-16,N.extendedAnsi.length);for(let K=0;K<I;K++)A.ansi[K+16]=R(N.extendedAnsi[K],c.DEFAULT_ANSI_COLORS[K+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(N){this._restoreColor(N),this._onChangeColors.fire(this.colors)}_restoreColor(N){if(N!==void 0)switch(N){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[N]=this._restoreColors.ansi[N]}else for(let A=0;A<this._restoreColors.ansi.length;++A)this._colors.ansi[A]=this._restoreColors.ansi[A]}modifyColors(N){N(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()}}};function R(N,A){if(N!==void 0)try{return S.css.toColor(N)}catch{}return A}c.ThemeService=L=d([_(0,w.IOptionsService)],L)},6349:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const d=h(8460),_=h(844);class g extends _.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new d.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new d.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new d.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const T=new Array(C);for(let w=0;w<Math.min(C,this.length);w++)T[w]=this._array[this._getCyclicIndex(w)];this._array=T,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let T=this._length;T<C;T++)this._array[T]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,T){this._array[this._getCyclicIndex(C)]=T}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,T,...w){if(T){for(let m=C;m<this._length-T;m++)this._array[this._getCyclicIndex(m)]=this._array[this._getCyclicIndex(m+T)];this._length-=T,this.onDeleteEmitter.fire({index:C,amount:T})}for(let m=this._length-1;m>=C;m--)this._array[this._getCyclicIndex(m+w.length)]=this._array[this._getCyclicIndex(m)];for(let m=0;m<w.length;m++)this._array[this._getCyclicIndex(C+m)]=w[m];if(w.length&&this.onInsertEmitter.fire({index:C,amount:w.length}),this._length+w.length>this._maxLength){const m=this._length+w.length-this._maxLength;this._startIndex+=m,this._length=this._maxLength,this.onTrimEmitter.fire(m)}else this._length+=w.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,T,w){if(!(T<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let b=T-1;b>=0;b--)this.set(C+b+w,this.get(C+b));const m=C+T+w-this._length;if(m>0)for(this._length+=m;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let m=0;m<T;m++)this.set(C+m+w,this.get(C+m))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}c.CircularList=g},1439:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(d,_=5){if(typeof d!="object")return d;const g=Array.isArray(d)?[]:{};for(const S in d)g[S]=_<=1?d[S]:d[S]&&h(d[S],_-1);return g}},8055:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.contrastRatio=c.toPaddedHex=c.rgba=c.rgb=c.css=c.color=c.channels=c.NULL_COLOR=void 0;let h=0,d=0,_=0,g=0;var S,C,T,w,m;function b(x){const k=x.toString(16);return k.length<2?"0"+k:k}function v(x,k){return x<k?(k+.05)/(x+.05):(x+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(x){x.toCss=function(k,L,R,N){return N!==void 0?`#${b(k)}${b(L)}${b(R)}${b(N)}`:`#${b(k)}${b(L)}${b(R)}`},x.toRgba=function(k,L,R,N=255){return(k<<24|L<<16|R<<8|N)>>>0},x.toColor=function(k,L,R,N){return{css:x.toCss(k,L,R,N),rgba:x.toRgba(k,L,R,N)}}})(S||(c.channels=S={})),(function(x){function k(L,R){return g=Math.round(255*R),[h,d,_]=m.toChannels(L.rgba),{css:S.toCss(h,d,_,g),rgba:S.toRgba(h,d,_,g)}}x.blend=function(L,R){if(g=(255&R.rgba)/255,g===1)return{css:R.css,rgba:R.rgba};const N=R.rgba>>24&255,A=R.rgba>>16&255,I=R.rgba>>8&255,K=L.rgba>>24&255,F=L.rgba>>16&255,G=L.rgba>>8&255;return h=K+Math.round((N-K)*g),d=F+Math.round((A-F)*g),_=G+Math.round((I-G)*g),{css:S.toCss(h,d,_),rgba:S.toRgba(h,d,_)}},x.isOpaque=function(L){return(255&L.rgba)==255},x.ensureContrastRatio=function(L,R,N){const A=m.ensureContrastRatio(L.rgba,R.rgba,N);if(A)return S.toColor(A>>24&255,A>>16&255,A>>8&255)},x.opaque=function(L){const R=(255|L.rgba)>>>0;return[h,d,_]=m.toChannels(R),{css:S.toCss(h,d,_),rgba:R}},x.opacity=k,x.multiplyOpacity=function(L,R){return g=255&L.rgba,k(L,g*R/255)},x.toColorRGB=function(L){return[L.rgba>>24&255,L.rgba>>16&255,L.rgba>>8&255]}})(C||(c.color=C={})),(function(x){let k,L;try{const R=document.createElement("canvas");R.width=1,R.height=1;const N=R.getContext("2d",{willReadFrequently:!0});N&&(k=N,k.globalCompositeOperation="copy",L=k.createLinearGradient(0,0,1,1))}catch{}x.toColor=function(R){if(R.match(/#[\da-f]{3,8}/i))switch(R.length){case 4:return h=parseInt(R.slice(1,2).repeat(2),16),d=parseInt(R.slice(2,3).repeat(2),16),_=parseInt(R.slice(3,4).repeat(2),16),S.toColor(h,d,_);case 5:return h=parseInt(R.slice(1,2).repeat(2),16),d=parseInt(R.slice(2,3).repeat(2),16),_=parseInt(R.slice(3,4).repeat(2),16),g=parseInt(R.slice(4,5).repeat(2),16),S.toColor(h,d,_,g);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}}const N=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(N)return h=parseInt(N[1]),d=parseInt(N[2]),_=parseInt(N[3]),g=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),S.toColor(h,d,_,g);if(!k||!L)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=L,k.fillStyle=R,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[h,d,_,g]=k.getImageData(0,0,1,1).data,g!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(h,d,_,g),css:R}}})(T||(c.css=T={})),(function(x){function k(L,R,N){const A=L/255,I=R/255,K=N/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(K<=.03928?K/12.92:Math.pow((K+.055)/1.055,2.4))}x.relativeLuminance=function(L){return k(L>>16&255,L>>8&255,255&L)},x.relativeLuminance2=k})(w||(c.rgb=w={})),(function(x){function k(R,N,A){const I=R>>24&255,K=R>>16&255,F=R>>8&255;let G=N>>24&255,B=N>>16&255,Y=N>>8&255,W=v(w.relativeLuminance2(G,B,Y),w.relativeLuminance2(I,K,F));for(;W<A&&(G>0||B>0||Y>0);)G-=Math.max(0,Math.ceil(.1*G)),B-=Math.max(0,Math.ceil(.1*B)),Y-=Math.max(0,Math.ceil(.1*Y)),W=v(w.relativeLuminance2(G,B,Y),w.relativeLuminance2(I,K,F));return(G<<24|B<<16|Y<<8|255)>>>0}function L(R,N,A){const I=R>>24&255,K=R>>16&255,F=R>>8&255;let G=N>>24&255,B=N>>16&255,Y=N>>8&255,W=v(w.relativeLuminance2(G,B,Y),w.relativeLuminance2(I,K,F));for(;W<A&&(G<255||B<255||Y<255);)G=Math.min(255,G+Math.ceil(.1*(255-G))),B=Math.min(255,B+Math.ceil(.1*(255-B))),Y=Math.min(255,Y+Math.ceil(.1*(255-Y))),W=v(w.relativeLuminance2(G,B,Y),w.relativeLuminance2(I,K,F));return(G<<24|B<<16|Y<<8|255)>>>0}x.blend=function(R,N){if(g=(255&N)/255,g===1)return N;const A=N>>24&255,I=N>>16&255,K=N>>8&255,F=R>>24&255,G=R>>16&255,B=R>>8&255;return h=F+Math.round((A-F)*g),d=G+Math.round((I-G)*g),_=B+Math.round((K-B)*g),S.toRgba(h,d,_)},x.ensureContrastRatio=function(R,N,A){const I=w.relativeLuminance(R>>8),K=w.relativeLuminance(N>>8);if(v(I,K)<A){if(K<I){const B=k(R,N,A),Y=v(I,w.relativeLuminance(B>>8));if(Y<A){const W=L(R,N,A);return Y>v(I,w.relativeLuminance(W>>8))?B:W}return B}const F=L(R,N,A),G=v(I,w.relativeLuminance(F>>8));if(G<A){const B=k(R,N,A);return G>v(I,w.relativeLuminance(B>>8))?F:B}return F}},x.reduceLuminance=k,x.increaseLuminance=L,x.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(m||(c.rgba=m={})),c.toPaddedHex=b,c.contrastRatio=v},8969:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const d=h(844),_=h(2585),g=h(4348),S=h(7866),C=h(744),T=h(7302),w=h(6975),m=h(8460),b=h(1753),v=h(1480),x=h(7994),k=h(9282),L=h(5435),R=h(5981),N=h(2660);let A=!1;class I extends d.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event((F=>{this._onScrollApi?.fire(F.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(F){for(const G in F)this.optionsService.options[G]=F[G]}constructor(F){super(),this._windowsWrappingHeuristics=this.register(new d.MutableDisposable),this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new m.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new m.EventEmitter),this._instantiationService=new g.InstantiationService,this.optionsService=this.register(new T.OptionsService(F)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(x.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new L.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,m.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,m.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,m.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,m.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new R.WriteBuffer(((G,B)=>this._inputHandler.parse(G,B)))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(F,G){this._writeBuffer.write(F,G)}writeSync(F,G){this._logService.logLevel<=_.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(F,G)}input(F,G=!0){this.coreService.triggerDataEvent(F,G)}resize(F,G){isNaN(F)||isNaN(G)||(F=Math.max(F,C.MINIMUM_COLS),G=Math.max(G,C.MINIMUM_ROWS),this._bufferService.resize(F,G))}scroll(F,G=!1){this._bufferService.scroll(F,G)}scrollLines(F,G,B){this._bufferService.scrollLines(F,G,B)}scrollPages(F){this.scrollLines(F*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(F){const G=F-this._bufferService.buffer.ydisp;G!==0&&this.scrollLines(G)}registerEscHandler(F,G){return this._inputHandler.registerEscHandler(F,G)}registerDcsHandler(F,G){return this._inputHandler.registerDcsHandler(F,G)}registerCsiHandler(F,G){return this._inputHandler.registerCsiHandler(F,G)}registerOscHandler(F,G){return this._inputHandler.registerOscHandler(F,G)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let F=!1;const G=this.optionsService.rawOptions.windowsPty;G&&G.buildNumber!==void 0&&G.buildNumber!==void 0?F=G.backend==="conpty"&&G.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(F=!0),F?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const F=[];F.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),F.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,d.toDisposable)((()=>{for(const G of F)G.dispose()}))}}}c.CoreTerminal=I},8460:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let d=0;d<this._listeners.length;d++)if(this._listeners[d]===h)return void this._listeners.splice(d,1)}}})),this._event}fire(h,d){const _=[];for(let g=0;g<this._listeners.length;g++)_.push(this._listeners[g]);for(let g=0;g<_.length;g++)_[g].call(void 0,h,d)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,d){return h((_=>d.fire(_)))},c.runAndSubscribe=function(h,d){return d(void 0),h((_=>d(_)))}},5435:function(p,c,h){var d=this&&this.__decorate||function(X,j,P,D){var U,q=arguments.length,Q=q<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,P):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Q=Reflect.decorate(X,j,P,D);else for(var re=X.length-1;re>=0;re--)(U=X[re])&&(Q=(q<3?U(Q):q>3?U(j,P,Q):U(j,P))||Q);return q>3&&Q&&Object.defineProperty(j,P,Q),Q},_=this&&this.__param||function(X,j){return function(P,D){j(P,D,X)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const g=h(2584),S=h(7116),C=h(2015),T=h(844),w=h(482),m=h(8437),b=h(8460),v=h(643),x=h(511),k=h(3734),L=h(2585),R=h(1480),N=h(6242),A=h(6351),I=h(5941),K={"(":0,")":1,"*":2,"+":3,"-":1,".":2},F=131072;function G(X,j){if(X>24)return j.setWinLines||!1;switch(X){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var B;(function(X){X[X.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",X[X.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(c.WindowsOptionsReportType=B={}));let Y=0;class W extends T.Disposable{getAttrData(){return this._curAttrData}constructor(j,P,D,U,q,Q,re,ie,Z=new C.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=P,this._coreService=D,this._logService=U,this._optionsService=q,this._oscLinkService=Q,this._coreMouseService=re,this._unicodeService=ie,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new x.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),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 z(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((H=>this._activeBuffer=H.activeBuffer))),this._parser.setCsiHandlerFallback(((H,oe)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(H),params:oe.toArray()})})),this._parser.setEscHandlerFallback((H=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(H)})})),this._parser.setExecuteHandlerFallback((H=>{this._logService.debug("Unknown EXECUTE code: ",{code:H})})),this._parser.setOscHandlerFallback(((H,oe,fe)=>{this._logService.debug("Unknown OSC code: ",{identifier:H,action:oe,data:fe})})),this._parser.setDcsHandlerFallback(((H,oe,fe)=>{oe==="HOOK"&&(fe=fe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(H),action:oe,payload:fe})})),this._parser.setPrintHandler(((H,oe,fe)=>this.print(H,oe,fe))),this._parser.registerCsiHandler({final:"@"},(H=>this.insertChars(H))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(H=>this.scrollLeft(H))),this._parser.registerCsiHandler({final:"A"},(H=>this.cursorUp(H))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(H=>this.scrollRight(H))),this._parser.registerCsiHandler({final:"B"},(H=>this.cursorDown(H))),this._parser.registerCsiHandler({final:"C"},(H=>this.cursorForward(H))),this._parser.registerCsiHandler({final:"D"},(H=>this.cursorBackward(H))),this._parser.registerCsiHandler({final:"E"},(H=>this.cursorNextLine(H))),this._parser.registerCsiHandler({final:"F"},(H=>this.cursorPrecedingLine(H))),this._parser.registerCsiHandler({final:"G"},(H=>this.cursorCharAbsolute(H))),this._parser.registerCsiHandler({final:"H"},(H=>this.cursorPosition(H))),this._parser.registerCsiHandler({final:"I"},(H=>this.cursorForwardTab(H))),this._parser.registerCsiHandler({final:"J"},(H=>this.eraseInDisplay(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(H=>this.eraseInDisplay(H,!0))),this._parser.registerCsiHandler({final:"K"},(H=>this.eraseInLine(H,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(H=>this.eraseInLine(H,!0))),this._parser.registerCsiHandler({final:"L"},(H=>this.insertLines(H))),this._parser.registerCsiHandler({final:"M"},(H=>this.deleteLines(H))),this._parser.registerCsiHandler({final:"P"},(H=>this.deleteChars(H))),this._parser.registerCsiHandler({final:"S"},(H=>this.scrollUp(H))),this._parser.registerCsiHandler({final:"T"},(H=>this.scrollDown(H))),this._parser.registerCsiHandler({final:"X"},(H=>this.eraseChars(H))),this._parser.registerCsiHandler({final:"Z"},(H=>this.cursorBackwardTab(H))),this._parser.registerCsiHandler({final:"`"},(H=>this.charPosAbsolute(H))),this._parser.registerCsiHandler({final:"a"},(H=>this.hPositionRelative(H))),this._parser.registerCsiHandler({final:"b"},(H=>this.repeatPrecedingCharacter(H))),this._parser.registerCsiHandler({final:"c"},(H=>this.sendDeviceAttributesPrimary(H))),this._parser.registerCsiHandler({prefix:">",final:"c"},(H=>this.sendDeviceAttributesSecondary(H))),this._parser.registerCsiHandler({final:"d"},(H=>this.linePosAbsolute(H))),this._parser.registerCsiHandler({final:"e"},(H=>this.vPositionRelative(H))),this._parser.registerCsiHandler({final:"f"},(H=>this.hVPosition(H))),this._parser.registerCsiHandler({final:"g"},(H=>this.tabClear(H))),this._parser.registerCsiHandler({final:"h"},(H=>this.setMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(H=>this.setModePrivate(H))),this._parser.registerCsiHandler({final:"l"},(H=>this.resetMode(H))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(H=>this.resetModePrivate(H))),this._parser.registerCsiHandler({final:"m"},(H=>this.charAttributes(H))),this._parser.registerCsiHandler({final:"n"},(H=>this.deviceStatus(H))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(H=>this.deviceStatusPrivate(H))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(H=>this.softReset(H))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(H=>this.setCursorStyle(H))),this._parser.registerCsiHandler({final:"r"},(H=>this.setScrollRegion(H))),this._parser.registerCsiHandler({final:"s"},(H=>this.saveCursor(H))),this._parser.registerCsiHandler({final:"t"},(H=>this.windowOptions(H))),this._parser.registerCsiHandler({final:"u"},(H=>this.restoreCursor(H))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(H=>this.insertColumns(H))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(H=>this.deleteColumns(H))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(H=>this.selectProtected(H))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(H=>this.requestMode(H,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(H=>this.requestMode(H,!1))),this._parser.setExecuteHandler(g.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(g.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(g.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(g.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(g.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(g.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(g.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(g.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(g.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(g.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(g.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(g.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new N.OscHandler((H=>(this.setTitle(H),this.setIconName(H),!0)))),this._parser.registerOscHandler(1,new N.OscHandler((H=>this.setIconName(H)))),this._parser.registerOscHandler(2,new N.OscHandler((H=>this.setTitle(H)))),this._parser.registerOscHandler(4,new N.OscHandler((H=>this.setOrReportIndexedColor(H)))),this._parser.registerOscHandler(8,new N.OscHandler((H=>this.setHyperlink(H)))),this._parser.registerOscHandler(10,new N.OscHandler((H=>this.setOrReportFgColor(H)))),this._parser.registerOscHandler(11,new N.OscHandler((H=>this.setOrReportBgColor(H)))),this._parser.registerOscHandler(12,new N.OscHandler((H=>this.setOrReportCursorColor(H)))),this._parser.registerOscHandler(104,new N.OscHandler((H=>this.restoreIndexedColor(H)))),this._parser.registerOscHandler(110,new N.OscHandler((H=>this.restoreFgColor(H)))),this._parser.registerOscHandler(111,new N.OscHandler((H=>this.restoreBgColor(H)))),this._parser.registerOscHandler(112,new N.OscHandler((H=>this.restoreCursorColor(H)))),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(const H in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:H},(()=>this.selectCharset("("+H))),this._parser.registerEscHandler({intermediates:")",final:H},(()=>this.selectCharset(")"+H))),this._parser.registerEscHandler({intermediates:"*",final:H},(()=>this.selectCharset("*"+H))),this._parser.registerEscHandler({intermediates:"+",final:H},(()=>this.selectCharset("+"+H))),this._parser.registerEscHandler({intermediates:"-",final:H},(()=>this.selectCharset("-"+H))),this._parser.registerEscHandler({intermediates:".",final:H},(()=>this.selectCharset("."+H))),this._parser.registerEscHandler({intermediates:"/",final:H},(()=>this.selectCharset("/"+H)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((H=>(this._logService.error("Parsing error: ",H),H))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new A.DcsHandler(((H,oe)=>this.requestStatusString(H,oe))))}_preserveStack(j,P,D,U){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=P,this._parseStack.decodedLength=D,this._parseStack.position=U}_logSlowResolvingAsync(j){this._logService.logLevel<=L.LogLevelEnum.WARN&&Promise.race([j,new Promise(((P,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((P=>{if(P!=="#SLOW_TIMEOUT")throw P;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(j,P){let D,U=this._activeBuffer.x,q=this._activeBuffer.y,Q=0;const re=this._parseStack.paused;if(re){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,P))return this._logSlowResolvingAsync(D),D;U=this._parseStack.cursorStartX,q=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>F&&(Q=this._parseStack.position+F)}if(this._logService.logLevel<=L.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof j=="string"?` "${j}"`:` "${Array.prototype.map.call(j,(H=>String.fromCharCode(H))).join("")}"`),typeof j=="string"?j.split("").map((H=>H.charCodeAt(0))):j),this._parseBuffer.length<j.length&&this._parseBuffer.length<F&&(this._parseBuffer=new Uint32Array(Math.min(j.length,F))),re||this._dirtyRowTracker.clearRange(),j.length>F)for(let H=Q;H<j.length;H+=F){const oe=H+F<j.length?H+F:j.length,fe=typeof j=="string"?this._stringDecoder.decode(j.substring(H,oe),this._parseBuffer):this._utf8Decoder.decode(j.subarray(H,oe),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,fe))return this._preserveStack(U,q,fe,H),this._logSlowResolvingAsync(D),D}else if(!re){const H=typeof j=="string"?this._stringDecoder.decode(j,this._parseBuffer):this._utf8Decoder.decode(j,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,H))return this._preserveStack(U,q,H,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===U&&this._activeBuffer.y===q||this._onCursorMove.fire();const ie=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Z,this._bufferService.rows-1),Math.min(ie,this._bufferService.rows-1))}print(j,P,D){let U,q;const Q=this._charsetService.charset,re=this._optionsService.rawOptions.screenReaderMode,ie=this._bufferService.cols,Z=this._coreService.decPrivateModes.wraparound,H=this._coreService.modes.insertMode,oe=this._curAttrData;let fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-P>0&&fe.getWidth(this._activeBuffer.x-1)===2&&fe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,oe);let Se=this._parser.precedingJoinState;for(let ye=P;ye<D;++ye){if(U=j[ye],U<127&&Q){const Ke=Q[String.fromCharCode(U)];Ke&&(U=Ke.charCodeAt(0))}const De=this._unicodeService.charProperties(U,Se);q=R.UnicodeService.extractWidth(De);const Fe=R.UnicodeService.extractShouldJoin(De),Be=Fe?R.UnicodeService.extractWidth(Se):0;if(Se=De,re&&this._onA11yChar.fire((0,w.stringFromCodePoint)(U)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+q-Be>ie){if(Z){const Ke=fe;let ke=this._activeBuffer.x-Be;for(this._activeBuffer.x=Be,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),fe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Be>0&&fe instanceof m.BufferLine&&fe.copyCellsFrom(Ke,ke,0,Be,!1);ke<ie;)Ke.setCellFromCodepoint(ke++,0,1,oe)}else if(this._activeBuffer.x=ie-1,q===2)continue}if(Fe&&this._activeBuffer.x){const Ke=fe.getWidth(this._activeBuffer.x-1)?1:2;fe.addCodepointToCell(this._activeBuffer.x-Ke,U,q);for(let ke=q-Be;--ke>=0;)fe.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}else if(H&&(fe.insertCells(this._activeBuffer.x,q-Be,this._activeBuffer.getNullCell(oe)),fe.getWidth(ie-1)===2&&fe.setCellFromCodepoint(ie-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,oe)),fe.setCellFromCodepoint(this._activeBuffer.x++,U,q,oe),q>0)for(;--q;)fe.setCellFromCodepoint(this._activeBuffer.x++,0,0,oe)}this._parser.precedingJoinState=Se,this._activeBuffer.x<ie&&D-P>0&&fe.getWidth(this._activeBuffer.x)===0&&!fe.hasContent(this._activeBuffer.x)&&fe.setCellFromCodepoint(this._activeBuffer.x,0,1,oe),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,P){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,P):this._parser.registerCsiHandler(j,(D=>!G(D.params[0],this._optionsService.rawOptions.windowOptions)||P(D)))}registerDcsHandler(j,P){return this._parser.registerDcsHandler(j,new A.DcsHandler(P))}registerEscHandler(j,P){return this._parser.registerEscHandler(j,P)}registerOscHandler(j,P){return this._parser.registerOscHandler(j,new N.OscHandler(P))}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;const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);j.hasWidth(this._activeBuffer.x)&&!j.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const j=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-j),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(j=this._bufferService.cols-1){this._activeBuffer.x=Math.min(j,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(j,P){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+P):(this._activeBuffer.x=j,this._activeBuffer.y=P),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,P){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+P)}cursorUp(j){const P=this._activeBuffer.y-this._activeBuffer.scrollTop;return P>=0?this._moveCursor(0,-Math.min(P,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const P=this._activeBuffer.scrollBottom-this._activeBuffer.y;return P>=0?this._moveCursor(0,Math.min(P,j.params[0]||1)):this._moveCursor(0,j.params[0]||1),!0}cursorForward(j){return this._moveCursor(j.params[0]||1,0),!0}cursorBackward(j){return this._moveCursor(-(j.params[0]||1),0),!0}cursorNextLine(j){return this.cursorDown(j),this._activeBuffer.x=0,!0}cursorPrecedingLine(j){return this.cursorUp(j),this._activeBuffer.x=0,!0}cursorCharAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(j){return this._setCursor(j.length>=2?(j.params[1]||1)-1:0,(j.params[0]||1)-1),!0}charPosAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(j){return this._moveCursor(j.params[0]||1,0),!0}linePosAbsolute(j){return this._setCursor(this._activeBuffer.x,(j.params[0]||1)-1),!0}vPositionRelative(j){return this._moveCursor(0,j.params[0]||1),!0}hVPosition(j){return this.cursorPosition(j),!0}tabClear(j){const P=j.params[0];return P===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:P===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=j.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let P=j.params[0]||1;for(;P--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const P=j.params[0];return P===1&&(this._curAttrData.bg|=536870912),P!==2&&P!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,P,D,U=!1,q=!1){const Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);Q.replaceCells(P,D,this._activeBuffer.getNullCell(this._eraseAttrData()),q),U&&(Q.isWrapped=!1)}_resetBufferLine(j,P=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),P),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),D.isWrapped=!1)}eraseInDisplay(j,P=!1){let D;switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);D<this._bufferService.rows;D++)this._resetBufferLine(D,P);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,P),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,P);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,P);this._dirtyRowTracker.markDirty(0);break;case 3:const U=this._activeBuffer.lines.length-this._bufferService.rows;U>0&&(this._activeBuffer.lines.trimStart(U),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-U,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-U,0),this._onScroll.fire(0))}return!0}eraseInLine(j,P=!1){switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,P);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,P);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,P)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(j){this._restrictCursor();let P=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,q=this._bufferService.rows-1+this._activeBuffer.ybase-U+1;for(;P--;)this._activeBuffer.lines.splice(q-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(j){this._restrictCursor();let P=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let U;for(U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-U;P--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(j){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.insertCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(j){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let P=j.params[0]||1;for(;P--;)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(j){let P=j.params[0]||1;for(;P--;)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(m.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.deleteCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.insertCells(0,P,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.insertCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const P=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.deleteCells(this._activeBuffer.x,P,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return P&&(P.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(j.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(j){const P=this._parser.precedingJoinState;if(!P)return!0;const D=j.params[0]||1,U=R.UnicodeService.extractWidth(P),q=this._activeBuffer.x-U,Q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(q),re=new Uint32Array(Q.length*D);let ie=0;for(let H=0;H<Q.length;){const oe=Q.codePointAt(H)||0;re[ie++]=oe,H+=oe>65535?2:1}let Z=ie;for(let H=1;H<D;++H)re.copyWithin(Z,0,ie),Z+=ie;return this.print(re,0,Z),!0}sendDeviceAttributesPrimary(j){return j.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(g.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(g.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(j){return j.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(g.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(g.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(j.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(g.C0.ESC+"[>83;40003;0c")),!0}_is(j){return(this._optionsService.rawOptions.termName+"").indexOf(j)===0}setMode(j){for(let P=0;P<j.length;P++)switch(j.params[P]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let P=0;P<j.length;P++)switch(j.params[P]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(j){for(let P=0;P<j.length;P++)switch(j.params[P]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let P=0;P<j.length;P++)switch(j.params[P]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),j.params[P]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(j,P){const D=this._coreService.decPrivateModes,{activeProtocol:U,activeEncoding:q}=this._coreMouseService,Q=this._coreService,{buffers:re,cols:ie}=this._bufferService,{active:Z,alt:H}=re,oe=this._optionsService.rawOptions,fe=Fe=>Fe?1:2,Se=j.params[0];return ye=Se,De=P?Se===2?4:Se===4?fe(Q.modes.insertMode):Se===12?3:Se===20?fe(oe.convertEol):0:Se===1?fe(D.applicationCursorKeys):Se===3?oe.windowOptions.setWinLines?ie===80?2:ie===132?1:0:0:Se===6?fe(D.origin):Se===7?fe(D.wraparound):Se===8?3:Se===9?fe(U==="X10"):Se===12?fe(oe.cursorBlink):Se===25?fe(!Q.isCursorHidden):Se===45?fe(D.reverseWraparound):Se===66?fe(D.applicationKeypad):Se===67?4:Se===1e3?fe(U==="VT200"):Se===1002?fe(U==="DRAG"):Se===1003?fe(U==="ANY"):Se===1004?fe(D.sendFocus):Se===1005?4:Se===1006?fe(q==="SGR"):Se===1015?4:Se===1016?fe(q==="SGR_PIXELS"):Se===1048?1:Se===47||Se===1047||Se===1049?fe(Z===H):Se===2004?fe(D.bracketedPasteMode):0,Q.triggerDataEvent(`${g.C0.ESC}[${P?"":"?"}${ye};${De}$y`),!0;var ye,De}_updateAttrColor(j,P,D,U,q){return P===2?(j|=50331648,j&=-16777216,j|=k.AttributeData.fromColorRGB([D,U,q])):P===5&&(j&=-50331904,j|=33554432|255&D),j}_extractColor(j,P,D){const U=[0,0,-1,0,0,0];let q=0,Q=0;do{if(U[Q+q]=j.params[P+Q],j.hasSubParams(P+Q)){const re=j.getSubParams(P+Q);let ie=0;do U[1]===5&&(q=1),U[Q+ie+1+q]=re[ie];while(++ie<re.length&&ie+Q+1+q<U.length);break}if(U[1]===5&&Q+q>=2||U[1]===2&&Q+q>=5)break;U[1]&&(q=1)}while(++Q+P<j.length&&Q+q<U.length);for(let re=2;re<U.length;++re)U[re]===-1&&(U[re]=0);switch(U[0]){case 38:D.fg=this._updateAttrColor(D.fg,U[1],U[3],U[4],U[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,U[1],U[3],U[4],U[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,U[1],U[3],U[4],U[5])}return Q}_processUnderline(j,P){P.extended=P.extended.clone(),(!~j||j>5)&&(j=1),P.extended.underlineStyle=j,P.fg|=268435456,j===0&&(P.fg&=-268435457),P.updateExtended()}_processSGR0(j){j.fg=m.DEFAULT_ATTR_DATA.fg,j.bg=m.DEFAULT_ATTR_DATA.bg,j.extended=j.extended.clone(),j.extended.underlineStyle=0,j.extended.underlineColor&=-67108864,j.updateExtended()}charAttributes(j){if(j.length===1&&j.params[0]===0)return this._processSGR0(this._curAttrData),!0;const P=j.length;let D;const U=this._curAttrData;for(let q=0;q<P;q++)D=j.params[q],D>=30&&D<=37?(U.fg&=-50331904,U.fg|=16777216|D-30):D>=40&&D<=47?(U.bg&=-50331904,U.bg|=16777216|D-40):D>=90&&D<=97?(U.fg&=-50331904,U.fg|=16777224|D-90):D>=100&&D<=107?(U.bg&=-50331904,U.bg|=16777224|D-100):D===0?this._processSGR0(U):D===1?U.fg|=134217728:D===3?U.bg|=67108864:D===4?(U.fg|=268435456,this._processUnderline(j.hasSubParams(q)?j.getSubParams(q)[0]:1,U)):D===5?U.fg|=536870912:D===7?U.fg|=67108864:D===8?U.fg|=1073741824:D===9?U.fg|=2147483648:D===2?U.bg|=134217728:D===21?this._processUnderline(2,U):D===22?(U.fg&=-134217729,U.bg&=-134217729):D===23?U.bg&=-67108865:D===24?(U.fg&=-268435457,this._processUnderline(0,U)):D===25?U.fg&=-536870913:D===27?U.fg&=-67108865:D===28?U.fg&=-1073741825:D===29?U.fg&=2147483647:D===39?(U.fg&=-67108864,U.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):D===49?(U.bg&=-67108864,U.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?q+=this._extractColor(j,q,U):D===53?U.bg|=1073741824:D===55?U.bg&=-1073741825:D===59?(U.extended=U.extended.clone(),U.extended.underlineColor=-1,U.updateExtended()):D===100?(U.fg&=-67108864,U.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,U.bg&=-67108864,U.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(j){switch(j.params[0]){case 5:this._coreService.triggerDataEvent(`${g.C0.ESC}[0n`);break;case 6:const P=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[${P};${D}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const P=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[?${P};${D}R`)}return!0}softReset(j){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=m.DEFAULT_ATTR_DATA.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(j){const P=j.params[0]||1;switch(P){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const D=P%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(j){const P=j.params[0]||1;let D;return(j.length<2||(D=j.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>P&&(this._activeBuffer.scrollTop=P-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(j){if(!G(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const P=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:P!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${g.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:P!==0&&P!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),P!==0&&P!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:P!==0&&P!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),P!==0&&P!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(j){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(j){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(j){return this._windowTitle=j,this._onTitleChange.fire(j),!0}setIconName(j){return this._iconName=j,!0}setOrReportIndexedColor(j){const P=[],D=j.split(";");for(;D.length>1;){const U=D.shift(),q=D.shift();if(/^\d+$/.exec(U)){const Q=parseInt(U);if(V(Q))if(q==="?")P.push({type:0,index:Q});else{const re=(0,I.parseColor)(q);re&&P.push({type:1,index:Q,color:re})}}}return P.length&&this._onColor.fire(P),!0}setHyperlink(j){const P=j.split(";");return!(P.length<2)&&(P[1]?this._createHyperlink(P[0],P[1]):!P[0]&&this._finishHyperlink())}_createHyperlink(j,P){this._getCurrentLinkId()&&this._finishHyperlink();const D=j.split(":");let U;const q=D.findIndex((Q=>Q.startsWith("id=")));return q!==-1&&(U=D[q].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:U,uri:P}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(j,P){const D=j.split(";");for(let U=0;U<D.length&&!(P>=this._specialColors.length);++U,++P)if(D[U]==="?")this._onColor.fire([{type:0,index:this._specialColors[P]}]);else{const q=(0,I.parseColor)(D[U]);q&&this._onColor.fire([{type:1,index:this._specialColors[P],color:q}])}return!0}setOrReportFgColor(j){return this._setOrReportSpecialColor(j,0)}setOrReportBgColor(j){return this._setOrReportSpecialColor(j,1)}setOrReportCursorColor(j){return this._setOrReportSpecialColor(j,2)}restoreIndexedColor(j){if(!j)return this._onColor.fire([{type:2}]),!0;const P=[],D=j.split(";");for(let U=0;U<D.length;++U)if(/^\d+$/.exec(D[U])){const q=parseInt(D[U]);V(q)&&P.push({type:2,index:q})}return P.length&&this._onColor.fire(P),!0}restoreFgColor(j){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(j){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(j){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,S.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(K[j[0]],S.CHARSETS[j[1]]||S.DEFAULT_CHARSET),!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){const j=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,j,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=m.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=m.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(j){return this._charsetService.setgLevel(j),!0}screenAlignmentPattern(){const j=new x.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let P=0;P<this._bufferService.rows;++P){const D=this._activeBuffer.ybase+this._activeBuffer.y+P,U=this._activeBuffer.lines.get(D);U&&(U.fill(j),U.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,P){const D=this._bufferService.buffer,U=this._optionsService.rawOptions;return(q=>(this._coreService.triggerDataEvent(`${g.C0.ESC}${q}${g.C0.ESC}\\`),!0))(j==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:j==='"p'?'P1$r61;1"p':j==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:j==="m"?"P1$r0m":j===" q"?`P1$r${{block:2,underline:4,bar:6}[U.cursorStyle]-(U.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,P){this._dirtyRowTracker.markRangeDirty(j,P)}}c.InputHandler=W;let z=class{constructor(X){this._bufferService=X,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(X){X<this.start?this.start=X:X>this.end&&(this.end=X)}markRangeDirty(X,j){X>j&&(Y=X,X=j,j=Y),X<this.start&&(this.start=X),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V(X){return 0<=X&&X<256}z=d([_(0,L.IBufferService)],z)},844:(p,c)=>{function h(d){for(const _ of d)_.dispose();d.length=0}Object.defineProperty(c,"__esModule",{value:!0}),c.getDisposeArrayDisposable=c.disposeArray=c.toDisposable=c.MutableDisposable=c.Disposable=void 0,c.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const d of this._disposables)d.dispose();this._disposables.length=0}register(d){return this._disposables.push(d),d}unregister(d){const _=this._disposables.indexOf(d);_!==-1&&this._disposables.splice(_,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(d){this._isDisposed||d===this._value||(this._value?.dispose(),this._value=d)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},c.toDisposable=function(d){return{dispose:d}},c.disposeArray=h,c.getDisposeArrayDisposable=function(d){return{dispose:()=>h(d)}}},1505:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(_,g,S){this._data[_]||(this._data[_]={}),this._data[_][g]=S}get(_,g){return this._data[_]?this._data[_][g]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(d,_,g,S,C){this._data.get(d,_)||this._data.set(d,_,new h),this._data.get(d,_).set(g,S,C)}get(d,_,g,S){return this._data.get(d,_)?.get(g,S)}clear(){this._data.clear()}}},6114:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,d=c.isNode?"node":navigator.platform;c.isFirefox=h.includes("Firefox"),c.isLegacyEdge=h.includes("Edge"),c.isSafari=/^((?!chrome|android).)*safari/i.test(h),c.getSafariVersion=function(){if(!c.isSafari)return 0;const _=h.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),c.isIpad=d==="iPad",c.isIphone=d==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),c.isLinux=d.indexOf("Linux")>=0,c.isChromeOS=/\bCrOS\b/.test(h)},6106:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SortedList=void 0;let h=0;c.SortedList=class{constructor(d){this._getKey=d,this._array=[]}clear(){this._array.length=0}insert(d){this._array.length!==0?(h=this._search(this._getKey(d)),this._array.splice(h,0,d)):this._array.push(d)}delete(d){if(this._array.length===0)return!1;const _=this._getKey(d);if(_===void 0||(h=this._search(_),h===-1)||this._getKey(this._array[h])!==_)return!1;do if(this._array[h]===d)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===_);return!1}*getKeyIterator(d){if(this._array.length!==0&&(h=this._search(d),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===d))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===d)}forEachByKey(d,_){if(this._array.length!==0&&(h=this._search(d),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===d))do _(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===d)}values(){return[...this._array].values()}_search(d){let _=0,g=this._array.length-1;for(;g>=_;){let S=_+g>>1;const C=this._getKey(this._array[S]);if(C>d)g=S-1;else{if(!(C<d)){for(;S>0&&this._getKey(this._array[S-1])===d;)S--;return S}_=S+1}}return _}}},7226:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const d=h(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let T=0,w=0,m=C.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(T=Date.now(),this._tasks[this._i]()||this._i++,T=Math.max(1,Date.now()-T),w=Math.max(T,w),b=C.timeRemaining(),1.5*w>b)return m-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(m-T))}ms`),void this._start();m=b}this.clear()}}class g extends _{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const T=Date.now()+C;return{timeRemaining:()=>Math.max(0,T-Date.now())}}}c.PriorityTaskQueue=g,c.IdleTaskQueue=!d.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:g,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const d=h(643);c.updateWindowsModeWrappedState=function(_){const g=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),S=g?.get(_.cols-1),C=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);C&&S&&(C.isWrapped=S[d.CHAR_DATA_CODE_INDEX]!==d.NULL_CELL_CODE&&S[d.CHAR_DATA_CODE_INDEX]!==d.WHITESPACE_CELL_CODE)}},3734:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ExtendedAttrs=c.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new d}static toColorRGB(g){return[g>>>16&255,g>>>8&255,255&g]}static fromColorRGB(g){return(255&g[0])<<16|(255&g[1])<<8|255&g[2]}clone(){const g=new h;return g.fg=this.fg,g.bg=this.bg,g.extended=this.extended.clone(),g}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}c.AttributeData=h;class d{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(g){this._ext=g}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(g){this._ext&=-469762049,this._ext|=g<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(g){this._ext&=-67108864,this._ext|=67108863&g}get urlId(){return this._urlId}set urlId(g){this._urlId=g}get underlineVariantOffset(){const g=(3758096384&this._ext)>>29;return g<0?4294967288^g:g}set underlineVariantOffset(g){this._ext&=536870911,this._ext|=g<<29&3758096384}constructor(g=0,S=0){this._ext=0,this._urlId=0,this._ext=g,this._urlId=S}clone(){return new d(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=d},9092:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const d=h(6349),_=h(7226),g=h(3734),S=h(8437),C=h(4634),T=h(511),w=h(643),m=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(v,x,k){this._hasScrollback=v,this._optionsService=x,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new g.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new g.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,x){return new S.BufferLine(this._bufferService.cols,this.getNullCell(v),x)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const x=v+this._optionsService.rawOptions.scrollback;return x>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:x}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=S.DEFAULT_ATTR_DATA);let x=this._rows;for(;x--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new d.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,x){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let L=0;const R=this._getCorrectBufferLength(x);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<v)for(let A=0;A<this.lines.length;A++)L+=+this.lines.get(A).resize(v,k);let N=0;if(this._rows<x)for(let A=this._rows;A<x;A++)this.lines.length<x+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(v,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+N+1?(this.ybase--,N++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(v,k)));else for(let A=this._rows;A>x;A--)this.lines.length>x+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(R<this.lines.maxLength){const A=this.lines.length-R;A>0&&(this.lines.trimStart(A),this.ybase=Math.max(this.ybase-A,0),this.ydisp=Math.max(this.ydisp-A,0),this.savedY=Math.max(this.savedY-A,0)),this.lines.maxLength=R}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,x-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=x-1,this._isReflowEnabled&&(this._reflow(v,x),this._cols>v))for(let N=0;N<this.lines.length;N++)L+=+this.lines.get(N).resize(v,k);this._cols=v,this._rows=x,this._memoryCleanupQueue.clear(),L>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let x=0;for(;this._memoryCleanupPosition<this.lines.length;)if(x+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),x>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,x){this._cols!==v&&(v>this._cols?this._reflowLarger(v,x):this._reflowSmaller(v,x))}_reflowLarger(v,x){const k=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const L=(0,C.reflowLargerCreateNewLayout)(this.lines,k);(0,C.reflowLargerApplyNewLayout)(this.lines,L.layout),this._reflowLargerAdjustViewport(v,x,L.countRemoved)}}_reflowLargerAdjustViewport(v,x,k){const L=this.getNullCell(S.DEFAULT_ATTR_DATA);let R=k;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<x&&this.lines.push(new S.BufferLine(v,L))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(v,x){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),L=[];let R=0;for(let N=this.lines.length-1;N>=0;N--){let A=this.lines.get(N);if(!A||!A.isWrapped&&A.getTrimmedLength()<=v)continue;const I=[A];for(;A.isWrapped&&N>0;)A=this.lines.get(--N),I.unshift(A);const K=this.ybase+this.y;if(K>=N&&K<N+I.length)continue;const F=I[I.length-1].getTrimmedLength(),G=(0,C.reflowSmallerGetNewLineLengths)(I,this._cols,v),B=G.length-I.length;let Y;Y=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const W=[];for(let D=0;D<B;D++){const U=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);W.push(U)}W.length>0&&(L.push({start:N+I.length+R,newLines:W}),R+=W.length),I.push(...W);let z=G.length-1,V=G[z];V===0&&(z--,V=G[z]);let X=I.length-B-1,j=F;for(;X>=0;){const D=Math.min(j,V);if(I[z]===void 0)break;if(I[z].copyCellsFrom(I[X],j-D,V-D,D,!0),V-=D,V===0&&(z--,V=G[z]),j-=D,j===0){X--;const U=Math.max(X,0);j=(0,C.getWrappedLineTrimmedLength)(I,U,this._cols)}}for(let D=0;D<I.length;D++)G[D]<v&&I[D].setCell(G[D],k);let P=B-Y;for(;P-- >0;)this.ybase===0?this.y<x-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-x&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+x-1)}if(L.length>0){const N=[],A=[];for(let z=0;z<this.lines.length;z++)A.push(this.lines.get(z));const I=this.lines.length;let K=I-1,F=0,G=L[F];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let B=0;for(let z=Math.min(this.lines.maxLength-1,I+R-1);z>=0;z--)if(G&&G.start>K+B){for(let V=G.newLines.length-1;V>=0;V--)this.lines.set(z--,G.newLines[V]);z++,N.push({index:K+1,amount:G.newLines.length}),B+=G.newLines.length,G=L[++F]}else this.lines.set(z,A[K--]);let Y=0;for(let z=N.length-1;z>=0;z--)N[z].index+=Y,this.lines.onInsertEmitter.fire(N[z]),Y+=N[z].amount;const W=Math.max(0,I+R-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(v,x,k=0,L){const R=this.lines.get(v);return R?R.translateToString(x,k,L):""}getWrappedRangeForLine(v){let x=v,k=v;for(;x>0&&this.lines.get(x).isWrapped;)x--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:x,last:k}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].line===v&&(this.markers[x].dispose(),this.markers.splice(x--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const x=new m.Marker(v);return this.markers.push(x),x.register(this.lines.onTrim((k=>{x.line-=k,x.line<0&&x.dispose()}))),x.register(this.lines.onInsert((k=>{x.line>=k.index&&(x.line+=k.amount)}))),x.register(this.lines.onDelete((k=>{x.line>=k.index&&x.line<k.index+k.amount&&x.dispose(),x.line>k.index&&(x.line-=k.amount)}))),x.register(x.onDispose((()=>this._removeMarker(x)))),x}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const d=h(3734),_=h(511),g=h(643),S=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new d.AttributeData);let C=0;class T{constructor(m,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const x=b||_.CellData.fromCharData([0,g.NULL_CELL_CHAR,g.NULL_CELL_WIDTH,g.NULL_CELL_CODE]);for(let k=0;k<m;++k)this.setCell(k,x);this.length=m}get(m){const b=this._data[3*m+0],v=2097151&b;return[this._data[3*m+1],2097152&b?this._combined[m]:v?(0,S.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[m].charCodeAt(this._combined[m].length-1):v]}set(m,b){this._data[3*m+1]=b[g.CHAR_DATA_ATTR_INDEX],b[g.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[m]=b[1],this._data[3*m+0]=2097152|m|b[g.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*m+0]=b[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[g.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(m){return this._data[3*m+0]>>22}hasWidth(m){return 12582912&this._data[3*m+0]}getFg(m){return this._data[3*m+1]}getBg(m){return this._data[3*m+2]}hasContent(m){return 4194303&this._data[3*m+0]}getCodePoint(m){const b=this._data[3*m+0];return 2097152&b?this._combined[m].charCodeAt(this._combined[m].length-1):2097151&b}isCombined(m){return 2097152&this._data[3*m+0]}getString(m){const b=this._data[3*m+0];return 2097152&b?this._combined[m]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(m){return 536870912&this._data[3*m+2]}loadCell(m,b){return C=3*m,b.content=this._data[C+0],b.fg=this._data[C+1],b.bg=this._data[C+2],2097152&b.content&&(b.combinedData=this._combined[m]),268435456&b.bg&&(b.extended=this._extendedAttrs[m]),b}setCell(m,b){2097152&b.content&&(this._combined[m]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[m]=b.extended),this._data[3*m+0]=b.content,this._data[3*m+1]=b.fg,this._data[3*m+2]=b.bg}setCellFromCodepoint(m,b,v,x){268435456&x.bg&&(this._extendedAttrs[m]=x.extended),this._data[3*m+0]=b|v<<22,this._data[3*m+1]=x.fg,this._data[3*m+2]=x.bg}addCodepointToCell(m,b,v){let x=this._data[3*m+0];2097152&x?this._combined[m]+=(0,S.stringFromCodePoint)(b):2097151&x?(this._combined[m]=(0,S.stringFromCodePoint)(2097151&x)+(0,S.stringFromCodePoint)(b),x&=-2097152,x|=2097152):x=b|4194304,v&&(x&=-12582913,x|=v<<22),this._data[3*m+0]=x}insertCells(m,b,v){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),b<this.length-m){const x=new _.CellData;for(let k=this.length-m-b-1;k>=0;--k)this.setCell(m+b+k,this.loadCell(m+k,x));for(let k=0;k<b;++k)this.setCell(m+k,v)}else for(let x=m;x<this.length;++x)this.setCell(x,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(m,b,v){if(m%=this.length,b<this.length-m){const x=new _.CellData;for(let k=0;k<this.length-m-b;++k)this.setCell(m+k,this.loadCell(m+b+k,x));for(let k=this.length-b;k<this.length;++k)this.setCell(k,v)}else for(let x=m;x<this.length;++x)this.setCell(x,v);m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),this.getWidth(m)!==0||this.hasContent(m)||this.setCellFromCodepoint(m,0,1,v)}replaceCells(m,b,v,x=!1){if(x)for(m&&this.getWidth(m-1)===2&&!this.isProtected(m-1)&&this.setCellFromCodepoint(m-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);m<b&&m<this.length;)this.isProtected(m)||this.setCell(m,v),m++;else for(m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);m<b&&m<this.length;)this.setCell(m++,v)}resize(m,b){if(m===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*m;if(m>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const x=new Uint32Array(v);x.set(this._data),this._data=x}for(let x=this.length;x<m;++x)this.setCell(x,b)}else{this._data=this._data.subarray(0,v);const x=Object.keys(this._combined);for(let L=0;L<x.length;L++){const R=parseInt(x[L],10);R>=m&&delete this._combined[R]}const k=Object.keys(this._extendedAttrs);for(let L=0;L<k.length;L++){const R=parseInt(k[L],10);R>=m&&delete this._extendedAttrs[R]}}return this.length=m,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const m=new Uint32Array(this._data.length);return m.set(this._data),this._data=m,1}return 0}fill(m,b=!1){if(b)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,m);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,m)}}copyFrom(m){this.length!==m.length?this._data=new Uint32Array(m._data):this._data.set(m._data),this.length=m.length,this._combined={};for(const b in m._combined)this._combined[b]=m._combined[b];this._extendedAttrs={};for(const b in m._extendedAttrs)this._extendedAttrs[b]=m._extendedAttrs[b];this.isWrapped=m.isWrapped}clone(){const m=new T(0);m._data=new Uint32Array(this._data),m.length=this.length;for(const b in this._combined)m._combined[b]=this._combined[b];for(const b in this._extendedAttrs)m._extendedAttrs[b]=this._extendedAttrs[b];return m.isWrapped=this.isWrapped,m}getTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0])return m+(this._data[3*m+0]>>22);return 0}getNoBgTrimmedLength(){for(let m=this.length-1;m>=0;--m)if(4194303&this._data[3*m+0]||50331648&this._data[3*m+2])return m+(this._data[3*m+0]>>22);return 0}copyCellsFrom(m,b,v,x,k){const L=m._data;if(k)for(let N=x-1;N>=0;N--){for(let A=0;A<3;A++)this._data[3*(v+N)+A]=L[3*(b+N)+A];268435456&L[3*(b+N)+2]&&(this._extendedAttrs[v+N]=m._extendedAttrs[b+N])}else for(let N=0;N<x;N++){for(let A=0;A<3;A++)this._data[3*(v+N)+A]=L[3*(b+N)+A];268435456&L[3*(b+N)+2]&&(this._extendedAttrs[v+N]=m._extendedAttrs[b+N])}const R=Object.keys(m._combined);for(let N=0;N<R.length;N++){const A=parseInt(R[N],10);A>=b&&(this._combined[A-b+v]=m._combined[A])}}translateToString(m,b,v,x){b=b??0,v=v??this.length,m&&(v=Math.min(v,this.getTrimmedLength())),x&&(x.length=0);let k="";for(;b<v;){const L=this._data[3*b+0],R=2097151&L,N=2097152&L?this._combined[b]:R?(0,S.stringFromCodePoint)(R):g.WHITESPACE_CELL_CHAR;if(k+=N,x)for(let A=0;A<N.length;++A)x.push(b);b+=L>>22||1}return x&&x.push(b),k}}c.BufferLine=T},4841:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,d){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return d*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(p,c)=>{function h(d,_,g){if(_===d.length-1)return d[_].getTrimmedLength();const S=!d[_].hasContent(g-1)&&d[_].getWidth(g-1)===1,C=d[_+1].getWidth(0)===2;return S&&C?g-1:g}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(d,_,g,S,C){const T=[];for(let w=0;w<d.length-1;w++){let m=w,b=d.get(++m);if(!b.isWrapped)continue;const v=[d.get(w)];for(;m<d.length&&b.isWrapped;)v.push(b),b=d.get(++m);if(S>=w&&S<m){w+=v.length-1;continue}let x=0,k=h(v,x,_),L=1,R=0;for(;L<v.length;){const A=h(v,L,_),I=A-R,K=g-k,F=Math.min(I,K);v[x].copyCellsFrom(v[L],R,k,F,!1),k+=F,k===g&&(x++,k=0),R+=F,R===A&&(L++,R=0),k===0&&x!==0&&v[x-1].getWidth(g-1)===2&&(v[x].copyCellsFrom(v[x-1],g-1,k++,1,!1),v[x-1].setCell(g-1,C))}v[x].replaceCells(k,g,C);let N=0;for(let A=v.length-1;A>0&&(A>x||v[A].getTrimmedLength()===0);A--)N++;N>0&&(T.push(w+v.length-N),T.push(N)),w+=v.length-1}return T},c.reflowLargerCreateNewLayout=function(d,_){const g=[];let S=0,C=_[S],T=0;for(let w=0;w<d.length;w++)if(C===w){const m=_[++S];d.onDeleteEmitter.fire({index:w-T,amount:m}),w+=m-1,T+=m,C=_[++S]}else g.push(w);return{layout:g,countRemoved:T}},c.reflowLargerApplyNewLayout=function(d,_){const g=[];for(let S=0;S<_.length;S++)g.push(d.get(_[S]));for(let S=0;S<g.length;S++)d.set(S,g[S]);d.length=_.length},c.reflowSmallerGetNewLineLengths=function(d,_,g){const S=[],C=d.map(((b,v)=>h(d,v,_))).reduce(((b,v)=>b+v));let T=0,w=0,m=0;for(;m<C;){if(C-m<g){S.push(C-m);break}T+=g;const b=h(d,w,_);T>b&&(T-=b,w++);const v=d[w].getWidth(T-1)===2;v&&T--;const x=v?g-1:g;S.push(x),m+=x}return S},c.getWrappedLineTrimmedLength=h},5295:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const d=h(8460),_=h(844),g=h(9092);class S extends _.Disposable{constructor(T,w){super(),this._optionsService=T,this._bufferService=w,this._onBufferActivate=this.register(new d.EventEmitter),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 g.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new g.Buffer(!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(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),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(T,w){this._normal.resize(T,w),this._alt.resize(T,w),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}c.BufferSet=S},511:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const d=h(482),_=h(643),g=h(3734);class S extends g.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new g.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const w=new S;return w.setFromCharData(T),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,d.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(T[_.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(T[_.CHAR_DATA_CHAR_INDEX].length===2){const m=T[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const b=T[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(m-55296)+b-56320+65536|T[_.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=T[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[_.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=T[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=S},643:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const d=h(8460),_=h(844);class g{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=g._nextId++,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}c.Marker=g,g._nextId=1},7116:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DEFAULT_CHARSET=c.CHARSETS=void 0,c.CHARSETS={},c.DEFAULT_CHARSET=c.CHARSETS.B,c.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},c.CHARSETS.A={"#":"£"},c.CHARSETS.B=void 0,c.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},c.CHARSETS.C=c.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},c.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},c.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},c.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},c.CHARSETS.E=c.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},c.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},c.CHARSETS.H=c.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},c.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(p,c)=>{var h,d,_;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(g){g.NUL="\0",g.SOH="",g.STX="",g.ETX="",g.EOT="",g.ENQ="",g.ACK="",g.BEL="\x07",g.BS="\b",g.HT=" ",g.LF=`
81
+ `,g.VT="\v",g.FF="\f",g.CR="\r",g.SO="",g.SI="",g.DLE="",g.DC1="",g.DC2="",g.DC3="",g.DC4="",g.NAK="",g.SYN="",g.ETB="",g.CAN="",g.EM="",g.SUB="",g.ESC="\x1B",g.FS="",g.GS="",g.RS="",g.US="",g.SP=" ",g.DEL=""})(h||(c.C0=h={})),(function(g){g.PAD="€",g.HOP="",g.BPH="‚",g.NBH="ƒ",g.IND="„",g.NEL="…",g.SSA="†",g.ESA="‡",g.HTS="ˆ",g.HTJ="‰",g.VTS="Š",g.PLD="‹",g.PLU="Œ",g.RI="",g.SS2="Ž",g.SS3="",g.DCS="",g.PU1="‘",g.PU2="’",g.STS="“",g.CCH="”",g.MW="•",g.SPA="–",g.EPA="—",g.SOS="˜",g.SGCI="™",g.SCI="š",g.CSI="›",g.ST="œ",g.OSC="",g.PM="ž",g.APC="Ÿ"})(d||(c.C1=d={})),(function(g){g.ST=`${h.ESC}\\`})(_||(c.C1_ESCAPED=_={}))},7399:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const d=h(2584),_={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:["'",'"']};c.evaluateKeyboardEvent=function(g,S,C,T){const w={type:0,cancel:!1,key:void 0},m=(g.shiftKey?1:0)|(g.altKey?2:0)|(g.ctrlKey?4:0)|(g.metaKey?8:0);switch(g.keyCode){case 0:g.key==="UIKeyInputUpArrow"?w.key=S?d.C0.ESC+"OA":d.C0.ESC+"[A":g.key==="UIKeyInputLeftArrow"?w.key=S?d.C0.ESC+"OD":d.C0.ESC+"[D":g.key==="UIKeyInputRightArrow"?w.key=S?d.C0.ESC+"OC":d.C0.ESC+"[C":g.key==="UIKeyInputDownArrow"&&(w.key=S?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:w.key=g.ctrlKey?"\b":d.C0.DEL,g.altKey&&(w.key=d.C0.ESC+w.key);break;case 9:if(g.shiftKey){w.key=d.C0.ESC+"[Z";break}w.key=d.C0.HT,w.cancel=!0;break;case 13:w.key=g.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,w.cancel=!0;break;case 27:w.key=d.C0.ESC,g.altKey&&(w.key=d.C0.ESC+d.C0.ESC),w.cancel=!0;break;case 37:if(g.metaKey)break;m?(w.key=d.C0.ESC+"[1;"+(m+1)+"D",w.key===d.C0.ESC+"[1;3D"&&(w.key=d.C0.ESC+(C?"b":"[1;5D"))):w.key=S?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(g.metaKey)break;m?(w.key=d.C0.ESC+"[1;"+(m+1)+"C",w.key===d.C0.ESC+"[1;3C"&&(w.key=d.C0.ESC+(C?"f":"[1;5C"))):w.key=S?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(g.metaKey)break;m?(w.key=d.C0.ESC+"[1;"+(m+1)+"A",C||w.key!==d.C0.ESC+"[1;3A"||(w.key=d.C0.ESC+"[1;5A")):w.key=S?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(g.metaKey)break;m?(w.key=d.C0.ESC+"[1;"+(m+1)+"B",C||w.key!==d.C0.ESC+"[1;3B"||(w.key=d.C0.ESC+"[1;5B")):w.key=S?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:g.shiftKey||g.ctrlKey||(w.key=d.C0.ESC+"[2~");break;case 46:w.key=m?d.C0.ESC+"[3;"+(m+1)+"~":d.C0.ESC+"[3~";break;case 36:w.key=m?d.C0.ESC+"[1;"+(m+1)+"H":S?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:w.key=m?d.C0.ESC+"[1;"+(m+1)+"F":S?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:g.shiftKey?w.type=2:g.ctrlKey?w.key=d.C0.ESC+"[5;"+(m+1)+"~":w.key=d.C0.ESC+"[5~";break;case 34:g.shiftKey?w.type=3:g.ctrlKey?w.key=d.C0.ESC+"[6;"+(m+1)+"~":w.key=d.C0.ESC+"[6~";break;case 112:w.key=m?d.C0.ESC+"[1;"+(m+1)+"P":d.C0.ESC+"OP";break;case 113:w.key=m?d.C0.ESC+"[1;"+(m+1)+"Q":d.C0.ESC+"OQ";break;case 114:w.key=m?d.C0.ESC+"[1;"+(m+1)+"R":d.C0.ESC+"OR";break;case 115:w.key=m?d.C0.ESC+"[1;"+(m+1)+"S":d.C0.ESC+"OS";break;case 116:w.key=m?d.C0.ESC+"[15;"+(m+1)+"~":d.C0.ESC+"[15~";break;case 117:w.key=m?d.C0.ESC+"[17;"+(m+1)+"~":d.C0.ESC+"[17~";break;case 118:w.key=m?d.C0.ESC+"[18;"+(m+1)+"~":d.C0.ESC+"[18~";break;case 119:w.key=m?d.C0.ESC+"[19;"+(m+1)+"~":d.C0.ESC+"[19~";break;case 120:w.key=m?d.C0.ESC+"[20;"+(m+1)+"~":d.C0.ESC+"[20~";break;case 121:w.key=m?d.C0.ESC+"[21;"+(m+1)+"~":d.C0.ESC+"[21~";break;case 122:w.key=m?d.C0.ESC+"[23;"+(m+1)+"~":d.C0.ESC+"[23~";break;case 123:w.key=m?d.C0.ESC+"[24;"+(m+1)+"~":d.C0.ESC+"[24~";break;default:if(!g.ctrlKey||g.shiftKey||g.altKey||g.metaKey)if(C&&!T||!g.altKey||g.metaKey)!C||g.altKey||g.ctrlKey||g.shiftKey||!g.metaKey?g.key&&!g.ctrlKey&&!g.altKey&&!g.metaKey&&g.keyCode>=48&&g.key.length===1?w.key=g.key:g.key&&g.ctrlKey&&(g.key==="_"&&(w.key=d.C0.US),g.key==="@"&&(w.key=d.C0.NUL)):g.keyCode===65&&(w.type=1);else{const b=_[g.keyCode],v=b?.[g.shiftKey?1:0];if(v)w.key=d.C0.ESC+v;else if(g.keyCode>=65&&g.keyCode<=90){const x=g.ctrlKey?g.keyCode-64:g.keyCode+32;let k=String.fromCharCode(x);g.shiftKey&&(k=k.toUpperCase()),w.key=d.C0.ESC+k}else if(g.keyCode===32)w.key=d.C0.ESC+(g.ctrlKey?d.C0.NUL:" ");else if(g.key==="Dead"&&g.code.startsWith("Key")){let x=g.code.slice(3,4);g.shiftKey||(x=x.toLowerCase()),w.key=d.C0.ESC+x,w.cancel=!0}}else g.keyCode>=65&&g.keyCode<=90?w.key=String.fromCharCode(g.keyCode-64):g.keyCode===32?w.key=d.C0.NUL:g.keyCode>=51&&g.keyCode<=55?w.key=String.fromCharCode(g.keyCode-51+27):g.keyCode===56?w.key=d.C0.DEL:g.keyCode===219?w.key=d.C0.ESC:g.keyCode===220?w.key=d.C0.FS:g.keyCode===221&&(w.key=d.C0.GS)}return w}},482:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Utf8ToUtf32=c.StringToUtf32=c.utf32ToString=c.stringFromCodePoint=void 0,c.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},c.utf32ToString=function(h,d=0,_=h.length){let g="";for(let S=d;S<_;++S){let C=h[S];C>65535?(C-=65536,g+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):g+=String.fromCharCode(C)}return g},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,d){const _=h.length;if(!_)return 0;let g=0,S=0;if(this._interim){const C=h.charCodeAt(S++);56320<=C&&C<=57343?d[g++]=1024*(this._interim-55296)+C-56320+65536:(d[g++]=this._interim,d[g++]=C),this._interim=0}for(let C=S;C<_;++C){const T=h.charCodeAt(C);if(55296<=T&&T<=56319){if(++C>=_)return this._interim=T,g;const w=h.charCodeAt(C);56320<=w&&w<=57343?d[g++]=1024*(T-55296)+w-56320+65536:(d[g++]=T,d[g++]=w)}else T!==65279&&(d[g++]=T)}return g}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,d){const _=h.length;if(!_)return 0;let g,S,C,T,w=0,m=0,b=0;if(this.interim[0]){let k=!1,L=this.interim[0];L&=(224&L)==192?31:(240&L)==224?15:7;let R,N=0;for(;(R=63&this.interim[++N])&&N<4;)L<<=6,L|=R;const A=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=A-N;for(;b<I;){if(b>=_)return 0;if(R=h[b++],(192&R)!=128){b--,k=!0;break}this.interim[N++]=R,L<<=6,L|=63&R}k||(A===2?L<128?b--:d[w++]=L:A===3?L<2048||L>=55296&&L<=57343||L===65279||(d[w++]=L):L<65536||L>1114111||(d[w++]=L)),this.interim.fill(0)}const v=_-4;let x=b;for(;x<_;){for(;!(!(x<v)||128&(g=h[x])||128&(S=h[x+1])||128&(C=h[x+2])||128&(T=h[x+3]));)d[w++]=g,d[w++]=S,d[w++]=C,d[w++]=T,x+=4;if(g=h[x++],g<128)d[w++]=g;else if((224&g)==192){if(x>=_)return this.interim[0]=g,w;if(S=h[x++],(192&S)!=128){x--;continue}if(m=(31&g)<<6|63&S,m<128){x--;continue}d[w++]=m}else if((240&g)==224){if(x>=_)return this.interim[0]=g,w;if(S=h[x++],(192&S)!=128){x--;continue}if(x>=_)return this.interim[0]=g,this.interim[1]=S,w;if(C=h[x++],(192&C)!=128){x--;continue}if(m=(15&g)<<12|(63&S)<<6|63&C,m<2048||m>=55296&&m<=57343||m===65279)continue;d[w++]=m}else if((248&g)==240){if(x>=_)return this.interim[0]=g,w;if(S=h[x++],(192&S)!=128){x--;continue}if(x>=_)return this.interim[0]=g,this.interim[1]=S,w;if(C=h[x++],(192&C)!=128){x--;continue}if(x>=_)return this.interim[0]=g,this.interim[1]=S,this.interim[2]=C,w;if(T=h[x++],(192&T)!=128){x--;continue}if(m=(7&g)<<18|(63&S)<<12|(63&C)<<6|63&T,m<65536||m>1114111)continue;d[w++]=m}}return w}}},225:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const d=h(1480),_=[[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]],g=[[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]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<_.length;++C)S.fill(0,_[C][0],_[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let m,b=0,v=w.length-1;if(T<w[0][0]||T>w[v][1])return!1;for(;v>=b;)if(m=b+v>>1,T>w[m][1])b=m+1;else{if(!(T<w[m][0]))return!0;v=m-1}return!1})(C,g)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),m=w===0&&T!==0;if(m){const b=d.UnicodeService.extractWidth(T);b===0?m=!1:b>w&&(w=b)}return d.UnicodeService.createPropertyValue(0,w,m)}}},5981:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const d=h(8460),_=h(844);class g extends _.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,T){if(T!==void 0&&this._syncCalls>T)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const m=this._callbacks.shift();m&&m()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,T){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(T),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(T)}_innerWrite(C=0,T=!0){const w=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const m=this._writeBuffer[this._bufferOffset],b=this._action(m,T);if(b){const x=k=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(w,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(x)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=m.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}c.WriteBuffer=g},5941:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.toRgbString=c.parseColor=void 0;const h=/^([\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})$/,d=/^[\da-f]+$/;function _(g,S){const C=g.toString(16),T=C.length<2?"0"+C:C;switch(S){case 4:return C[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}c.parseColor=function(g){if(!g)return;let S=g.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const C=h.exec(S);if(C){const T=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/T*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/T*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/T*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),d.exec(S)&&[3,6,9,12].includes(S.length))){const C=S.length/3,T=[0,0,0];for(let w=0;w<3;++w){const m=parseInt(S.slice(C*w,C*w+C),16);T[w]=C===1?m<<4:C===2?m:C===3?m>>4:m>>8}return T}},c.toRgbString=function(g,S=16){const[C,T,w]=g;return`rgb:${_(C,S)}/${_(T,S)}/${_(w,S)}`}},5770:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const d=h(482),_=h(8742),g=h(5770),S=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(T,w){this._handlers[T]===void 0&&(this._handlers[T]=[]);const m=this._handlers[T];return m.push(w),{dispose:()=>{const b=m.indexOf(w);b!==-1&&m.splice(b,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(T,w){if(this.reset(),this._ident=T,this._active=this._handlers[T]||S,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(T,w,m){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(T,w,m);else this._handlerFb(this._ident,"PUT",(0,d.utf32ToString)(T,w,m))}unhook(T,w=!0){if(this._active.length){let m=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,m=w,v=this._stack.fallThrough,this._stack.paused=!1),!v&&m===!1){for(;b>=0&&(m=this._active[b].unhook(T),m!==!0);b--)if(m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,m;b--}for(;b>=0;b--)if(m=this._active[b].unhook(!1),m instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,m}else this._handlerFb(this._ident,"UNHOOK",T);this._active=S,this._ident=0}};const C=new _.Params;C.addParam(0),c.DcsHandler=class{constructor(T){this._handler=T,this._data="",this._params=C,this._hitLimit=!1}hook(T){this._params=T.length>1||T.params[0]?T.clone():C,this._data="",this._hitLimit=!1}put(T,w,m){this._hitLimit||(this._data+=(0,d.utf32ToString)(T,w,m),this._data.length>g.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(T){let w=!1;if(this._hitLimit)w=!1;else if(T&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((m=>(this._params=C,this._data="",this._hitLimit=!1,m)));return this._params=C,this._data="",this._hitLimit=!1,w}}},2015:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.EscapeSequenceParser=c.VT500_TRANSITION_TABLE=c.TransitionTable=void 0;const d=h(844),_=h(8742),g=h(6242),S=h(6351);class C{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,x,k){this.table[v<<8|b]=x<<4|k}addMany(b,v,x,k){for(let L=0;L<b.length;L++)this.table[v<<8|b[L]]=x<<4|k}}c.TransitionTable=C;const T=160;c.VT500_TRANSITION_TABLE=(function(){const m=new C(4095),b=Array.apply(null,Array(256)).map(((N,A)=>A)),v=(N,A)=>b.slice(N,A),x=v(32,127),k=v(0,24);k.push(25),k.push.apply(k,v(28,32));const L=v(0,14);let R;for(R in m.setDefault(1,0),m.addMany(x,0,2,0),L)m.addMany([24,26,153,154],R,3,0),m.addMany(v(128,144),R,3,0),m.addMany(v(144,152),R,3,0),m.add(156,R,0,0),m.add(27,R,11,1),m.add(157,R,4,8),m.addMany([152,158,159],R,0,7),m.add(155,R,11,3),m.add(144,R,11,9);return m.addMany(k,0,3,0),m.addMany(k,1,3,1),m.add(127,1,0,1),m.addMany(k,8,0,8),m.addMany(k,3,3,3),m.add(127,3,0,3),m.addMany(k,4,3,4),m.add(127,4,0,4),m.addMany(k,6,3,6),m.addMany(k,5,3,5),m.add(127,5,0,5),m.addMany(k,2,3,2),m.add(127,2,0,2),m.add(93,1,4,8),m.addMany(x,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(v(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(x,7,0,7),m.addMany(k,7,0,7),m.add(156,7,0,0),m.add(127,7,0,7),m.add(91,1,11,3),m.addMany(v(64,127),3,7,0),m.addMany(v(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(v(48,60),4,8,4),m.addMany(v(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(v(32,64),6,0,6),m.add(127,6,0,6),m.addMany(v(64,127),6,0,0),m.addMany(v(32,48),3,9,5),m.addMany(v(32,48),5,9,5),m.addMany(v(48,64),5,0,6),m.addMany(v(64,127),5,7,0),m.addMany(v(32,48),4,9,5),m.addMany(v(32,48),1,9,2),m.addMany(v(32,48),2,9,2),m.addMany(v(48,127),2,10,0),m.addMany(v(48,80),1,10,0),m.addMany(v(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(v(96,127),1,10,0),m.add(80,1,11,9),m.addMany(k,9,0,9),m.add(127,9,0,9),m.addMany(v(28,32),9,0,9),m.addMany(v(32,48),9,9,12),m.addMany(v(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(k,11,0,11),m.addMany(v(32,128),11,0,11),m.addMany(v(28,32),11,0,11),m.addMany(k,10,0,10),m.add(127,10,0,10),m.addMany(v(28,32),10,0,10),m.addMany(v(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(v(32,48),10,9,12),m.addMany(k,12,0,12),m.add(127,12,0,12),m.addMany(v(28,32),12,0,12),m.addMany(v(32,48),12,9,12),m.addMany(v(48,64),12,0,11),m.addMany(v(64,127),12,12,13),m.addMany(v(64,127),10,12,13),m.addMany(v(64,127),9,12,13),m.addMany(k,13,13,13),m.addMany(x,13,13,13),m.add(127,13,0,13),m.addMany([27,156,24,26],13,14,0),m.add(T,0,2,0),m.add(T,8,5,8),m.add(T,6,0,6),m.add(T,11,0,11),m.add(T,13,13,13),m})();class w extends d.Disposable{constructor(b=c.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,x,k)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,x)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,d.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new g.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[64,126]){let x=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(x=b.prefix.charCodeAt(0),x&&60>x||x>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let L=0;L<b.intermediates.length;++L){const R=b.intermediates.charCodeAt(L);if(32>R||R>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");x<<=8,x|=R}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(v[0]>k||k>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return x<<=8,x|=k,x}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const x=this._identifier(b,[48,126]);this._escHandlers[x]===void 0&&(this._escHandlers[x]=[]);const k=this._escHandlers[x];return k.push(v),{dispose:()=>{const L=k.indexOf(v);L!==-1&&k.splice(L,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const x=this._identifier(b);this._csiHandlers[x]===void 0&&(this._csiHandlers[x]=[]);const k=this._csiHandlers[x];return k.push(v),{dispose:()=>{const L=k.indexOf(v);L!==-1&&k.splice(L,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}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(b,v,x,k,L){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=x,this._parseStack.transition=k,this._parseStack.chunkPos=L}parse(b,v,x){let k,L=0,R=0,N=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,N=this._parseStack.chunkPos+1;else{if(x===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const A=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(x===!1&&I>-1){for(;I>=0&&(k=A[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 4:if(x===!1&&I>-1){for(;I>=0&&(k=A[I](),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 6:if(L=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(L!==24&&L!==26,x),k)return k;L===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(L=b[this._parseStack.chunkPos],k=this._oscParser.end(L!==24&&L!==26,x),k)return k;L===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,N=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let A=N;A<v;++A){switch(L=b[A],R=this._transitions.table[this.currentState<<8|(L<160?L:T)],R>>4){case 2:for(let B=A+1;;++B){if(B>=v||(L=b[B])<32||L>126&&L<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(L=b[B])<32||L>126&&L<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(L=b[B])<32||L>126&&L<T){this._printHandler(b,A,B),A=B-1;break}if(++B>=v||(L=b[B])<32||L>126&&L<T){this._printHandler(b,A,B),A=B-1;break}}break;case 3:this._executeHandlers[L]?this._executeHandlers[L]():this._executeHandlerFb(L),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:A,code:L,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|L];let K=I?I.length-1:-1;for(;K>=0&&(k=I[K](this._params),k!==!0);K--)if(k instanceof Promise)return this._preserveStack(3,I,K,R,A),k;K<0&&this._csiHandlerFb(this._collect<<8|L,this._params),this.precedingJoinState=0;break;case 8:do switch(L){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(L-48)}while(++A<v&&(L=b[A])>47&&L<60);A--;break;case 9:this._collect<<=8,this._collect|=L;break;case 10:const F=this._escHandlers[this._collect<<8|L];let G=F?F.length-1:-1;for(;G>=0&&(k=F[G](),k!==!0);G--)if(k instanceof Promise)return this._preserveStack(4,F,G,R,A),k;G<0&&this._escHandlerFb(this._collect<<8|L),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|L,this._params);break;case 13:for(let B=A+1;;++B)if(B>=v||(L=b[B])===24||L===26||L===27||L>127&&L<T){this._dcsParser.put(b,A,B),A=B-1;break}break;case 14:if(k=this._dcsParser.unhook(L!==24&&L!==26),k)return this._preserveStack(6,[],0,R,A),k;L===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=A+1;;B++)if(B>=v||(L=b[B])<32||L>127&&L<T){this._oscParser.put(b,A,B),A=B-1;break}break;case 6:if(k=this._oscParser.end(L!==24&&L!==26),k)return this._preserveStack(5,[],0,R,A),k;L===27&&(R|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&R}}}c.EscapeSequenceParser=w},6242:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const d=h(5770),_=h(482),g=[];c.OscParser=class{constructor(){this._state=0,this._active=g,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,C){this._handlers[S]===void 0&&(this._handlers[S]=[]);const T=this._handlers[S];return T.push(C),{dispose:()=>{const w=T.indexOf(C);w!==-1&&T.splice(w,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=g,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||g,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,C,T){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(S,C,T);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(S,C,T))}start(){this.reset(),this._state=1}put(S,C,T){if(this._state!==3){if(this._state===1)for(;C<T;){const w=S[C++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&T-C>0&&this._put(S,C,T)}}end(S,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,w=this._active.length-1,m=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,T=C,m=this._stack.fallThrough,this._stack.paused=!1),!m&&T===!1){for(;w>=0&&(T=this._active[w].end(S),T!==!0);w--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,T;w--}for(;w>=0;w--)if(T=this._active[w].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",S);this._active=g,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,C,T){this._hitLimit||(this._data+=(0,_.utf32ToString)(S,C,T),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let C=!1;if(this._hitLimit)C=!1;else if(S&&(C=this._handler(this._data),C instanceof Promise))return C.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,C}}},8742:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class d{static fromArray(g){const S=new d;if(!g.length)return S;for(let C=Array.isArray(g[0])?1:0;C<g.length;++C){const T=g[C];if(Array.isArray(T))for(let w=0;w<T.length;++w)S.addSubParam(T[w]);else S.addParam(T)}return S}constructor(g=32,S=32){if(this.maxLength=g,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(g),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(g),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const g=new d(this.maxLength,this.maxSubParamsLength);return g.params.set(this.params),g.length=this.length,g._subParams.set(this._subParams),g._subParamsLength=this._subParamsLength,g._subParamsIdx.set(this._subParamsIdx),g._rejectDigits=this._rejectDigits,g._rejectSubDigits=this._rejectSubDigits,g._digitIsSub=this._digitIsSub,g}toArray(){const g=[];for(let S=0;S<this.length;++S){g.push(this.params[S]);const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&g.push(Array.prototype.slice.call(this._subParams,C,T))}return g}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(g){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(g<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=g>h?h:g}}addSubParam(g){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(g<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=g>h?h:g,this._subParamsIdx[this.length-1]++}}hasSubParams(g){return(255&this._subParamsIdx[g])-(this._subParamsIdx[g]>>8)>0}getSubParams(g){const S=this._subParamsIdx[g]>>8,C=255&this._subParamsIdx[g];return C-S>0?this._subParams.subarray(S,C):null}getSubParamsAll(){const g={};for(let S=0;S<this.length;++S){const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&(g[S]=this._subParams.slice(C,T))}return g}addDigit(g){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,T=C[S-1];C[S-1]=~T?Math.min(10*T+g,h):g}}c.Params=d},5741:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AddonManager=void 0,c.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,d){const _={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(_),d.dispose=()=>this._wrappedAddonDispose(_),d.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let d=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===h){d=_;break}if(d===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(d,1)}}},8771:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const d=h(3785),_=h(511);c.BufferApiView=class{constructor(g,S){this._buffer=g,this.type=S}init(g){return this._buffer=g,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(g){const S=this._buffer.lines.get(g);if(S)return new d.BufferLineApiView(S)}getNullCell(){return new _.CellData}}},3785:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const d=h(511);c.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,g){if(!(_<0||_>=this._line.length))return g?(this._line.loadCell(_,g),g):this._line.loadCell(_,new d.CellData)}translateToString(_,g,S){return this._line.translateToString(_,g,S)}}},8285:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const d=h(8771),_=h(8460),g=h(844);class S extends g.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new d.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new d.BufferApiView(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)}}c.BufferNamespaceApi=S},7975:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,d){return this._core.registerCsiHandler(h,(_=>d(_.toArray())))}addCsiHandler(h,d){return this.registerCsiHandler(h,d)}registerDcsHandler(h,d){return this._core.registerDcsHandler(h,((_,g)=>d(_,g.toArray())))}addDcsHandler(h,d){return this.registerDcsHandler(h,d)}registerEscHandler(h,d){return this._core.registerEscHandler(h,d)}addEscHandler(h,d){return this.registerEscHandler(h,d)}registerOscHandler(h,d){return this._core.registerOscHandler(h,d)}addOscHandler(h,d){return this.registerOscHandler(h,d)}}},7090:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeApi=void 0,c.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(p,c,h){var d=this&&this.__decorate||function(m,b,v,x){var k,L=arguments.length,R=L<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,b,v,x);else for(var N=m.length-1;N>=0;N--)(k=m[N])&&(R=(L<3?k(R):L>3?k(b,v,R):k(b,v))||R);return L>3&&R&&Object.defineProperty(b,v,R),R},_=this&&this.__param||function(m,b){return function(v,x){b(v,x,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const g=h(8460),S=h(844),C=h(5295),T=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let w=c.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(m){super(),this.isUserScrolling=!1,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new g.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(m.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(m.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(m,this))}resize(m,b){this.cols=m,this.rows=b,this.buffers.resize(m,b),this._onResize.fire({cols:m,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(m,b=!1){const v=this.buffer;let x;x=this._cachedBlankLine,x&&x.length===this.cols&&x.getFg(0)===m.fg&&x.getBg(0)===m.bg||(x=v.getBlankLine(m,b),this._cachedBlankLine=x),x.isWrapped=b;const k=v.ybase+v.scrollTop,L=v.ybase+v.scrollBottom;if(v.scrollTop===0){const R=v.lines.isFull;L===v.lines.length-1?R?v.lines.recycle().copyFrom(x):v.lines.push(x.clone()):v.lines.splice(L+1,0,x.clone()),R?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const R=L-k+1;v.lines.shiftElements(k+1,R-1,-1),v.lines.set(L,x.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(m,b,v){const x=this.buffer;if(m<0){if(x.ydisp===0)return;this.isUserScrolling=!0}else m+x.ydisp>=x.ybase&&(this.isUserScrolling=!1);const k=x.ydisp;x.ydisp=Math.max(Math.min(x.ydisp+m,x.ybase),0),k!==x.ydisp&&(b||this._onScroll.fire(x.ydisp))}};c.BufferService=w=d([_(0,T.IOptionsService)],w)},7994:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CharsetService=void 0,c.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,d){this._charsets[h]=d,this.glevel===h&&(this.charset=d)}}},1753:function(p,c,h){var d=this&&this.__decorate||function(x,k,L,R){var N,A=arguments.length,I=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(x,k,L,R);else for(var K=x.length-1;K>=0;K--)(N=x[K])&&(I=(A<3?N(I):A>3?N(k,L,I):N(k,L))||I);return A>3&&I&&Object.defineProperty(k,L,I),I},_=this&&this.__param||function(x,k){return function(L,R){k(L,R,x)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const g=h(2585),S=h(8460),C=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:x=>x.button!==4&&x.action===1&&(x.ctrl=!1,x.alt=!1,x.shift=!1,!0)},VT200:{events:19,restrict:x=>x.action!==32},DRAG:{events:23,restrict:x=>x.action!==32||x.button!==3},ANY:{events:31,restrict:x=>!0}};function w(x,k){let L=(x.ctrl?16:0)|(x.shift?4:0)|(x.alt?8:0);return x.button===4?(L|=64,L|=x.action):(L|=3&x.button,4&x.button&&(L|=64),8&x.button&&(L|=128),x.action===32?L|=32:x.action!==0||k||(L|=3)),L}const m=String.fromCharCode,b={DEFAULT:x=>{const k=[w(x,!1)+32,x.col+32,x.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${m(k[0])}${m(k[1])}${m(k[2])}`},SGR:x=>{const k=x.action===0&&x.button!==4?"m":"M";return`\x1B[<${w(x,!0)};${x.col};${x.row}${k}`},SGR_PIXELS:x=>{const k=x.action===0&&x.button!==4?"m":"M";return`\x1B[<${w(x,!0)};${x.x};${x.y}${k}`}};let v=c.CoreMouseService=class extends C.Disposable{constructor(x,k){super(),this._bufferService=x,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const L of Object.keys(T))this.addProtocol(L,T[L]);for(const L of Object.keys(b))this.addEncoding(L,b[L]);this.reset()}addProtocol(x,k){this._protocols[x]=k}addEncoding(x,k){this._encodings[x]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(x){if(!this._protocols[x])throw new Error(`unknown protocol "${x}"`);this._activeProtocol=x,this._onProtocolChange.fire(this._protocols[x].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(x){if(!this._encodings[x])throw new Error(`unknown encoding "${x}"`);this._activeEncoding=x}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(x){if(x.col<0||x.col>=this._bufferService.cols||x.row<0||x.row>=this._bufferService.rows||x.button===4&&x.action===32||x.button===3&&x.action!==32||x.button!==4&&(x.action===2||x.action===3)||(x.col++,x.row++,x.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,x,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(x))return!1;const k=this._encodings[this._activeEncoding](x);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=x,!0}explainEvents(x){return{down:!!(1&x),up:!!(2&x),drag:!!(4&x),move:!!(8&x),wheel:!!(16&x)}}_equalEvents(x,k,L){if(L){if(x.x!==k.x||x.y!==k.y)return!1}else if(x.col!==k.col||x.row!==k.row)return!1;return x.button===k.button&&x.action===k.action&&x.ctrl===k.ctrl&&x.alt===k.alt&&x.shift===k.shift}};c.CoreMouseService=v=d([_(0,g.IBufferService),_(1,g.ICoreService)],v)},6975:function(p,c,h){var d=this&&this.__decorate||function(v,x,k,L){var R,N=arguments.length,A=N<3?x:L===null?L=Object.getOwnPropertyDescriptor(x,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(v,x,k,L);else for(var I=v.length-1;I>=0;I--)(R=v[I])&&(A=(N<3?R(A):N>3?R(x,k,A):R(x,k))||A);return N>3&&A&&Object.defineProperty(x,k,A),A},_=this&&this.__param||function(v,x){return function(k,L){x(k,L,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const g=h(1439),S=h(8460),C=h(844),T=h(2585),w=Object.freeze({insertMode:!1}),m=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends C.Disposable{constructor(v,x,k){super(),this._bufferService=v,this._logService=x,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,g.clone)(w),this.decPrivateModes=(0,g.clone)(m)}reset(){this.modes=(0,g.clone)(w),this.decPrivateModes=(0,g.clone)(m)}triggerDataEvent(v,x=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;x&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),x&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((L=>L.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((x=>x.charCodeAt(0))))),this._onBinary.fire(v))}};c.CoreService=b=d([_(0,T.IBufferService),_(1,T.ILogService),_(2,T.IOptionsService)],b)},9074:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const d=h(8055),_=h(8460),g=h(844),S=h(6106);let C=0,T=0;class w extends g.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,g.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const x=new m(v);if(x){const k=x.marker.onDispose((()=>x.dispose()));x.onDispose((()=>{x&&(this._decorations.delete(x)&&this._onDecorationRemoved.fire(x),k.dispose())})),this._decorations.insert(x),this._onDecorationRegistered.fire(x)}return x}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,x,k){let L=0,R=0;for(const N of this._decorations.getKeyIterator(x))L=N.options.x??0,R=L+(N.options.width??1),v>=L&&v<R&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(v,x,k,L){this._decorations.forEachByKey(x,(R=>{C=R.options.x??0,T=C+(R.options.width??1),v>=C&&v<T&&(!k||(R.options.layer??"bottom")===k)&&L(R)}))}}c.DecorationService=w;class m extends g.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=d.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=d.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const d=h(2585),_=h(8343);class g{constructor(...C){this._entries=new Map;for(const[T,w]of C)this.set(T,w)}set(C,T){const w=this._entries.get(C);return this._entries.set(C,T),w}forEach(C){for(const[T,w]of this._entries.entries())C(T,w)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}c.ServiceCollection=g,c.InstantiationService=class{constructor(){this._services=new g,this._services.set(d.IInstantiationService,this)}setService(S,C){this._services.set(S,C)}getService(S){return this._services.get(S)}createInstance(S,...C){const T=(0,_.getServiceDependencies)(S).sort(((b,v)=>b.index-v.index)),w=[];for(const b of T){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);w.push(v)}const m=T.length>0?T[0].index:C.length;if(C.length!==m)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${m+1} conflicts with ${C.length} static arguments`);return new S(...C,...w)}}},7866:function(p,c,h){var d=this&&this.__decorate||function(m,b,v,x){var k,L=arguments.length,R=L<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,b,v,x);else for(var N=m.length-1;N>=0;N--)(k=m[N])&&(R=(L<3?k(R):L>3?k(b,v,R):k(b,v))||R);return L>3&&R&&Object.defineProperty(b,v,R),R},_=this&&this.__param||function(m,b){return function(v,x){b(v,x,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const g=h(844),S=h(2585),C={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let T,w=c.LogService=class extends g.Disposable{get logLevel(){return this._logLevel}constructor(m){super(),this._optionsService=m,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(m){for(let b=0;b<m.length;b++)typeof m[b]=="function"&&(m[b]=m[b]())}_log(m,b,v){this._evalLazyOptionalParams(v),m.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(m,...b){this._logLevel<=S.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,m,b)}debug(m,...b){this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,m,b)}info(m,...b){this._logLevel<=S.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,m,b)}warn(m,...b){this._logLevel<=S.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,m,b)}error(m,...b){this._logLevel<=S.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,m,b)}};c.LogService=w=d([_(0,S.IOptionsService)],w),c.setTraceLogger=function(m){T=m},c.traceCall=function(m,b,v){if(typeof v.value!="function")throw new Error("not supported");const x=v.value;v.value=function(...k){if(T.logLevel!==S.LogLevelEnum.TRACE)return x.apply(this,k);T.trace(`GlyphRenderer#${x.name}(${k.map((R=>JSON.stringify(R))).join(", ")})`);const L=x.apply(this,k);return T.trace(`GlyphRenderer#${x.name} return`,L),L}}},7302:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const d=h(8460),_=h(844),g=h(6114);c.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:g.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends _.Disposable{constructor(w){super(),this._onOptionChange=this.register(new d.EventEmitter),this.onOptionChange=this._onOptionChange.event;const m={...c.DEFAULT_OPTIONS};for(const b in w)if(b in m)try{const v=w[b];m[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=m,this.options={...m},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,m){return this.onOptionChange((b=>{b===w&&m(this.rawOptions[w])}))}onMultipleOptionChange(w,m){return this.onOptionChange((b=>{w.indexOf(b)!==-1&&m()}))}_setupOptions(){const w=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},m=(b,v)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:w.bind(this,b),set:m.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(w,m){switch(w){case"cursorStyle":if(m||(m=c.DEFAULT_OPTIONS[w]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(m))throw new Error(`"${m}" is not a valid value for ${w}`);break;case"wordSeparator":m||(m=c.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof m=="number"&&1<=m&&m<=1e3)break;m=S.includes(m)?m:c.DEFAULT_OPTIONS[w];break;case"cursorWidth":m=Math.floor(m);case"lineHeight":case"tabStopWidth":if(m<1)throw new Error(`${w} cannot be less than 1, value: ${m}`);break;case"minimumContrastRatio":m=Math.max(1,Math.min(21,Math.round(10*m)/10));break;case"scrollback":if((m=Math.min(m,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${m}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(m<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${m}`);break;case"rows":case"cols":if(!m&&m!==0)throw new Error(`${w} must be numeric, value: ${m}`);break;case"windowsPty":m=m??{}}return m}}c.OptionsService=C},2660:function(p,c,h){var d=this&&this.__decorate||function(C,T,w,m){var b,v=arguments.length,x=v<3?T:m===null?m=Object.getOwnPropertyDescriptor(T,w):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(C,T,w,m);else for(var k=C.length-1;k>=0;k--)(b=C[k])&&(x=(v<3?b(x):v>3?b(T,w,x):b(T,w))||x);return v>3&&x&&Object.defineProperty(T,w,x),x},_=this&&this.__param||function(C,T){return function(w,m){T(w,m,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const g=h(2585);let S=c.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const T=this._bufferService.buffer;if(C.id===void 0){const k=T.addMarker(T.ybase+T.y),L={data:C,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(L,k))),this._dataByLinkId.set(L.id,L),L.id}const w=C,m=this._getEntryIdKey(w),b=this._entriesWithId.get(m);if(b)return this.addLineToLink(b.id,T.ybase+T.y),b.id;const v=T.addMarker(T.ybase+T.y),x={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(x,v))),this._entriesWithId.set(x.key,x),this._dataByLinkId.set(x.id,x),x.id}addLineToLink(C,T){const w=this._dataByLinkId.get(C);if(w&&w.lines.every((m=>m.line!==T))){const m=this._bufferService.buffer.addMarker(T);w.lines.push(m),m.onDispose((()=>this._removeMarkerFromLink(w,m)))}}getLinkData(C){return this._dataByLinkId.get(C)?.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,T){const w=C.lines.indexOf(T);w!==-1&&(C.lines.splice(w,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};c.OscLinkService=S=d([_(0,g.IBufferService)],S)},8343:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",d="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(_){return _[d]||[]},c.createDecorator=function(_){if(c.serviceRegistry.has(_))return c.serviceRegistry.get(_);const g=function(S,C,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,m,b){m[h]===m?m[d].push({id:w,index:b}):(m[d]=[{id:w,index:b}],m[h]=m)})(g,S,T)};return g.toString=()=>_,c.serviceRegistry.set(_,g),g}},2585:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.IDecorationService=c.IUnicodeService=c.IOscLinkService=c.IOptionsService=c.ILogService=c.LogLevelEnum=c.IInstantiationService=c.ICharsetService=c.ICoreService=c.ICoreMouseService=c.IBufferService=void 0;const d=h(8343);var _;c.IBufferService=(0,d.createDecorator)("BufferService"),c.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),c.ICoreService=(0,d.createDecorator)("CoreService"),c.ICharsetService=(0,d.createDecorator)("CharsetService"),c.IInstantiationService=(0,d.createDecorator)("InstantiationService"),(function(g){g[g.TRACE=0]="TRACE",g[g.DEBUG=1]="DEBUG",g[g.INFO=2]="INFO",g[g.WARN=3]="WARN",g[g.ERROR=4]="ERROR",g[g.OFF=5]="OFF"})(_||(c.LogLevelEnum=_={})),c.ILogService=(0,d.createDecorator)("LogService"),c.IOptionsService=(0,d.createDecorator)("OptionsService"),c.IOscLinkService=(0,d.createDecorator)("OscLinkService"),c.IUnicodeService=(0,d.createDecorator)("UnicodeService"),c.IDecorationService=(0,d.createDecorator)("DecorationService")},1480:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const d=h(8460),_=h(225);class g{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,T,w=!1){return(16777215&C)<<3|(3&T)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;const C=new _.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let T=0,w=0;const m=C.length;for(let b=0;b<m;++b){let v=C.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=m)return T+this.wcwidth(v);const L=C.charCodeAt(b);56320<=L&&L<=57343?v=1024*(v-55296)+L-56320+65536:T+=this.wcwidth(L)}const x=this.charProperties(v,w);let k=g.extractWidth(x);g.extractShouldJoin(x)&&(k-=g.extractWidth(w)),T+=k,w=x}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}c.UnicodeService=g}},s={};function o(p){var c=s[p];if(c!==void 0)return c.exports;var h=s[p]={exports:{}};return i[p].call(h.exports,h,h.exports,o),h.exports}var f={};return(()=>{var p=f;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const c=o(9042),h=o(3236),d=o(844),_=o(5741),g=o(8285),S=o(7975),C=o(7090),T=["cols","rows"];class w extends d.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const v=k=>this._core.options[k],x=(k,L)=>{this._checkReadonlyOptions(k),this._core.options[k]=L};for(const k in this._core.options){const L={get:v.bind(this,k),set:x.bind(this,k)};Object.defineProperty(this._publicOptions,k,L)}}_checkReadonlyOptions(b){if(T.includes(b))throw new Error(`Option "${b}" 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 S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(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 g.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,v,x){this._verifyIntegers(b,v,x),this._core.select(b,v,x)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
82
+ `,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}p.Terminal=w})(),f})()))})(wp)),wp.exports}var qM=GM();function KM(e){let t=!1,i=!1,s=!1,o=!1,f=null,p=null;const c=()=>{f!==null&&(clearTimeout(f),f=null),s=!1},h=()=>{p!==null&&(clearTimeout(p),p=null),i=!1},d=()=>{h(),i=!0,p=setTimeout(()=>{p=null,i=!1},0)},_=()=>{s=!1,f!==null&&clearTimeout(f),p!==null&&(clearTimeout(p),p=null),f=setTimeout(()=>{f=null,i=!1,e()},0)},g=()=>{t=!1,f===null&&(h(),s=!1)},S=()=>{t=!1,o=!1,h(),c()},C=T=>{if(f===null){if(t||i||YM(T)){s=!0,i&&!t?_():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,d(),s&&_()},onCompositionCancel:g,handleKeyEvent(T){return VM(T)&&T.shiftKey?(T.preventDefault?.(),T.type==="keydown"?(o=!0,C(T)):T.type==="keypress"?(o||C(T),o=!1):T.type==="keyup"&&(o=!1),!1):!0},dispose:S}}function VM(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function YM(e){return e.isComposing===!0||e.keyCode===229||e.which===229}const XM={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",lineHeight:1},ZM="Symbols Nerd Font Mono",Ru=`ui-monospace, "SF Mono", Menlo, "${ZM}", monospace`,zm=14,Nw=10,Ow=22,JM=128,QM=.5,e6="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",t6=/[\x00-\x1F\x7F]/g,sy={min:Nw,max:Ow},n6="cascadia",Hh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Ru}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Ru}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Ru}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Ru}`,meta:"Variable · Adobe mono"}],ra=Hh[0];function fh(e){return Hh.find(t=>t.id===e)??ra}function Jl(){return{source:"curated",id:n6,customName:"",family:ra.family,size:zm}}function Hm(e,t){const i=fh(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:Fm(t)}}function $m(e,t){const i=a6(e);return{source:"custom",id:null,customName:i,family:i?`"${Iw(i)}", ${ra.family}`:ra.family,size:Fm(t)}}function Dw(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=Fm(typeof t.size=="number"?t.size:zm);return t.source==="custom"&&typeof t.customName=="string"?$m(t.customName,i):typeof t.id=="string"&&s6(t.id)?Hm(t.id,i):null}function Um(e){if(!e)return Jl();try{const t=Dw(JSON.parse(e));if(t!==null)return t}catch{}return Jl()}function i6(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function Fm(e){return Number.isFinite(e)?Math.min(Ow,Math.max(Nw,Math.round(e))):zm}function jw(e){return e.source==="curated"?{status:"self-hosted",fallbackName:ra.name}:e.customName?{status:r6(e.customName)?"resolved":"fallback",fallbackName:ra.name}:{status:"fallback",fallbackName:ra.name}}function r6(e){if(typeof document>"u")return!1;const t=document.createElement("canvas").getContext("2d");if(!t)return!1;for(const i of["monospace","serif","sans-serif"]){const s=ay(t,`"${Iw(e)}", ${i}`),o=ay(t,i);if(Math.abs(s-o)>QM)return!0}return!1}function ay(e,t){return e.font=`28px ${t}`,e.measureText(e6).width}function s6(e){return Hh.some(t=>t.id===e)}function a6(e){return e.replace(t6,"").trim().slice(0,JM)}function Iw(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}const ph="fleet-plugin.terminal.renderer",ho="fleet-plugin.terminal.font",oy="fleet-console.terminalRenderer",ly="fleet-console.terminalFont",Lg=new Set;let Rs=o6(),Ql=null,sa=0;function o6(){return typeof window>"u"?{renderer:"webgl",font:Jl()}:(l6(),{renderer:f6(),font:p6()})}function l6(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(ph)!==null||window.localStorage.getItem(ho)!==null)return;const e=window.localStorage.getItem(oy),t=window.localStorage.getItem(ly),i=e==="webgl"||e==="dom"?e:"webgl",s=Um(t);window.localStorage.setItem(ph,i),window.localStorage.setItem(ho,i6(s)),window.localStorage.removeItem(oy),window.localStorage.removeItem(ly)}catch{}}function c6(e){sa+=1,Ql=e,d6()}function Bw(){return M.useSyncExternalStore(_6,hy,hy)}function u6(e){g6(e),vo({renderer:e})}function h6(e){const t=Hm(e,Rs.font.size);sa+=1,vo({font:t}),$h(t)}function cy(e){const t=$m(e,Rs.font.size);sa+=1,vo({font:t}),$h(t)}function uy(e){const t=Rs.font.source==="custom"?$m(Rs.font.customName,e):Hm(Rs.font.id,e);sa+=1,vo({font:t}),$h(t)}async function d6(){if(!Ql)return;const e=sa;try{const t=await Ql.read("terminal");if(t!==null){const i=Dw(t.font);if(i!==null){if(e!==sa)return;vo({font:i});try{window.localStorage.removeItem(ho)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(ho)}catch{}if(i!==null){const s=Um(i);if(e!==sa)return;vo({font:s}),$h(s);try{window.localStorage.removeItem(ho)}catch{}}}}catch{}}async function $h(e){if(Ql)try{await Ql.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function f6(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(ph);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function p6(){if(typeof window>"u")return Jl();try{return Um(window.localStorage.getItem(ho))}catch{return Jl()}}function g6(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ph,e)}catch{}}function m6(){for(const e of Lg)e()}function vo(e){Rs={...Rs,...e},m6()}function _6(e){return Lg.add(e),()=>{Lg.delete(e)}}function hy(){return Rs}const v6="Symbols Nerd Font Mono",b6=`1em "${v6}"`,y6=650;let Lu=null;function Pw(){return Lu||(Lu=x6(),Lu)}async function S6(){await w6(Pw(),y6)}async function x6(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(b6)}catch{}}async function w6(e,t){await new Promise(i=>{let s=!1;const o=setTimeout(f,t);e.then(f,f);function f(){s||(s=!0,clearTimeout(o),i())}})}const C6=80,E6=16,k6=250,T6=1024*1024,A6=120,R6={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)"},L6={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 Wm({operationId:e,ticketPath:t,wsPath:i,theme:s="maritime",onExit:o,active:f,zoom:p=1}){const c=s,{renderer:h,font:d}=Bw(),_=M.useRef(null),g=M.useRef(null),S=M.useRef(null),C=M.useRef(null),T=M.useRef(null),w=M.useRef(null),[m,b]=M.useState(p),v=M.useRef(o);v.current=o;const x=M.useRef(f);x.current=f;const[k,L]=M.useState("connecting"),[R,N]=M.useState(0);M.useEffect(()=>{const K=_.current;if(!K)return;let F=!1,G=null,B=null,Y=null;return(async()=>{if(await S6(),F)return;const z=new qM.Terminal({...XM,fontFamily:d.family,fontSize:d.size*m,theme:dy(c)});g.current=z;const V=new aL.FitAddon;w.current=V,z.loadAddon(V),z.open(K),z.loadAddon(new cL.Unicode11Addon),z.unicode.activeVersion="11";const X=KM(()=>z.input(`
83
+ `)),j=K.querySelector("textarea.xterm-helper-textarea, textarea")??K;j.addEventListener("compositionstart",X.onCompositionStart),j.addEventListener("compositionend",X.onCompositionEnd),j.addEventListener("focusout",X.onCompositionCancel),z.attachCustomKeyEventHandler(X.handleKeyEvent);const P=N6(z,x.current!==!1);T.current=P;const D=eL({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:ie=>z.onData(ie),write:P.write},onExit:()=>v.current?.(),onStatus:(ie,Z)=>{L(Z?`${ie}: ${Z}`:ie)}});S.current=D;const U=()=>{V.fit(),D.resize(z.cols,z.rows)},q=()=>{U(),z.refresh(0,z.rows-1)},Q=()=>{B&&clearTimeout(B),B=setTimeout(()=>{B=null,F||q()},C6)},re=async()=>{await document.fonts?.ready,!F&&(q(),D.start(),x.current!==!1&&z.focus())};G=new ResizeObserver(Q),G.observe(K),re(),Y=()=>{B&&clearTimeout(B),j.removeEventListener("compositionstart",X.onCompositionStart),j.removeEventListener("compositionend",X.onCompositionEnd),j.removeEventListener("focusout",X.onCompositionCancel),X.dispose(),D.dispose(),P.dispose(),g.current=null,S.current=null,T.current=null,w.current=null;try{z.dispose()}catch{}},N(ie=>ie+1)})(),()=>{F=!0,G?.disconnect(),Y?.()}},[e,t,i]),M.useEffect(()=>{if(T.current?.setActive(f!==!1),!f)return;M6(g.current);const K=window.requestAnimationFrame(()=>{x.current===!0&&zw(g.current)});return()=>window.cancelAnimationFrame(K)},[f]),M.useEffect(()=>{const K=g.current;if(!K)return;let F=!1;if(h==="webgl")try{const G=new WM;C.current=G,G.onContextLoss(()=>{if(!F){try{G.dispose()}catch{}C.current===G&&(C.current=null)}}),K.loadAddon(G)}catch{try{C.current?.dispose()}catch{}C.current=null}return()=>{F=!0;const G=C.current;if(G){C.current=null;try{G.dispose()}catch{}}}},[h,e,R]),M.useEffect(()=>{const K=g.current;K&&(K.options.theme=dy(c))},[c,R]),M.useEffect(()=>{const K=g.current;K&&(K.options.fontFamily=d.family,fy(K,w.current,S.current))},[d.family,R]),M.useEffect(()=>{if(p===m)return;const K=setTimeout(()=>b(p),A6);return()=>clearTimeout(K)},[p,m]),M.useEffect(()=>{const K=g.current;K&&(K.options.fontSize=d.size*m,fy(K,w.current,S.current))},[m,d.size,R]);const A=k.startsWith("live"),I=m===1?void 0:{width:`${m*100}%`,height:`${m*100}%`,transform:`scale(${1/m})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[A?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),k]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:_,style:I})})]})})}function dy(e){return e==="carbon"?L6:R6}function M6(e){e&&(e.focus(),zw(e))}function zw(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function N6(e,t){let i=t,s=!1,o=null,f=0,p=[];const c=()=>{o&&(clearTimeout(o),o=null)},h=()=>{if(c(),s||f===0)return;const _=O6(p,f);p=[],f=0,e.write(_)},d=()=>{s||o||f===0||(o=setTimeout(h,i?E6:k6))};return{write:_=>{if(!(s||_.byteLength===0)){if(p.push(_),f+=_.byteLength,f>=T6){h();return}d()}},setActive:_=>{if(i!==_){if(i=_,c(),i){h();return}d()}},dispose:()=>{h(),s=!0,p=[],f=0,c()}}}function O6(e,t){if(e.length===1)return e[0]??new Uint8Array;const i=new Uint8Array(t);let s=0;for(const o of e)i.set(o,s),s+=o.byteLength;return i}function fy(e,t,i){t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)}const D6=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class ar extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function j6(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new ar(t.status,"Invalid agent state response");return i.agentClis.map(s=>W6(s,t.status))}async function I6(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.clis))throw new ar(t.status,"Invalid Agent CLI state response");return i}async function B6(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new ar(t.status,"Invalid tenants response");return i.tenants.map(s=>G6(s,t.status))}async function P6(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new ar(t.status,"Invalid jobs response");return i.tenants}async function z6(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new ar(t.status,"Invalid agent sessions response");return i.sessions.map(s=>Uh(s,t.status))}async function H6(e){const t=await fetch("/api/v1/operations",{signal:e});await qr(t);const i=await t.json();if(!Array.isArray(i.operations))throw new ar(t.status,"Invalid operations response");return{operations:i.operations.map(s=>q6(s,t.status))}}async function $6(e,t,i){const s=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:i});return await qr(s),Uh(await s.json(),s.status)}async function U6(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await qr(i),Uh(await i.json(),i.status)}async function F6(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await qr(i)}function Uh(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||Mg(i))throw new ar(t,"Invalid agent session response");return{sessionId:i.sessionId,terminalSessionId:typeof i.terminalSessionId=="string"?i.terminalSessionId:i.sessionId,cwdLabel:i.cwdLabel,label:typeof i.label=="string"?i.label:void 0,cliId:typeof i.cliId=="string"?i.cliId:void 0,cliLabel:typeof i.cliLabel=="string"?i.cliLabel:void 0,status:i.status,turnState:i.turnState==="running"||i.turnState==="ended"?i.turnState:"none",createdAt:i.createdAt,theaterId:typeof i.theaterId=="string"?i.theaterId:void 0,tenantId:typeof i.tenantId=="string"?i.tenantId:void 0,registrationId:typeof i.registrationId=="string"?i.registrationId:void 0,resumeAvailable:i.resumeAvailable===!0}}async function qr(e){if(!e.ok)throw new ar(e.status,`Agent plugin request failed: ${e.status}`)}function W6(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new ar(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function G6(e,t){const i=e;if(!i||typeof i.tenantId!="string"||typeof i.tenantLabel!="string"||typeof i.createdAt!="number"||typeof i.sessions!="number")throw new ar(t,"Invalid tenant response");return i}function q6(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||Mg(i)||Mg(i.payload))throw new ar(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,ts:i.ts}}function Mg(e){return Ng(e,new Set(D6))}function Ng(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>Ng(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||Ng(s,t))}const K6="active",Og=new Set(["done","error","aborted"]);function V6(e,t){let i=Dg(e,t.jobId,t.updatedAt);for(const s of t.events)i=Hw(i,s);return Og.has(t.status)&&!Og.has(i.status)&&(i={...i,status:t.status}),i}function Hw(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,s={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:Z6(e.recentEvents,t)};switch(t.type){case"job:registered":return Y6(s,i);case"job:finalized":return{...s,status:cn(i.status)??"done",finishedAt:ws(i.finishedAt)??t.at,summary:cn(i.summary),error:cn(i.error)};case"track:begin":return Va(s,i,t.id,o=>({...o,startedAt:ws(i.startedAt)??t.at,requestPreview:cn(i.requestPreview)}));case"track:status":return Va(s,i,t.id,o=>({...o,status:cn(i.status)??o.status}));case"track:text":return Va(s,i,t.id,o=>{const f=o.text+(cn(i.text)??"");return{...o,status:"stream",text:f,sentTextLength:o.sentTextLength+(ws(i.textLength)??cn(i.text)?.length??0),latestLine:gy(f)||o.latestLine}});case"track:thought":return Va(s,i,t.id,o=>{const f=o.thought+(cn(i.text)??"");return{...o,thought:f,sentThoughtLength:o.sentThoughtLength+(ws(i.textLength)??cn(i.text)?.length??0),latestLine:gy(f)||o.latestLine}});case"track:tool":return Va(s,i,t.id,o=>({...o,status:"stream",tools:X6(o.tools,i)}));case"track:finalized":return Va(s,i,t.id,o=>{const f=py(o.text,o.sentTextLength,cn(i.fallbackText),ws(i.fallbackTextLength)),p=py(o.thought,o.sentThoughtLength,cn(i.fallbackThought),ws(i.fallbackThoughtLength));return{...o,status:cn(i.status)??"done",finishedAt:ws(i.finishedAt)??t.at,error:cn(i.error),text:f.text,sentTextLength:f.sentLength,thought:p.text,sentThoughtLength:p.sentLength}});default:return s}}function Dg(e,t,i){return{jobId:t,tenantId:e,status:K6,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function $w(e){return Og.has(e)}function Y6(e,t){const i=Array.isArray(t.tracks)?t.tracks:[];let s=e.trackOrder,o=e.tracks;for(const f of i){if(!f.trackId)continue;const p=o[f.trackId],c={...p??Uw(f.trackId),displayName:f.displayName??p?.displayName??f.trackId,displayCli:f.displayCli??p?.displayCli,model:f.model??p?.model,effort:f.effort??p?.effort,subtitle:f.subtitle??p?.subtitle,kind:f.kind??p?.kind,startedAt:f.startedAt??p?.startedAt};p||(s=[...s,f.trackId]),o={...o,[f.trackId]:c}}return{...e,label:cn(t.label)??e.label,ownerCarrierId:cn(t.ownerCarrierId)??e.ownerCarrierId,kind:cn(t.kind)??e.kind,signatureCli:cn(t.signatureCli)??e.signatureCli,startedAt:ws(t.startedAt)??e.startedAt,trackOrder:s,tracks:o}}function Va(e,t,i,s){const o=cn(t.trackId);if(!o)return e;const f=e.tracks[o],p={...s(f??Uw(o)),lastEventId:i};return{...e,trackOrder:f?e.trackOrder:[...e.trackOrder,o],tracks:{...e.tracks,[o]:p}}}function Uw(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function X6(e,t){const i=cn(t.toolId)??cn(t.id);if(!i)return e;const s={id:i,name:cn(t.name),input:t.input,output:t.output,status:cn(t.status)},o=e.findIndex(f=>f.id===i);return o>=0?[...e.slice(0,o),{...e[o],...s},...e.slice(o+1)]:[...e,s]}function py(e,t,i,s){return i?t>=(s??i.length)?{text:e,sentLength:t}:{text:i,sentLength:s??i.length}:{text:e,sentLength:t}}function Z6(e,t){return[...e,t].slice(-120)}function gy(e){const t=e.trim();if(!t)return"";const i=t.split(`
84
+ `);return i[i.length-1]?.trim()??""}function cn(e){return typeof e=="string"?e:void 0}function ws(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const J6=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function Q6(){let e="";return t=>{e+=t;const i=[];let s=e.indexOf(`
85
+
86
+ `);for(;s>=0;){const o=e.slice(0,s);e=e.slice(s+2);const f=t4(o);f&&i.push(f),s=e.indexOf(`
87
+
88
+ `)}return i}}function e4(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const s=t.tenant?.tenantId;return!s||!t.truncation?null:{kind:"truncation",tenantId:s,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const s=_y(t.session);return s?{kind:"session",tenantId:s.tenantId??s.sessionId,session:s}:null}if(e.event==="session:attention"){const s=_y(t.session);return s?{kind:"attention",tenantId:s.tenantId??s.sessionId,session:s,reason:n4(t.reason)}:null}const i=my(t.event)??my(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function t4(e){const t=e.split(`
89
+ `),i=t.find(o=>o.startsWith("event:"))?.slice(6).trim()??"message",s=t.filter(o=>o.startsWith("data:")).map(o=>o.slice(5).trim()).join(`
90
+ `);return!s&&i==="message"?null:{event:i,data:s}}function my(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 _y(e){try{return Uh(e,200)}catch{return null}}function n4(e){return typeof e=="string"&&J6.has(e)?e:void 0}const Gm={droppedCount:0},jg=new Set;let qt={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function i4(){return ex(r4,Fw)}function Fw(){return qt}function r4(e){return jg.add(e),()=>{jg.delete(e)}}function Ti(e){qt={...qt,...e},h4()}function s4(e){Ti({agentClis:e})}function a4(e){const t={};for(const i of e)t[i.sessionId]=i;Ti({sessions:t,sessionOrder:[...e].sort((i,s)=>s.createdAt-i.createdAt).map(i=>i.sessionId)})}function gh(e){const t=!!qt.sessions[e.sessionId];Ti({sessions:{...qt.sessions,[e.sessionId]:e},sessionOrder:t?qt.sessionOrder:[e.sessionId,...qt.sessionOrder],turnState:{...qt.turnState,[e.sessionId]:e.turnState}})}function Ww(e){const{[e]:t,...i}=qt.sessions,{[e]:s,...o}=qt.turnState;Ti({sessions:i,sessionOrder:qt.sessionOrder.filter(f=>f!==e),activeTerminalSessionId:qt.activeTerminalSessionId===e?null:qt.activeTerminalSessionId,turnState:o})}function Gw(e){Ti({activeTerminalSessionId:e})}function o4(e){Ti({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...qt.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&qt.tenantJobs[t])]})}function l4(e){const t={};for(const i of e){const s={};for(const o of i.jobs)s[o.jobId]=V6(i.tenantId,o);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(o=>o.jobId),jobs:s,truncation:i.truncation??Gm}}Ti({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...qt.tenantOrder.filter(i=>t[i])]})}function c4(e,t){const i=e.tenantId,s=e.jobId??d4(e),o=qt.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:Gm},f=s?o.jobs[s]??Dg(i,s,e.at):Dg(i,"__unknown__",e.at),p=Hw(f,e),c=s&&o.jobOrder.includes(s)?o.jobOrder:s?[s,...o.jobOrder]:o.jobOrder,h={...o,tenantLabel:t??o.tenantLabel,jobOrder:c,jobs:s?{...o.jobs,[s]:p}:o.jobs};return Ti({tenantJobs:{...qt.tenantJobs,[i]:h},tenantOrder:qt.tenantOrder.includes(i)?qt.tenantOrder:[i,...qt.tenantOrder]}),{job:p,unknownTenant:!qt.tenantJobs[i]}}function u4(e,t,i){const s=qt.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:Gm};Ti({tenantJobs:{...qt.tenantJobs,[e]:{...s,tenantLabel:t??s.tenantLabel,truncation:i}}})}function qw(e){const t=e.tenantId;if(!t)return[];const i=qt.tenantJobs[t];return i?i.jobOrder.map(s=>i.jobs[s]).filter(s=>!!s):[]}function h4(){for(const e of jg)e()}function d4(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const vy=250,f4=5e3,Ig=new Map;function p4(e){const t=new AbortController;return g4(t.signal,e),()=>t.abort()}async function g4(e,t){let i=vy;for(;!e.aborted;){Ti({connection:"connecting"});try{await b4(e,t);const s=await fetch("/plugins/terminal/agent/events",{signal:e});if(!s.ok||!s.body)throw new Error(`Agent stream failed: ${s.status}`);Ti({connection:"live",connectionError:null}),i=vy,await m4(s.body.getReader(),e,t),e.aborted||Ti({connection:"connecting",connectionError:null})}catch(s){if(e.aborted)return;Ti({connection:"connecting",connectionError:s instanceof Error?s.message:String(s)})}if(e.aborted)return;await S4(i,e),i=Math.min(i*2,f4)}}async function m4(e,t,i){const s=new TextDecoder,o=Q6();for(;!t.aborted;){const f=await e.read();if(f.done)return;for(const p of o(s.decode(f.value,{stream:!0}))){const c=e4(p);if(c){if(c.kind==="truncation"&&c.truncation){u4(c.tenantId,c.tenantLabel,c.truncation);continue}if(c.kind==="session"&&c.session){gh(c.session),mh(i,c.session.sessionId,qm(c.session));continue}if(c.kind==="attention"&&c.session){gh(c.session),c.reason!=="idle_prompt"&&mh(i,c.session.sessionId,"awaiting");continue}c.event&&(c4(c.event,c.tenantLabel),v4(i,c.event.tenantId))}}}}function qm(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&_4(e)?"running":"idle"}function _4(e){return qw(e).some(t=>!$w(t.status))}function mh(e,t,i){const s=Ig.get(t);e.status.set(t,i),Ig.set(t,i),s!==i&&(i==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):i==="idle"&&(s==="running"||s==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function v4(e,t){const{sessions:i}=Fw();for(const s of Object.values(i))s.tenantId===t&&Ig.get(s.sessionId)!=="awaiting"&&mh(e,s.sessionId,qm(s))}async function b4(e,t){const[i,s,o,f,p]=await Promise.all([j6(e),z6(e),B6(e),P6(e),H6(e)]);s4(i),a4(s),o4(o),l4(f);for(const c of s)mh(t,c.sessionId,qm(c));y4(p.operations,t)}function y4(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function S4(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}const x4=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]),w4=new Set(["claude","codex","opencode-go","cursor"]);function C4(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const i=Math.floor(t/60),s=t%60;return`${i}m ${s}s`}function E4(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function k4(e){return e.trackOrder.reduce((t,i)=>{const s=e.tracks[i];return s?t+Math.round((s.sentTextLength+s.sentThoughtLength)/4):t},0)}function T4(e){if(e.kind==="taskforce")return"taskforce";const t=e.signatureCli;return t&&w4.has(t)?t:void 0}function Kw(e){if(e)return x4.has(e)?e:void 0}class Vw extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function A4(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await Yw(t),Xw(await t.json(),t.status)}async function R4(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await Yw(i),Xw(await i.json(),i.status)}async function Yw(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new Vw(e.status,t)}function Xw(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean")throw new Vw(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor}}const Bg=new Set;let _h={loading:!1,state:null,savingField:null,error:null},Ju=0;function L4(){return M.useSyncExternalStore(M4,by,by)}function by(){return _h}function M4(e){return Bg.add(e),()=>{Bg.delete(e)}}async function N4(e){const t=++Ju;fo({loading:!0,error:null});try{const i=await A4(e);if(t!==Ju)return;fo({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==Ju)return;fo({loading:!1,error:Zw(i)})}}async function O4(e,t){const i=_h.state;if(!i)return!1;Ju+=1;const s={...i,[e]:t};fo({state:s,savingField:e,error:null});try{const o=await R4(s);return fo({state:o,savingField:null,error:null}),!0}catch(o){return fo({state:i,savingField:null,error:Zw(o)}),!1}}function fo(e){_h={..._h,...e};for(const t of Bg)t()}function Zw(e){return e instanceof Error?e.message:String(e)}const D4=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],j4="/plugins/terminal/agent/ticket",I4="/plugins/terminal/ws",Cp="fleet-plugin.terminal.stream-dock-expanded",B4="fleet-plugin.terminal.stream-dock-collapsed",P4=56,Jw={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>jl(e.payload,"cliLabel")??void 0,render:e=>u.jsx(W4,{context:e})},Qw={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(K4,{})},eC={id:"agent.attention",title:"Agent input waiting"},z4={id:"agent.ended",title:"Agent turn ended"},Mu={id:"terminal",operationKinds:[Jw],settingsSections:[Qw],notificationKinds:[eC,z4],install:e=>H4(e),closeOperation:async e=>{try{await F6(e)}finally{Ww(e)}},launch:async({theaterId:e,kind:t})=>{const i=await $6(e,t.id);return gh(i),Gw(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?u.jsx(uN,{}):e.id==="codex"?u.jsx(dN,{}):e.id==="cursor"?u.jsx(hN,{}):u.jsx(cN,{})};function H4(e){return p4({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function $4(e,t){const i=M.useRef(null),s=M.useRef(!0),[o,f]=M.useState(!0),p=M.useCallback(h=>{s.current!==h&&(s.current=h,f(h))},[]);M.useEffect(()=>{const h=i.current;if(!h)return;const d=()=>{const _=h.scrollHeight-h.scrollTop-h.clientHeight;p(_<=P4)};return h.addEventListener("scroll",d,{passive:!0}),()=>h.removeEventListener("scroll",d)},[p]),M.useLayoutEffect(()=>{p(!0);const h=i.current;h&&(h.scrollTop=h.scrollHeight)},[e,p]),M.useLayoutEffect(()=>{const h=i.current;!h||!s.current||(h.scrollTop=h.scrollHeight)},[t]);const c=M.useCallback(()=>{const h=i.current;h&&(h.scrollTop=h.scrollHeight,h.focus({preventScroll:!0}),p(!0))},[p]);return{containerRef:i,pinned:o,jumpToLatest:c}}function U4(){const[e,t]=M.useState(()=>{try{return localStorage.removeItem(B4),localStorage.getItem(Cp)==="true"}catch{return!1}}),i=M.useCallback(s=>{try{s?localStorage.setItem(Cp,"true"):localStorage.removeItem(Cp)}catch{}t(s)},[]);return[e,i]}function F4(e){const[t,i]=M.useState(Date.now);return M.useEffect(()=>{if(e===void 0)return;const s=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(s)},[e]),e===void 0?"":C4(t-e)}function W4({context:e}){const i=i4().sessions[e.operationId]??eN(e),[s,o]=M.useState(!1),f=M.useRef(null),p=M.useRef(null),c=M.useRef(null),d=qw(i).filter(g=>!$w(g.status)),_=M.useCallback(()=>{o(!1),c.current?.focus()},[]);return M.useLayoutEffect(()=>{s&&f.current?.focus()},[s]),M.useEffect(()=>{if(!s)return;const g=S=>{if(S.key==="Escape"){S.stopPropagation(),_();return}if(S.key==="Tab"){const C=p.current;if(!C)return;const T=Array.from(C.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(b=>!b.hasAttribute("disabled")),w=T[0],m=T[T.length-1];S.shiftKey&&document.activeElement===w?(S.preventDefault(),m?.focus()):!S.shiftKey&&document.activeElement===m&&(S.preventDefault(),w?.focus())}};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[s,_]),i.status==="dormant"?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{Q4(i.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(Wm,{operationId:i.sessionId,ticketPath:j4,wsPath:I4,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>Ww(i.sessionId)}),d.length>0?u.jsx(G4,{activeJobs:d,onOpenDetail:()=>o(!0),detailBtnRef:c}):null,s?u.jsxs("div",{ref:p,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[u.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:_}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:_,children:"×"}),u.jsx("div",{className:"job-overlay-body",children:d.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):d.map(g=>u.jsx(Z4,{job:g},g.jobId))})]})]}):null]})}function G4({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[s,o]=U4(),f=e[0],p=F4(f?.startedAt),c=e.reduce((k,L)=>k+k4(L),0),h=E4(c),d=e.length===1&&f?T4(f):void 0,_=e.length===1&&f?Kw(f.ownerCarrierId):void 0,g=e.length===1&&f?f.label:void 0,S=e.length>1?`${e.length} carriers`:f?.ownerCarrierId??"Carrier",C=nN(e),T=e.map(k=>`${k.jobId}:${k.lastEventId}`).join(","),w=`${s}:${e.map(k=>k.jobId).join(",")}`,{containerRef:m,pinned:b,jumpToLatest:v}=$4(w,T),x=e.some(k=>k.trackOrder.some(L=>{const R=k.tracks[L];return R?Km(R.status):!1}));return u.jsxs("div",{className:"job-dock","data-signature":d,children:[u.jsxs("div",{className:"job-dock-strip",children:[u.jsx("span",{className:"job-dock-dot","aria-hidden":"true"}),u.jsx("span",{className:"job-dock-carrier","data-captain":_,title:g,children:S}),u.jsxs("span",{className:"job-dock-strip-line",style:s?{display:"none"}:void 0,"aria-hidden":"true",children:[C,!s&&x&&C?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"job-dock-meta",children:[p?u.jsx("span",{children:p}):null,h?u.jsx("span",{children:h}):null]}),u.jsx("button",{type:"button",className:"job-dock-grip","aria-label":s?"Collapse stream dock":"Expand stream dock","aria-expanded":s,onClick:()=>o(!s),children:s?"▼":"▲"}),u.jsx("button",{ref:i,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${s?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:m,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(k=>{const L=e.length>1,R=!L&&k.trackOrder.length===1;return k.trackOrder.map(N=>{const A=k.tracks[N];return A?u.jsx(q4,{track:A,job:k,multiJob:L,singleTrack:R},`${k.jobId}:${N}`):null})})]}),b?null:u.jsx("button",{type:"button",className:"follow-button",onClick:v,children:"↓ Follow"})]})]})}function q4({track:e,job:t,multiJob:i,singleTrack:s}){const o=Km(e.status),f=yy(e.text),p=yy(e.thought),c=f||p,h=!f&&!!p,d=o?tN(e):void 0,_=i||!s,g=i?Kw(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[_?u.jsx("span",{className:"job-dock-row-name","data-captain":g,children:e.displayName}):null,u.jsxs("span",{className:`job-dock-row-status${o?" job-dock-row-status--live":""}`,children:[e.status,d?` · ${d}`:""]}),c?u.jsxs("span",{className:`job-dock-row-line${h?" is-thought":""}`,children:[c,o?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null]})}function K4(){const[e,t]=M.useState([]),[i,s]=M.useState(null),{renderer:o,font:f}=Bw();return M.useEffect(()=>{const p=new AbortController;return I6(p.signal).then(c=>t(c.clis)).catch(c=>{p.signal.aborted||s(c instanceof Error?c.message:String(c))}),()=>p.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsx(V4,{}),u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.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."}),i?u.jsx("p",{className:"settings-error",children:i}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(p=>u.jsx(X4,{cli:p},p.id))}),u.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),u.jsx(iN,{terminalFont:f}),u.jsx(rN,{terminalRenderer:o})]})}function V4(){const e=L4(),t=e.state,i=e.savingField!==null;return M.useEffect(()=>{const s=new AbortController;return N4(s.signal),()=>s.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsx(u.Fragment,{children:u.jsx(Y4,{title:"Metaphor",help:"Enabled layers the naval tone overlay — clipped reporting cadence and Fleet vocabulary — onto every session. Off keeps the Admiral persona without the tone.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:i,onToggle:()=>{O4("enableMetaphor",!t.enableMetaphor)}})}):u.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function Y4({title:e,help:t,onLabel:i,offLabel:s,value:o,disabled:f,onToggle:p}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${o?"is-on":""}`,disabled:f,"aria-pressed":o,onClick:p,children:u.jsx("span",{children:o?i:s})})]})}function X4({cli:e}){return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function Z4({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const i=e.tracks[t];return i?u.jsx(J4,{track:i},i.trackId):null})})]})}function J4({track:e}){const t=lN(e.status),i=t==="track-card--live";return u.jsxs("article",{className:t?`track-card ${t}`:"track-card",children:[u.jsxs("header",{className:"track-card-head",children:[u.jsx("span",{className:"track-card-title",children:e.displayName}),u.jsx("span",{className:"track-card-status",children:e.status})]}),e.thought?u.jsxs("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:[u.jsx("span",{className:"track-card-section-label","aria-hidden":"true",children:"thinking"}),u.jsx("pre",{children:e.thought})]}):null,e.text?u.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[u.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),u.jsxs("pre",{children:[e.text,i?u.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?u.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?u.jsx("ul",{className:"track-card-tools",children:e.tools.map(s=>u.jsx("li",{children:s.name??s.id},s.id))}):null]})}async function Q4(e){gh(await U6(e)),Gw(e)}function eN(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:jl(e.operation.payload,"cliId")??void 0,cliLabel:jl(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:jl(e.operation.payload,"tenantId")??void 0,registrationId:jl(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function jl(e,t){const i=e[t];return typeof i=="string"?i:null}function Km(e){return e==="stream"||e==="live"||e==="running"||e==="active"}function tN(e){const t=e.tools.find(i=>i.status!=="completed"&&i.status!=="failed"&&i.status!=="error");return t?t.name??t.id:void 0}function nN(e){const t=e.flatMap(i=>i.trackOrder.map(s=>i.tracks[s])).filter(i=>!!i).sort((i,s)=>s.lastEventId-i.lastEventId);for(const i of t)if(i.latestLine)return i.latestLine;return""}function yy(e){const t=e.trim();if(!t)return"";const i=t.split(`
91
+ `);return i[i.length-1]?.trim()??""}function iN({terminalFont:e}){const t=jw(e),i=aN(e);return u.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[u.jsxs("div",{className:"global-settings-row is-stack",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.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; remembered on this browser."})]}),u.jsxs("div",{className:"font-control","aria-describedby":"terminal-font-help",children:[u.jsxs("div",{className:"current-readout","aria-live":"polite",children:[u.jsx("span",{className:"cr-label",children:"Currently"}),u.jsx("span",{className:"cr-value",children:i}),u.jsx("span",{className:"cr-sep",children:"·"}),u.jsxs("span",{className:"cr-value",children:[e.size,"px"]}),u.jsx("span",{className:"cr-sep",children:"·"}),u.jsx("span",{className:`cr-value ${t.status==="fallback"?"is-fallback":"is-ok"}`,children:t.status})]}),u.jsxs("div",{className:"font-cards",role:"group","aria-label":"Terminal font family",children:[Hh.map(s=>u.jsx(sN,{font:s,active:e.source==="curated"&&e.id===s.id,onSelect:()=>h6(s.id)},s.id)),u.jsxs("button",{type:"button","aria-pressed":e.source==="custom",className:`font-card ${e.source==="custom"?"is-active":""}`,onClick:()=>{e.source!=="custom"&&cy("")},children:[u.jsxs("span",{className:"fc-name",children:["Custom…",u.jsx("span",{className:"fc-check","aria-hidden":"true",children:"✓"})]}),u.jsx("span",{className:"fc-sample is-custom","aria-hidden":"true",children:"type a font"}),u.jsx("span",{className:"fc-meta",children:"your installed face"}),u.jsx("span",{className:"fc-bundled fc-addon",children:"local OS font"})]})]}),u.jsx("div",{className:`custom-reveal ${e.source==="custom"?"is-open":""}`,children:u.jsxs("div",{className:"font-field-wrap",children:[u.jsxs("label",{className:"font-field",children:[u.jsx("span",{className:"field-icon","aria-hidden":"true",children:"Aa"}),u.jsx("input",{type:"text",spellCheck:!1,value:e.customName,placeholder:"e.g. MesloLGS NF, Fira Code, IBM Plex Mono","aria-label":"Custom terminal font family",onChange:s=>cy(s.currentTarget.value)})]}),u.jsxs("div",{className:`resolve-chip ${t.status==="fallback"?"is-fallback":"is-ok"}`,"aria-live":"polite",children:[u.jsx("span",{className:"rc-dot","aria-hidden":"true"}),u.jsx("span",{children:oN(e)})]})]})}),u.jsxs("div",{className:"size-row",children:[u.jsxs("div",{className:"size-stepper",role:"group","aria-label":"Font size",children:[u.jsx("button",{type:"button","aria-label":"Decrease terminal font size",disabled:e.size<=sy.min,onClick:()=>uy(e.size-1),children:"−"}),u.jsxs("span",{className:"size-val",children:[e.size,u.jsx("span",{children:" px"})]}),u.jsx("button",{type:"button","aria-label":"Increase terminal font size",disabled:e.size>=sy.max,onClick:()=>uy(e.size+1),children:"+"})]}),u.jsx("span",{className:"size-label",children:"Cell size — rescales every panel; zoom stays relative"})]})]})]}),u.jsx("p",{className:"global-settings-foot",children:"Appearance preferences apply immediately and are stored per browser, separate from session settings."})]})}function rN({terminalRenderer:e}){return u.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),u.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."})]}),u.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:D4.map(t=>{const i=t.id===e;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>u6(t.id),children:t.label},t.id)})})]})})}function sN({active:e,font:t,onSelect:i}){return u.jsxs("button",{type:"button","aria-pressed":e,className:`font-card ${e?"is-active":""}`,onClick:i,children:[u.jsxs("span",{className:"fc-name",children:[t.name,u.jsx("span",{className:"fc-check","aria-hidden":"true",children:"✓"})]}),u.jsx("span",{className:"fc-sample",style:{fontFamily:t.family},"aria-hidden":"true",children:"Ag 0O ─┼ =>"}),u.jsx("span",{className:"fc-meta",children:t.meta}),u.jsx("span",{className:"fc-bundled",children:"self-hosted"})]})}function aN(e){return e.source==="custom"?e.customName||`${fh(null).name} (default)`:fh(e.id).name}function oN(e){if(!e.customName)return`Empty — using default ${fh(null).name}`;const t=jw(e);return t.status==="resolved"?`"${e.customName}" resolves on this machine`:`"${e.customName}" not found — falls back to ${t.fallbackName}`}function lN(e){return Km(e)?"track-card--live":e==="error"?"track-card--bad":e==="done"||e==="aborted"?"track-card--idle":""}function cN(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.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"}),u.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function uN(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.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 hN(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",fill:"currentColor"})})}function dN(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.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"})})}const fN="global-shell",pN="/plugins/terminal/global/ticket",gN="/plugins/terminal/ws",mN=168,_N={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},vN={id:"global-shell",title:"Shell",icon:bN,preferredExtraWidth:mN,render:e=>u.jsx("div",{style:_N,children:u.jsx(Wm,{operationId:fN,ticketPath:pN,wsPath:gN,theme:"carbon",active:!0})})};function bN(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const yN="/plugins/terminal/shell/ticket",SN="/plugins/terminal/ws",tC={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>M.createElement(xN,{context:e})},Ep={id:"terminal",operationKinds:[tC],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:()=>u.jsx(wN,{})};function xN({context:e}){return u.jsx(Wm,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:yN,wsPath:SN,theme:e.theme,onExit:e.onClose})}function wN(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),u.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 CN=new Set(["agent"]),EN={id:"terminal",operationKinds:[tC,Jw],settingsSections:[Qw],notificationKinds:[eC],railPanels:[vN],install:e=>(Pw(),c6(e.settings),Mu.install?.(e)),closeOperation:async e=>{const t=await TN(e);if(t?.type==="shell"){await Ep.closeOperation?.(e);return}t&&CN.has(t.type)&&await Mu.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?Ep.launch?.(e)??{id:""}:Mu.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?Ep.renderLaunchIcon?.(e):Mu.renderLaunchIcon?.(e)},kN=[EN];async function TN(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const i=await t.json();return typeof i.operation?.type=="string"?{type:i.operation.type}:null}const ae={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"},AN={src:ae.ts,lib:ae.ts,app:ae.ts,test:ae.shell,tests:ae.shell,__tests__:ae.shell,spec:ae.shell,specs:ae.shell,node_modules:ae.binary,vendor:ae.binary,dist:ae.config,build:ae.config,out:ae.config,target:ae.config,docs:ae.md,doc:ae.md,public:ae.data,assets:ae.data,static:ae.data,components:ae.image,scripts:ae.js,styles:ae.css,".git":ae.html,".github":ae.config,".vscode":ae.css},Sy={ts:{shape:"angle",tone:ae.ts},tsx:{shape:"angle",tone:ae.ts},mts:{shape:"angle",tone:ae.ts},cts:{shape:"angle",tone:ae.ts},"d.ts":{shape:"angle",tone:ae.ts},js:{shape:"angle",tone:ae.js},jsx:{shape:"angle",tone:ae.js},mjs:{shape:"angle",tone:ae.js},cjs:{shape:"angle",tone:ae.js},json:{shape:"braces",tone:ae.json},jsonc:{shape:"braces",tone:ae.json},json5:{shape:"braces",tone:ae.json},jsonl:{shape:"braces",tone:ae.json},graphql:{shape:"braces",tone:ae.image},gql:{shape:"braces",tone:ae.image},proto:{shape:"braces",tone:ae.go},css:{shape:"hash",tone:ae.css},scss:{shape:"hash",tone:ae.css},sass:{shape:"hash",tone:ae.css},less:{shape:"hash",tone:ae.css},styl:{shape:"hash",tone:ae.css},html:{shape:"markup",tone:ae.html},htm:{shape:"markup",tone:ae.html},xml:{shape:"markup",tone:ae.html},xhtml:{shape:"markup",tone:ae.html},vue:{shape:"markup",tone:ae.shell},svelte:{shape:"markup",tone:ae.rust},astro:{shape:"markup",tone:ae.image},md:{shape:"doc",tone:ae.md},mdx:{shape:"doc",tone:ae.md},markdown:{shape:"doc",tone:ae.md},rst:{shape:"doc",tone:ae.md},txt:{shape:"doc",tone:ae.default},text:{shape:"doc",tone:ae.default},log:{shape:"doc",tone:ae.default},adoc:{shape:"doc",tone:ae.md},pdf:{shape:"doc",tone:ae.ruby},py:{shape:"angle",tone:ae.py},pyi:{shape:"angle",tone:ae.py},pyw:{shape:"angle",tone:ae.py},go:{shape:"angle",tone:ae.go},rs:{shape:"angle",tone:ae.rust},rb:{shape:"angle",tone:ae.ruby},rake:{shape:"angle",tone:ae.ruby},gemspec:{shape:"angle",tone:ae.ruby},java:{shape:"angle",tone:ae.html},kt:{shape:"angle",tone:ae.config},kts:{shape:"angle",tone:ae.config},scala:{shape:"angle",tone:ae.ruby},c:{shape:"angle",tone:ae.ts},h:{shape:"angle",tone:ae.ts},cpp:{shape:"angle",tone:ae.css},cc:{shape:"angle",tone:ae.css},cxx:{shape:"angle",tone:ae.css},hpp:{shape:"angle",tone:ae.css},cs:{shape:"angle",tone:ae.config},php:{shape:"angle",tone:ae.config},swift:{shape:"angle",tone:ae.html},lua:{shape:"angle",tone:ae.ts},dart:{shape:"angle",tone:ae.go},sh:{shape:"terminal",tone:ae.shell},bash:{shape:"terminal",tone:ae.shell},zsh:{shape:"terminal",tone:ae.shell},fish:{shape:"terminal",tone:ae.shell},ps1:{shape:"terminal",tone:ae.css},bat:{shape:"terminal",tone:ae.shell},cmd:{shape:"terminal",tone:ae.shell},yaml:{shape:"gear",tone:ae.config},yml:{shape:"gear",tone:ae.config},toml:{shape:"gear",tone:ae.config},ini:{shape:"gear",tone:ae.config},conf:{shape:"gear",tone:ae.config},cfg:{shape:"gear",tone:ae.config},properties:{shape:"gear",tone:ae.config},env:{shape:"gear",tone:ae.config},editorconfig:{shape:"gear",tone:ae.config},png:{shape:"image",tone:ae.image},jpg:{shape:"image",tone:ae.image},jpeg:{shape:"image",tone:ae.image},gif:{shape:"image",tone:ae.image},webp:{shape:"image",tone:ae.image},svg:{shape:"image",tone:ae.image},ico:{shape:"image",tone:ae.image},bmp:{shape:"image",tone:ae.image},avif:{shape:"image",tone:ae.image},tiff:{shape:"image",tone:ae.image},heic:{shape:"image",tone:ae.image},mp4:{shape:"image",tone:ae.data},mov:{shape:"image",tone:ae.data},webm:{shape:"image",tone:ae.data},mkv:{shape:"image",tone:ae.data},mp3:{shape:"chip",tone:ae.shell},wav:{shape:"chip",tone:ae.shell},flac:{shape:"chip",tone:ae.shell},ogg:{shape:"chip",tone:ae.shell},sql:{shape:"database",tone:ae.data},csv:{shape:"database",tone:ae.data},tsv:{shape:"database",tone:ae.data},db:{shape:"database",tone:ae.data},sqlite:{shape:"database",tone:ae.data},sqlite3:{shape:"database",tone:ae.data},parquet:{shape:"database",tone:ae.data},zip:{shape:"archive",tone:ae.archive},tar:{shape:"archive",tone:ae.archive},gz:{shape:"archive",tone:ae.archive},tgz:{shape:"archive",tone:ae.archive},bz2:{shape:"archive",tone:ae.archive},xz:{shape:"archive",tone:ae.archive},rar:{shape:"archive",tone:ae.archive},"7z":{shape:"archive",tone:ae.archive},zst:{shape:"archive",tone:ae.archive},bin:{shape:"chip",tone:ae.binary},exe:{shape:"chip",tone:ae.binary},dll:{shape:"chip",tone:ae.binary},so:{shape:"chip",tone:ae.binary},dylib:{shape:"chip",tone:ae.binary},wasm:{shape:"chip",tone:ae.config},class:{shape:"chip",tone:ae.binary},lock:{shape:"chip",tone:ae.binary},woff:{shape:"chip",tone:ae.config},woff2:{shape:"chip",tone:ae.config},ttf:{shape:"chip",tone:ae.config},otf:{shape:"chip",tone:ae.config}},RN={dockerfile:{shape:"chip",tone:ae.css},"docker-compose.yml":{shape:"gear",tone:ae.css},"docker-compose.yaml":{shape:"gear",tone:ae.css},makefile:{shape:"gear",tone:ae.html},"cmakelists.txt":{shape:"gear",tone:ae.html},".gitignore":{shape:"gear",tone:ae.html},".gitattributes":{shape:"gear",tone:ae.html},".dockerignore":{shape:"gear",tone:ae.html},".npmignore":{shape:"gear",tone:ae.html},".npmrc":{shape:"gear",tone:ae.ruby},"package.json":{shape:"braces",tone:ae.shell},"tsconfig.json":{shape:"braces",tone:ae.ts},license:{shape:"doc",tone:ae.json},"license.md":{shape:"doc",tone:ae.json},licence:{shape:"doc",tone:ae.json}},LN={shape:"default",tone:ae.default},Pg={angle:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.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"}),u.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:u.jsxs(u.Fragment,{children:[u.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"}),u.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"}),u.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),u.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:u.jsxs(u.Fragment,{children:[u.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"}),u.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"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.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:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),u.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:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),u.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:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.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"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:u.jsxs(u.Fragment,{children:[u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),u.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"}),u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.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:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),u.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"}),u.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.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:u.jsxs(u.Fragment,{children:[u.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"}),u.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"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:u.jsxs(u.Fragment,{children:[u.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"}),u.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:u.jsxs(u.Fragment,{children:[u.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"}),u.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"}),u.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"}),u.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 MN({name:e}){const t=ON(e);return u.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:Pg[t.shape]})}function NN({name:e,open:t}){const i=AN[e.toLowerCase()]??ae.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${i})`},children:t?Pg.folderOpen:Pg.folderClosed})}function ON(e){const t=e.toLowerCase(),i=RN[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:ae.config};if(t.startsWith("readme"))return{shape:"doc",tone:ae.md};if(t.endsWith(".d.ts"))return Sy["d.ts"];const s=t.lastIndexOf(".");if(s>0&&s<t.length-1){const o=t.slice(s+1),f=Sy[o];if(f)return f}return LN}const DN=200,Nu=30,xy=5,nC="fleet-console.fileExplorer.showHidden";function iC(e,t,i,s){for(const o of e)if(!(!s&&o.name.startsWith("."))){if(o.name.toLowerCase().includes(i))return!0;if(o.kind==="dir"){const f=t.get(o.relativePath)?.entries;if(f&&iC(f,t,i,s))return!0}}return!1}function rC(e,t,i,s,o,f,p,c){const h=[];for(const d of e)if(!(!c&&d.name.startsWith("."))){if(p){const _=d.name.toLowerCase().includes(p),g=d.kind==="dir"&&iC(f.get(d.relativePath)?.entries??[],f,p,c);if(!_&&!g)continue}if(h.push({entry:d,depth:t,isSelected:i===d.relativePath,isExpanded:s.has(d.relativePath),isLoading:o.has(d.relativePath)}),d.kind==="dir"&&s.has(d.relativePath)){const _=f.get(d.relativePath)?.entries;_&&h.push(...rC(_,t+1,i,s,o,f,p,c))}}return h}function jN({files:e,theaterId:t,selectedPath:i,onSelect:s}){const[o,f]=M.useState(null),[p,c]=M.useState(null),[h,d]=M.useState(""),[_,g]=M.useState(new Set),[S,C]=M.useState(new Set),[T,w]=M.useState(new Map),[m,b]=M.useState(""),[v,x]=M.useState(0),[k,L]=M.useState(600),[R,N]=M.useState(()=>IN()),A=M.useRef(null),I=M.useRef(_);I.current=_;const K=M.useRef(h);K.current=h;const F=M.useRef(e);F.current=e,M.useEffect(()=>{t&&(f(null),c(null),d(""),g(new Set),w(new Map),b(""))},[t]),M.useEffect(()=>{t&&e.listFolder(h||void 0).then(ie=>{f(ie),c(null)}).catch(ie=>{c(ie instanceof Error?ie.message:"Unable to load folder")})},[t,h,e]),M.useEffect(()=>{const ie=A.current;if(!ie)return;const Z=new ResizeObserver(()=>L(ie.clientHeight));return Z.observe(ie),L(ie.clientHeight),()=>Z.disconnect()},[]),M.useEffect(()=>{if(!t)return;let ie=!0;const Z=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(t)}`,H=new EventSource(Z),oe=()=>{F.current.listFolder(K.current||void 0).then(Se=>{f(Se),c(null)}).catch(()=>{})},fe=()=>{oe();for(const Se of I.current)F.current.listFolder(Se).then(ye=>{w(De=>new Map(De).set(Se,ye))}).catch(()=>{})};return H.addEventListener("change",Se=>{let ye;try{ye=JSON.parse(Se.data)}catch{return}typeof ye=="string"&&((ye===""||ye===K.current)&&oe(),ye!==""&&I.current.has(ye)&&F.current.listFolder(ye).then(De=>{w(Fe=>new Map(Fe).set(ye,De))}).catch(()=>{}))}),H.onopen=()=>{if(ie){ie=!1;return}fe()},()=>{H.close()}},[t,e]);const G=M.useCallback(ie=>{const Z=ie.relativePath,H=!_.has(Z);g(oe=>{const fe=new Set(oe);return fe.has(Z)?(fe.delete(Z),fe):(fe.add(Z),fe)}),H&&(C(oe=>new Set(oe).add(Z)),e.listFolder(Z).then(oe=>{w(fe=>new Map(fe).set(Z,oe)),C(fe=>{const Se=new Set(fe);return Se.delete(Z),Se})}).catch(()=>{C(oe=>{const fe=new Set(oe);return fe.delete(Z),fe})}))},[e,_]),B=M.useCallback(ie=>{ie.kind==="dir"?G(ie):s(ie)},[G,s]),Y=M.useCallback(ie=>{x(ie.currentTarget.scrollTop)},[]),W=M.useCallback(()=>{N(ie=>{const Z=!ie;try{localStorage.setItem(nC,Z?"1":"0")}catch{}return Z})},[]),z=M.useCallback(()=>{if(t){e.listFolder(h||void 0).then(ie=>{f(ie),c(null)}).catch(ie=>{c(ie instanceof Error?ie.message:"Unable to load folder")});for(const ie of _)e.listFolder(ie).then(Z=>{w(H=>new Map(H).set(ie,Z))}).catch(()=>{})}},[e,h,_,t]),V=m.toLowerCase(),X=M.useMemo(()=>o?rC(o.entries,0,i,_,S,T,V,R):[],[o,i,_,S,T,V,R]),j=!R&&o!==null&&o.entries.length>0&&X.length===0&&!m,P=X.length>DN,D=P?Math.max(0,Math.floor(v/Nu)-xy):0,U=P?Math.min(X.length,Math.ceil((v+k)/Nu)+xy):X.length,q=X.slice(D,U),Q=X.length*Nu,re=D*Nu;return t?p&&!o?u.jsx("div",{className:"fexp-tree-error",children:p}):o?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:m,onChange:ie=>b(ie.target.value),"aria-label":"Filter files"}),m&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>b(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:z,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${R?" is-active":""}`,onClick:W,"aria-pressed":R,"aria-label":R?"Hide hidden files":"Show hidden files",title:R?"Hide hidden files":"Show hidden files",children:R?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:A,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:P?Y:void 0,children:[o.parentRelativePath!==null&&!m&&u.jsx("button",{className:"fexp-tree-up",type:"button",onClick:()=>d(o.parentRelativePath??""),"aria-label":"Parent folder",children:"↑ .."}),P?u.jsx("div",{style:{height:Q,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${re}px)`},children:q.map(ie=>u.jsx(wy,{row:ie,onEntryClick:B},ie.entry.relativePath))})}):q.map(ie=>u.jsx(wy,{row:ie,onEntryClick:B},ie.entry.relativePath)),X.length===0&&m&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),X.length===0&&!m&&o.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),j&&u.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):u.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function wy({row:e,onEntryClick:t}){const{entry:i,depth:s,isSelected:o,isExpanded:f,isLoading:p}=e,c=i.kind==="dir",h=s*16,d=M.useCallback(()=>t(i),[i,t]);return u.jsxs("button",{className:`fexp-tree-row${o?" is-cur":""}${c?" is-dir":" is-file"}`,style:{paddingLeft:`${h+12}px`},type:"button",role:"treeitem","aria-selected":o,"aria-expanded":c?f:void 0,onClick:d,children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:c?u.jsx(NN,{name:i.name,open:f}):u.jsx(MN,{name:i.name})}),u.jsx("span",{className:"fexp-tree-name",children:i.name}),p&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function IN(){try{return localStorage.getItem(nC)==="1"}catch{return!1}}function BN({name:e,sizeHint:t}){return u.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[u.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),u.jsx("p",{className:"fexp-bin-name",children:e}),t&&u.jsx("p",{className:"fexp-bin-meta",children:t}),u.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function PN(e,t){switch(t){case"typescript":case"javascript":return HN(e);case"json":return $N(e);case"python":return FN(e);case"css":case"scss":case"sass":case"less":return WN(e);case"html":case"xml":return GN(e);case"bash":case"shell":return qN(e);case"yaml":return KN(e);default:return[{kind:"text",value:e}]}}const zN=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 HN(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),o=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
92
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==="`"){const{slice:s,length:o}=Ls(e,i,"`","`");t.push({kind:"str",value:s}),i+=o;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[0-9]/.test(e[i])||e[i]==="."&&/[0-9]/.test(e[i+1]??"")){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_$]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_$][\w$]*/);if(s){const o=s[0],f=e.slice(i+o.length).match(/^\s*\(/);zN.has(o)?t.push({kind:"key",value:o}):f?t.push({kind:"fn",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}function $N(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:s,length:o}=Ls(e,i,'"','"'),p=e.slice(i+o).trimStart().startsWith(":");t.push({kind:p?"attr":"str",value:s}),i+=o;continue}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(e.startsWith("true",i)||e.startsWith("false",i)||e.startsWith("null",i)){const s=e.slice(i).match(/^(true|false|null)/);if(s){t.push({kind:"key",value:s[0]}),i+=s[0].length;continue}}if(/[{}[\]:,]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}const UN=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 FN(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
93
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith('"""',i)||e.startsWith("'''",i)){const s=e.slice(i,i+3),o=e.indexOf(s,i+3),f=o===-1?e.slice(i):e.slice(i,o+3);t.push({kind:"str",value:f}),i+=f.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_]\w*/);if(s){const o=s[0],f=e.slice(i+o.length).match(/^\s*\(/);UN.has(o)?t.push({kind:"key",value:o}):f?t.push({kind:"fn",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function WN(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),o=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
94
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(e[i]==="."||e[i]==="#"||e[i]===":"){const s=e.slice(i).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(s){t.push({kind:"tag",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z-]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z-][\w-]*/);if(s){const o=s[0];e.slice(i+o.length).trimStart().startsWith(":")?t.push({kind:"attr",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function GN(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("<!--",i)){const s=e.indexOf("-->",i+4),o=s===-1?e.slice(i):e.slice(i,s+3);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==="<"){t.push({kind:"punct",value:"<"}),i++,e[i]==="/"&&(t.push({kind:"punct",value:"/"}),i++);const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);s&&(t.push({kind:"tag",value:s[0]}),i+=s[0].length);continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[a-zA-Z]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);if(s){const o=e.slice(i+s[0].length).trimStart();t.push({kind:o.startsWith("=")?"attr":"text",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function qN(e){const t=[];let i=0;const s=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(;i<e.length;){if(e[i]==="#"){const o=e.indexOf(`
95
+ `,i),f=o===-1?e.slice(i):e.slice(i,o);t.push({kind:"com",value:f}),i+=f.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:o,length:f}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:o}),i+=f;continue}if(/[a-zA-Z_]/.test(e[i])){const o=e.slice(i).match(/^[a-zA-Z_][\w]*/);if(o){t.push({kind:s.has(o[0])?"key":"text",value:o[0]}),i+=o[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function KN(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
96
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ls(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_][\w-]*/);if(s){e.slice(i+s[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:s[0]}):["true","false","null","yes","no","on","off"].includes(s[0])?t.push({kind:"key",value:s[0]}):t.push({kind:"text",value:s[0]}),i+=s[0].length;continue}}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function Ls(e,t,i,s){let o=t+i.length;for(;o<e.length;){if(e[o]==="\\"){o+=2;continue}if(e.startsWith(s,o)){o+=s.length;break}if(s!=="`"&&e[o]===`
97
+ `)break;o++}return{slice:e.slice(t,o),length:o-t}}function VN({content:e,lang:t,truncated:i}){const s=M.useMemo(()=>YN(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[i&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:s.map((o,f)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:f+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:o}})]},f))})})})]})}function YN(e,t){return e.split(`
98
+ `).map(s=>XN(s,t))}function XN(e,t){return t==="plaintext"||t==="markdown"?Cy(e)||" ":PN(e,t).map(s=>{const o=Cy(s.value);return s.kind==="text"?o:`<span class="syn-${s.kind}">${o}</span>`}).join("")||" "}function Cy(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ZN({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function Vm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ca=Vm();function sC(e){ca=e}var Fl={exec:()=>null};function _t(e,t=""){let i=typeof e=="string"?e:e.source,s={replace:(o,f)=>{let p=typeof f=="string"?f:f.source;return p=p.replace(Jn.caret,"$1"),i=i.replace(o,p),s},getRegex:()=>new RegExp(i,t)};return s}var JN=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Jn={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")},QN=/^(?:[ \t]*(?:\n|$))+/,eO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,oc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ym=/(?:[*+-]|\d{1,9}[.)])/,aC=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oC=_t(aC).replace(/bull/g,Ym).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(),iO=_t(aC).replace(/bull/g,Ym).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(),Xm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rO=/^[^\n]+/,Zm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sO=_t(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Zm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),aO=_t(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ym).getRegex(),Fh="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",Jm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,oO=_t("^ {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",Jm).replace("tag",Fh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lC=_t(Xm).replace("hr",oc).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",Fh).getRegex(),lO=_t(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",lC).getRegex(),Qm={blockquote:lO,code:eO,def:sO,fences:tO,heading:nO,hr:oc,html:oO,lheading:oC,list:aO,newline:QN,paragraph:lC,table:Fl,text:rO},Ey=_t("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",oc).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",Fh).getRegex(),cO={...Qm,lheading:iO,table:Ey,paragraph:_t(Xm).replace("hr",oc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ey).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",Fh).getRegex()},uO={...Qm,html:_t(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Jm).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:Fl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:_t(Xm).replace("hr",oc).replace("heading",` *#{1,6} *[^
99
+ ]`).replace("lheading",oC).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hO=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dO=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cC=/^( {2,}|\\)\n(?!\s*$)/,fO=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Wh=/[\p{P}\p{S}]/u,e_=/[\s\p{P}\p{S}]/u,uC=/[^\s\p{P}\p{S}]/u,pO=_t(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,e_).getRegex(),hC=/(?!~)[\p{P}\p{S}]/u,gO=/(?!~)[\s\p{P}\p{S}]/u,mO=/(?:[^\s\p{P}\p{S}]|~)/u,_O=_t(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",JN?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dC=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,vO=_t(dC,"u").replace(/punct/g,Wh).getRegex(),bO=_t(dC,"u").replace(/punct/g,hC).getRegex(),fC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yO=_t(fC,"gu").replace(/notPunctSpace/g,uC).replace(/punctSpace/g,e_).replace(/punct/g,Wh).getRegex(),SO=_t(fC,"gu").replace(/notPunctSpace/g,mO).replace(/punctSpace/g,gO).replace(/punct/g,hC).getRegex(),xO=_t("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,uC).replace(/punctSpace/g,e_).replace(/punct/g,Wh).getRegex(),wO=_t(/\\(punct)/,"gu").replace(/punct/g,Wh).getRegex(),CO=_t(/^<(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(),EO=_t(Jm).replace("(?:-->|$)","-->").getRegex(),kO=_t("^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",EO).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,TO=_t(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pC=_t(/^!?\[(label)\]\[(ref)\]/).replace("label",vh).replace("ref",Zm).getRegex(),gC=_t(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zm).getRegex(),AO=_t("reflink|nolink(?!\\()","g").replace("reflink",pC).replace("nolink",gC).getRegex(),ky=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,t_={_backpedal:Fl,anyPunctuation:wO,autolink:CO,blockSkip:_O,br:cC,code:dO,del:Fl,emStrongLDelim:vO,emStrongRDelimAst:yO,emStrongRDelimUnd:xO,escape:hO,link:TO,nolink:gC,punctuation:pO,reflink:pC,reflinkSearch:AO,tag:kO,text:fO,url:Fl},RO={...t_,link:_t(/^!?\[(label)\]\((.*?)\)/).replace("label",vh).getRegex(),reflink:_t(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",vh).getRegex()},zg={...t_,emStrongRDelimAst:SO,emStrongLDelim:bO,url:_t(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ky).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:_t(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ky).getRegex()},LO={...zg,br:_t(cC).replace("{2,}","*").getRegex(),text:_t(zg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ou={normal:Qm,gfm:cO,pedantic:uO},kl={normal:t_,gfm:zg,breaks:LO,pedantic:RO},MO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ty=e=>MO[e];function dr(e,t){if(t){if(Jn.escapeTest.test(e))return e.replace(Jn.escapeReplace,Ty)}else if(Jn.escapeTestNoEncode.test(e))return e.replace(Jn.escapeReplaceNoEncode,Ty);return e}function Ay(e){try{e=encodeURI(e).replace(Jn.percentDecode,"%")}catch{return null}return e}function Ry(e,t){let i=e.replace(Jn.findPipe,(f,p,c)=>{let h=!1,d=p;for(;--d>=0&&c[d]==="\\";)h=!h;return h?"|":" |"}),s=i.split(Jn.splitPipe),o=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;o<s.length;o++)s[o]=s[o].trim().replace(Jn.slashPipe,"|");return s}function Tl(e,t,i){let s=e.length;if(s===0)return"";let o=0;for(;o<s&&e.charAt(s-o-1)===t;)o++;return e.slice(0,s-o)}function NO(e,t){if(e.indexOf(t[1])===-1)return-1;let i=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return i>0?-2:-1}function Ly(e,t,i,s,o){let f=t.href,p=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");s.state.inLink=!0;let h={type:e[0].charAt(0)==="!"?"image":"link",raw:i,href:f,title:p,text:c,tokens:s.inlineTokens(c)};return s.state.inLink=!1,h}function OO(e,t,i){let s=e.match(i.other.indentCodeCompensation);if(s===null)return t;let o=s[1];return t.split(`
100
+ `).map(f=>{let p=f.match(i.other.beginningSpace);if(p===null)return f;let[c]=p;return c.length>=o.length?f.slice(o.length):f}).join(`
101
+ `)}var bh=class{options;rules;lexer;constructor(e){this.options=e||ca}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 i=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Tl(i,`
102
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],s=OO(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let s=Tl(i,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(i=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Tl(t[0],`
103
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=Tl(t[0],`
104
+ `).split(`
105
+ `),s="",o="",f=[];for(;i.length>0;){let p=!1,c=[],h;for(h=0;h<i.length;h++)if(this.rules.other.blockquoteStart.test(i[h]))c.push(i[h]),p=!0;else if(!p)c.push(i[h]);else break;i=i.slice(h);let d=c.join(`
106
+ `),_=d.replace(this.rules.other.blockquoteSetextReplace,`
107
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
108
+ ${d}`:d,o=o?`${o}
109
+ ${_}`:_;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(_,f,!0),this.lexer.state.top=g,i.length===0)break;let S=f.at(-1);if(S?.type==="code")break;if(S?.type==="blockquote"){let C=S,T=C.raw+`
110
+ `+i.join(`
111
+ `),w=this.blockquote(T);f[f.length-1]=w,s=s.substring(0,s.length-C.raw.length)+w.raw,o=o.substring(0,o.length-C.text.length)+w.text;break}else if(S?.type==="list"){let C=S,T=C.raw+`
112
+ `+i.join(`
113
+ `),w=this.list(T);f[f.length-1]=w,s=s.substring(0,s.length-S.raw.length)+w.raw,o=o.substring(0,o.length-C.raw.length)+w.raw,i=T.substring(f.at(-1).raw.length).split(`
114
+ `);continue}}return{type:"blockquote",raw:s,tokens:f,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let f=this.rules.other.listItemRegex(i),p=!1;for(;e;){let h=!1,d="",_="";if(!(t=f.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let g=t[2].split(`
115
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),S=e.split(`
116
+ `,1)[0],C=!g.trim(),T=0;if(this.options.pedantic?(T=2,_=g.trimStart()):C?T=t[1].length+1:(T=t[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,_=g.slice(T),T+=t[1].length),C&&this.rules.other.blankLine.test(S)&&(d+=S+`
117
+ `,e=e.substring(S.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(T),v=this.rules.other.hrRegex(T),x=this.rules.other.fencesBeginRegex(T),k=this.rules.other.headingBeginRegex(T),L=this.rules.other.htmlBeginRegex(T);for(;e;){let R=e.split(`
118
+ `,1)[0],N;if(S=R,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),N=S):N=S.replace(this.rules.other.tabCharGlobal," "),x.test(S)||k.test(S)||L.test(S)||b.test(S)||v.test(S))break;if(N.search(this.rules.other.nonSpaceChar)>=T||!S.trim())_+=`
119
+ `+N.slice(T);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||x.test(g)||k.test(g)||v.test(g))break;_+=`
120
+ `+S}!C&&!S.trim()&&(C=!0),d+=R+`
121
+ `,e=e.substring(R.length+1),g=N.slice(T)}}o.loose||(p?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(p=!0));let w=null,m;this.options.gfm&&(w=this.rules.other.listIsTask.exec(_),w&&(m=w[0]!=="[ ] ",_=_.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:d,task:!!w,checked:m,loose:!1,text:_,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){let d=o.items[h].tokens.filter(g=>g.type==="space"),_=d.length>0&&d.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=_}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}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 i=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:s,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=Ry(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
122
+ `):[],f={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(let p of s)this.rules.other.tableAlignRight.test(p)?f.align.push("right"):this.rules.other.tableAlignCenter.test(p)?f.align.push("center"):this.rules.other.tableAlignLeft.test(p)?f.align.push("left"):f.align.push(null);for(let p=0;p<i.length;p++)f.header.push({text:i[p],tokens:this.lexer.inline(i[p]),header:!0,align:f.align[p]});for(let p of o)f.rows.push(Ry(p,f.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:f.align[h]})));return f}}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 i=t[1].charAt(t[1].length-1)===`
123
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}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 i=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let f=Tl(i.slice(0,-1),"\\");if((i.length-f.length)%2===0)return}else{let f=NO(t[2],"()");if(f===-2)return;if(f>-1){let p=(t[0].indexOf("!")===0?5:4)+t[1].length+f;t[2]=t[2].substring(0,f),t[0]=t[0].substring(0,p).trim(),t[3]=""}}let s=t[2],o="";if(this.options.pedantic){let f=this.rules.other.pedanticHrefTitle.exec(s);f&&(s=f[1],o=f[3])}else o=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?s=s.slice(1):s=s.slice(1,-1)),Ly(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let s=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[s.toLowerCase()];if(!o){let f=i[0].charAt(0);return{type:"text",raw:f,text:f}}return Ly(i,o,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!i||this.rules.inline.punctuation.exec(i))){let o=[...s[0]].length-1,f,p,c=o,h=0,d=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(s=d.exec(t))!=null;){if(f=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!f)continue;if(p=[...f].length,s[3]||s[4]){c+=p;continue}else if((s[5]||s[6])&&o%3&&!((o+p)%3)){h+=p;continue}if(c-=p,c>0)continue;p=Math.min(p,p+c+h);let _=[...s[0]][0].length,g=e.slice(0,o+s.index+_+p);if(Math.min(o,p)%2){let C=g.slice(1,-1);return{type:"em",raw:g,text:C,tokens:this.lexer.inlineTokens(C)}}let S=g.slice(2,-2);return{type:"strong",raw:g,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(i),o=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return s&&o&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}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 i,s;return t[2]==="@"?(i=t[1],s="mailto:"+i):(i=t[1],s=i),{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=t[0],s="mailto:"+i;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);i=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:i}}}},er=class Hg{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ca,this.options.tokenizer=this.options.tokenizer||new bh,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 i={other:Jn,block:Ou.normal,inline:kl.normal};this.options.pedantic?(i.block=Ou.pedantic,i.inline=kl.pedantic):this.options.gfm&&(i.block=Ou.gfm,this.options.breaks?i.inline=kl.breaks:i.inline=kl.gfm),this.tokenizer.rules=i}static get rules(){return{block:Ou,inline:kl}}static lex(t,i){return new Hg(i).lex(t)}static lexInline(t,i){return new Hg(i).inlineTokens(t)}lex(t){t=t.replace(Jn.carriageReturn,`
124
+ `),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let s=this.inlineQueue[i];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[],s=!1){for(this.options.pedantic&&(t=t.replace(Jn.tabCharGlobal," ").replace(Jn.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(p=>(o=p.call({lexer:this},t,i))?(t=t.substring(o.raw.length),i.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let p=i.at(-1);o.raw.length===1&&p!==void 0?p.raw+=`
125
+ `:i.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
126
+ `)?"":`
127
+ `)+o.raw,p.text+=`
128
+ `+o.text,this.inlineQueue.at(-1).src=p.text):i.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
129
+ `)?"":`
130
+ `)+o.raw,p.text+=`
131
+ `+o.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},i.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),i.push(o);continue}let f=t;if(this.options.extensions?.startBlock){let p=1/0,c=t.slice(1),h;this.options.extensions.startBlock.forEach(d=>{h=d.call({lexer:this},c),typeof h=="number"&&h>=0&&(p=Math.min(p,h))}),p<1/0&&p>=0&&(f=t.substring(0,p+1))}if(this.state.top&&(o=this.tokenizer.paragraph(f))){let p=i.at(-1);s&&p?.type==="paragraph"?(p.raw+=(p.raw.endsWith(`
132
+ `)?"":`
133
+ `)+o.raw,p.text+=`
134
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(o),s=f.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="text"?(p.raw+=(p.raw.endsWith(`
135
+ `)?"":`
136
+ `)+o.raw,p.text+=`
137
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(o);continue}if(t){let p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){let s=t,o=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let f;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)f=o[2]?o[2].length:0,s=s.slice(0,o.index+f)+"["+"a".repeat(o[0].length-f-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let p=!1,c="";for(;t;){p||(c=""),p=!1;let h;if(this.options.extensions?.inline?.some(_=>(h=_.call({lexer:this},t,i))?(t=t.substring(h.raw.length),i.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);let _=i.at(-1);h.type==="text"&&_?.type==="text"?(_.raw+=h.raw,_.text+=h.text):i.push(h);continue}if(h=this.tokenizer.emStrong(t,s,c)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),i.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),i.push(h);continue}let d=t;if(this.options.extensions?.startInline){let _=1/0,g=t.slice(1),S;this.options.extensions.startInline.forEach(C=>{S=C.call({lexer:this},g),typeof S=="number"&&S>=0&&(_=Math.min(_,S))}),_<1/0&&_>=0&&(d=t.substring(0,_+1))}if(h=this.tokenizer.inlineText(d)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(c=h.raw.slice(-1)),p=!0;let _=i.at(-1);_?.type==="text"?(_.raw+=h.raw,_.text+=h.text):i.push(h);continue}if(t){let _="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return i}},yh=class{options;parser;constructor(e){this.options=e||ca}space(e){return""}code({text:e,lang:t,escaped:i}){let s=(t||"").match(Jn.notSpaceStart)?.[0],o=e.replace(Jn.endingNewline,"")+`
138
+ `;return s?'<pre><code class="language-'+dr(s)+'">'+(i?o:dr(o,!0))+`</code></pre>
139
+ `:"<pre><code>"+(i?o:dr(o,!0))+`</code></pre>
140
+ `}blockquote({tokens:e}){return`<blockquote>
141
+ ${this.parser.parse(e)}</blockquote>
142
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
143
+ `}hr(e){return`<hr>
144
+ `}list(e){let t=e.ordered,i=e.start,s="";for(let p=0;p<e.items.length;p++){let c=e.items[p];s+=this.listitem(c)}let o=t?"ol":"ul",f=t&&i!==1?' start="'+i+'"':"";return"<"+o+f+`>
145
+ `+s+"</"+o+`>
146
+ `}listitem(e){let t="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=i+" "+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=i+" "+dr(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):t+=i+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
147
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
148
+ `}table(e){let t="",i="";for(let o=0;o<e.header.length;o++)i+=this.tablecell(e.header[o]);t+=this.tablerow({text:i});let s="";for(let o=0;o<e.rows.length;o++){let f=e.rows[o];i="";for(let p=0;p<f.length;p++)i+=this.tablecell(f[p]);s+=this.tablerow({text:i})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
149
+ <thead>
150
+ `+t+`</thead>
151
+ `+s+`</table>
152
+ `}tablerow({text:e}){return`<tr>
153
+ ${e}</tr>
154
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
155
+ `}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>${dr(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){let s=this.parser.parseInline(i),o=Ay(e);if(o===null)return s;e=o;let f='<a href="'+e+'"';return t&&(f+=' title="'+dr(t)+'"'),f+=">"+s+"</a>",f}image({href:e,title:t,text:i,tokens:s}){s&&(i=this.parser.parseInline(s,this.parser.textRenderer));let o=Ay(e);if(o===null)return dr(i);e=o;let f=`<img src="${e}" alt="${i}"`;return t&&(f+=` title="${dr(t)}"`),f+=">",f}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:dr(e.text)}},n_=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""}},tr=class $g{options;renderer;textRenderer;constructor(t){this.options=t||ca,this.options.renderer=this.options.renderer||new yh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new n_}static parse(t,i){return new $g(i).parse(t)}static parseInline(t,i){return new $g(i).parseInline(t)}parse(t,i=!0){let s="";for(let o=0;o<t.length;o++){let f=t[o];if(this.options.extensions?.renderers?.[f.type]){let c=f,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){s+=h||"";continue}}let p=f;switch(p.type){case"space":{s+=this.renderer.space(p);continue}case"hr":{s+=this.renderer.hr(p);continue}case"heading":{s+=this.renderer.heading(p);continue}case"code":{s+=this.renderer.code(p);continue}case"table":{s+=this.renderer.table(p);continue}case"blockquote":{s+=this.renderer.blockquote(p);continue}case"list":{s+=this.renderer.list(p);continue}case"html":{s+=this.renderer.html(p);continue}case"def":{s+=this.renderer.def(p);continue}case"paragraph":{s+=this.renderer.paragraph(p);continue}case"text":{let c=p,h=this.renderer.text(c);for(;o+1<t.length&&t[o+1].type==="text";)c=t[++o],h+=`
156
+ `+this.renderer.text(c);i?s+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):s+=h;continue}default:{let c='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}parseInline(t,i=this.renderer){let s="";for(let o=0;o<t.length;o++){let f=t[o];if(this.options.extensions?.renderers?.[f.type]){let c=this.options.extensions.renderers[f.type].call({parser:this},f);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(f.type)){s+=c||"";continue}}let p=f;switch(p.type){case"escape":{s+=i.text(p);break}case"html":{s+=i.html(p);break}case"link":{s+=i.link(p);break}case"image":{s+=i.image(p);break}case"strong":{s+=i.strong(p);break}case"em":{s+=i.em(p);break}case"codespan":{s+=i.codespan(p);break}case"br":{s+=i.br(p);break}case"del":{s+=i.del(p);break}case"text":{s+=i.text(p);break}default:{let c='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},Il=class{options;block;constructor(e){this.options=e||ca}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?er.lex:er.lexInline}provideParser(){return this.block?tr.parse:tr.parseInline}},mC=class{defaults=Vm();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=tr;Renderer=yh;TextRenderer=n_;Lexer=er;Tokenizer=bh;Hooks=Il;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{let o=s;for(let f of o.header)i=i.concat(this.walkTokens(f.tokens,t));for(let f of o.rows)for(let p of f)i=i.concat(this.walkTokens(p.tokens,t));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,t));break}default:{let o=s;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(f=>{let p=o[f].flat(1/0);i=i.concat(this.walkTokens(p,t))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let s={...i};if(s.async=this.defaults.async||s.async||!1,i.extensions&&(i.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let f=t.renderers[o.name];f?t.renderers[o.name]=function(...p){let c=o.renderer.apply(this,p);return c===!1&&(c=f.apply(this,p)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let f=t[o.level];f?f.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),s.extensions=t),i.renderer){let o=this.defaults.renderer||new yh(this.defaults);for(let f in i.renderer){if(!(f in o))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;let p=f,c=i.renderer[p],h=o[p];o[p]=(...d)=>{let _=c.apply(o,d);return _===!1&&(_=h.apply(o,d)),_||""}}s.renderer=o}if(i.tokenizer){let o=this.defaults.tokenizer||new bh(this.defaults);for(let f in i.tokenizer){if(!(f in o))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;let p=f,c=i.tokenizer[p],h=o[p];o[p]=(...d)=>{let _=c.apply(o,d);return _===!1&&(_=h.apply(o,d)),_}}s.tokenizer=o}if(i.hooks){let o=this.defaults.hooks||new Il;for(let f in i.hooks){if(!(f in o))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;let p=f,c=i.hooks[p],h=o[p];Il.passThroughHooks.has(f)?o[p]=d=>{if(this.defaults.async&&Il.passThroughHooksRespectAsync.has(f))return(async()=>{let g=await c.call(o,d);return h.call(o,g)})();let _=c.call(o,d);return h.call(o,_)}:o[p]=(...d)=>{if(this.defaults.async)return(async()=>{let g=await c.apply(o,d);return g===!1&&(g=await h.apply(o,d)),g})();let _=c.apply(o,d);return _===!1&&(_=h.apply(o,d)),_}}s.hooks=o}if(i.walkTokens){let o=this.defaults.walkTokens,f=i.walkTokens;s.walkTokens=function(p){let c=[];return c.push(f.call(this,p)),o&&(c=c.concat(o.call(this,p))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return er.lex(e,t??this.defaults)}parser(e,t){return tr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let s={...i},o={...this.defaults,...s},f=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return f(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 f(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let p=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?er.lex:er.lexInline)(p,o),h=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(h,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser():e?tr.parse:tr.parseInline)(h,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(f);try{o.hooks&&(t=o.hooks.preprocess(t));let p=(o.hooks?o.hooks.provideLexer():e?er.lex:er.lexInline)(t,o);o.hooks&&(p=o.hooks.processAllTokens(p)),o.walkTokens&&this.walkTokens(p,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?tr.parse:tr.parseInline)(p,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(p){return f(p)}}}onError(e,t){return i=>{if(i.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+dr(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},oa=new mC;function Nt(e,t){return oa.parse(e,t)}Nt.options=Nt.setOptions=function(e){return oa.setOptions(e),Nt.defaults=oa.defaults,sC(Nt.defaults),Nt};Nt.getDefaults=Vm;Nt.defaults=ca;Nt.use=function(...e){return oa.use(...e),Nt.defaults=oa.defaults,sC(Nt.defaults),Nt};Nt.walkTokens=function(e,t){return oa.walkTokens(e,t)};Nt.parseInline=oa.parseInline;Nt.Parser=tr;Nt.parser=tr.parse;Nt.Renderer=yh;Nt.TextRenderer=n_;Nt.Lexer=er;Nt.lexer=er.lex;Nt.Tokenizer=bh;Nt.Hooks=Il;Nt.parse=Nt;Nt.options;Nt.setOptions;Nt.use;Nt.walkTokens;Nt.parseInline;tr.parse;er.lex;const{entries:_C,setPrototypeOf:My,isFrozen:DO,getPrototypeOf:jO,getOwnPropertyDescriptor:IO}=Object;let{freeze:ei,seal:Ki,create:Qa}=Object,{apply:Ug,construct:Fg}=typeof Reflect<"u"&&Reflect;ei||(ei=function(t){return t});Ki||(Ki=function(t){return t});Ug||(Ug=function(t,i){for(var s=arguments.length,o=new Array(s>2?s-2:0),f=2;f<s;f++)o[f-2]=arguments[f];return t.apply(i,o)});Fg||(Fg=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return new t(...s)});const Al=Sn(Array.prototype.forEach),BO=Sn(Array.prototype.lastIndexOf),Ny=Sn(Array.prototype.pop),Rl=Sn(Array.prototype.push),PO=Sn(Array.prototype.splice),Yn=Array.isArray,Bl=Sn(String.prototype.toLowerCase),kp=Sn(String.prototype.toString),Oy=Sn(String.prototype.match),Ya=Sn(String.prototype.replace),Dy=Sn(String.prototype.indexOf),zO=Sn(String.prototype.trim),HO=Sn(Number.prototype.toString),$O=Sn(Boolean.prototype.toString),jy=typeof BigInt>"u"?null:Sn(BigInt.prototype.toString),Iy=typeof Symbol>"u"?null:Sn(Symbol.prototype.toString),ln=Sn(Object.prototype.hasOwnProperty),Ll=Sn(Object.prototype.toString),Pn=Sn(RegExp.prototype.test),Du=UO(TypeError);function Sn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return Ug(e,t,s)}}function UO(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return Fg(e,i)}}function Je(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bl;if(My&&My(e,null),!Yn(t))return e;let s=t.length;for(;s--;){let o=t[s];if(typeof o=="string"){const f=i(o);f!==o&&(DO(t)||(t[s]=f),o=f)}e[o]=!0}return e}function FO(e){for(let t=0;t<e.length;t++)ln(e,t)||(e[t]=null);return e}function di(e){const t=Qa(null);for(const[i,s]of _C(e))ln(e,i)&&(Yn(s)?t[i]=FO(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=di(s):t[i]=s);return t}function WO(e){switch(typeof e){case"string":return e;case"number":return HO(e);case"boolean":return $O(e);case"bigint":return jy?jy(e):"0";case"symbol":return Iy?Iy(e):"Symbol()";case"undefined":return Ll(e);case"function":case"object":{if(e===null)return Ll(e);const t=e,i=eo(t,"toString");if(typeof i=="function"){const s=i(t);return typeof s=="string"?s:Ll(s)}return Ll(e)}default:return Ll(e)}}function eo(e,t){for(;e!==null;){const s=IO(e,t);if(s){if(s.get)return Sn(s.get);if(typeof s.value=="function")return Sn(s.value)}e=jO(e)}function i(){return null}return i}function GO(e){try{return Pn(e,""),!0}catch{return!1}}const By=ei(["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"]),Tp=ei(["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"]),Ap=ei(["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"]),qO=ei(["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"]),Rp=ei(["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"]),KO=ei(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Py=ei(["#text"]),zy=ei(["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"]),Lp=ei(["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"]),Hy=ei(["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"]),ju=ei(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),VO=Ki(/\{\{[\w\W]*|[\w\W]*\}\}/gm),YO=Ki(/<%[\w\W]*|[\w\W]*%>/gm),XO=Ki(/\$\{[\w\W]*/gm),ZO=Ki(/^data-[\-\w.\u00B7-\uFFFF]+$/),JO=Ki(/^aria-[\-\w]+$/),vC=Ki(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),QO=Ki(/^(?:\w+script|data):/i),eD=Ki(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bC=Ki(/^html$/i),tD=Ki(/^[a-z][.\w]*(-[.\w]+)+$/i);var $y=Object.freeze({__proto__:null,ARIA_ATTR:JO,ATTR_WHITESPACE:eD,CUSTOM_ELEMENT:tD,DATA_ATTR:ZO,DOCTYPE_NAME:bC,ERB_EXPR:YO,IS_ALLOWED_URI:vC,IS_SCRIPT_OR_DATA:QO,MUSTACHE_EXPR:VO,TMPLIT_EXPR:XO});const Ml={element:1,text:3,progressingInstruction:7,comment:8,document:9},nD=function(){return typeof window>"u"?null:window},iD=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(s=i.getAttribute(o));const f="dompurify"+(s?"#"+s:"");try{return t.createPolicy(f,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},Uy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yC(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nD();const t=Re=>yC(Re);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Ml.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const s=i,o=s.currentScript,{DocumentFragment:f,HTMLTemplateElement:p,Node:c,Element:h,NodeFilter:d,NamedNodeMap:_=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:S,trustedTypes:C}=e,T=h.prototype,w=eo(T,"cloneNode"),m=eo(T,"remove"),b=eo(T,"nextSibling"),v=eo(T,"childNodes"),x=eo(T,"parentNode");if(typeof p=="function"){const Re=i.createElement("template");Re.content&&Re.content.ownerDocument&&(i=Re.content.ownerDocument)}let k,L="";const{implementation:R,createNodeIterator:N,createDocumentFragment:A,getElementsByTagName:I}=i,{importNode:K}=s;let F=Uy();t.isSupported=typeof _C=="function"&&typeof x=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:G,ERB_EXPR:B,TMPLIT_EXPR:Y,DATA_ATTR:W,ARIA_ATTR:z,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:j}=$y;let{IS_ALLOWED_URI:P}=$y,D=null;const U=Je({},[...By,...Tp,...Ap,...Rp,...Py]);let q=null;const Q=Je({},[...zy,...Lp,...Hy,...ju]);let re=Object.seal(Qa(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}})),ie=null,Z=null;const H=Object.seal(Qa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,fe=!0,Se=!1,ye=!0,De=!1,Fe=!0,Be=!1,Ke=!1,ke=!1,dt=!1,Pt=!1,Ct=!1,Gn=!0,qn=!1;const Zt="user-content-";let ht=!0,Jt=!1,zt={},Kt=null;const nn=Je({},["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 ni=null;const xn=Je({},["audio","video","img","source","image","track"]);let Qt=null;const lt=Je({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hn="http://www.w3.org/1998/Math/MathML",Ht="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let Et=$t,mi=!1,Yi=null;const Hn=Je({},[hn,Ht,$t],kp);let Ln=Je({},["mi","mo","mn","ms","mtext"]),$n=Je({},["annotation-xml"]);const Xi=Je({},["title","style","font","a","script"]);let rn=null;const ee=["application/xhtml+xml","text/html"],pe="text/html";let xe=null,Pe=null;const xt=i.createElement("form"),ft=function(J){return J instanceof RegExp||J instanceof Function},Te=function(){let J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Pe&&Pe===J)return;(!J||typeof J!="object")&&(J={}),J=di(J),rn=ee.indexOf(J.PARSER_MEDIA_TYPE)===-1?pe:J.PARSER_MEDIA_TYPE,xe=rn==="application/xhtml+xml"?kp:Bl,D=ln(J,"ALLOWED_TAGS")&&Yn(J.ALLOWED_TAGS)?Je({},J.ALLOWED_TAGS,xe):U,q=ln(J,"ALLOWED_ATTR")&&Yn(J.ALLOWED_ATTR)?Je({},J.ALLOWED_ATTR,xe):Q,Yi=ln(J,"ALLOWED_NAMESPACES")&&Yn(J.ALLOWED_NAMESPACES)?Je({},J.ALLOWED_NAMESPACES,kp):Hn,Qt=ln(J,"ADD_URI_SAFE_ATTR")&&Yn(J.ADD_URI_SAFE_ATTR)?Je(di(lt),J.ADD_URI_SAFE_ATTR,xe):lt,ni=ln(J,"ADD_DATA_URI_TAGS")&&Yn(J.ADD_DATA_URI_TAGS)?Je(di(xn),J.ADD_DATA_URI_TAGS,xe):xn,Kt=ln(J,"FORBID_CONTENTS")&&Yn(J.FORBID_CONTENTS)?Je({},J.FORBID_CONTENTS,xe):nn,ie=ln(J,"FORBID_TAGS")&&Yn(J.FORBID_TAGS)?Je({},J.FORBID_TAGS,xe):di({}),Z=ln(J,"FORBID_ATTR")&&Yn(J.FORBID_ATTR)?Je({},J.FORBID_ATTR,xe):di({}),zt=ln(J,"USE_PROFILES")?J.USE_PROFILES&&typeof J.USE_PROFILES=="object"?di(J.USE_PROFILES):J.USE_PROFILES:!1,oe=J.ALLOW_ARIA_ATTR!==!1,fe=J.ALLOW_DATA_ATTR!==!1,Se=J.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=J.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=J.SAFE_FOR_TEMPLATES||!1,Fe=J.SAFE_FOR_XML!==!1,Be=J.WHOLE_DOCUMENT||!1,dt=J.RETURN_DOM||!1,Pt=J.RETURN_DOM_FRAGMENT||!1,Ct=J.RETURN_TRUSTED_TYPE||!1,ke=J.FORCE_BODY||!1,Gn=J.SANITIZE_DOM!==!1,qn=J.SANITIZE_NAMED_PROPS||!1,ht=J.KEEP_CONTENT!==!1,Jt=J.IN_PLACE||!1,P=GO(J.ALLOWED_URI_REGEXP)?J.ALLOWED_URI_REGEXP:vC,Et=typeof J.NAMESPACE=="string"?J.NAMESPACE:$t,Ln=ln(J,"MATHML_TEXT_INTEGRATION_POINTS")&&J.MATHML_TEXT_INTEGRATION_POINTS&&typeof J.MATHML_TEXT_INTEGRATION_POINTS=="object"?di(J.MATHML_TEXT_INTEGRATION_POINTS):Je({},["mi","mo","mn","ms","mtext"]),$n=ln(J,"HTML_INTEGRATION_POINTS")&&J.HTML_INTEGRATION_POINTS&&typeof J.HTML_INTEGRATION_POINTS=="object"?di(J.HTML_INTEGRATION_POINTS):Je({},["annotation-xml"]);const me=ln(J,"CUSTOM_ELEMENT_HANDLING")&&J.CUSTOM_ELEMENT_HANDLING&&typeof J.CUSTOM_ELEMENT_HANDLING=="object"?di(J.CUSTOM_ELEMENT_HANDLING):Qa(null);if(re=Qa(null),ln(me,"tagNameCheck")&&ft(me.tagNameCheck)&&(re.tagNameCheck=me.tagNameCheck),ln(me,"attributeNameCheck")&&ft(me.attributeNameCheck)&&(re.attributeNameCheck=me.attributeNameCheck),ln(me,"allowCustomizedBuiltInElements")&&typeof me.allowCustomizedBuiltInElements=="boolean"&&(re.allowCustomizedBuiltInElements=me.allowCustomizedBuiltInElements),De&&(fe=!1),Pt&&(dt=!0),zt&&(D=Je({},Py),q=Qa(null),zt.html===!0&&(Je(D,By),Je(q,zy)),zt.svg===!0&&(Je(D,Tp),Je(q,Lp),Je(q,ju)),zt.svgFilters===!0&&(Je(D,Ap),Je(q,Lp),Je(q,ju)),zt.mathMl===!0&&(Je(D,Rp),Je(q,Hy),Je(q,ju))),H.tagCheck=null,H.attributeCheck=null,ln(J,"ADD_TAGS")&&(typeof J.ADD_TAGS=="function"?H.tagCheck=J.ADD_TAGS:Yn(J.ADD_TAGS)&&(D===U&&(D=di(D)),Je(D,J.ADD_TAGS,xe))),ln(J,"ADD_ATTR")&&(typeof J.ADD_ATTR=="function"?H.attributeCheck=J.ADD_ATTR:Yn(J.ADD_ATTR)&&(q===Q&&(q=di(q)),Je(q,J.ADD_ATTR,xe))),ln(J,"ADD_URI_SAFE_ATTR")&&Yn(J.ADD_URI_SAFE_ATTR)&&Je(Qt,J.ADD_URI_SAFE_ATTR,xe),ln(J,"FORBID_CONTENTS")&&Yn(J.FORBID_CONTENTS)&&(Kt===nn&&(Kt=di(Kt)),Je(Kt,J.FORBID_CONTENTS,xe)),ln(J,"ADD_FORBID_CONTENTS")&&Yn(J.ADD_FORBID_CONTENTS)&&(Kt===nn&&(Kt=di(Kt)),Je(Kt,J.ADD_FORBID_CONTENTS,xe)),ht&&(D["#text"]=!0),Be&&Je(D,["html","head","body"]),D.table&&(Je(D,["tbody"]),delete ie.tbody),J.TRUSTED_TYPES_POLICY){if(typeof J.TRUSTED_TYPES_POLICY.createHTML!="function")throw Du('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof J.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Du('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=J.TRUSTED_TYPES_POLICY,L=k.createHTML("")}else k===void 0&&(k=iD(C,o)),k!==null&&typeof L=="string"&&(L=k.createHTML(""));ei&&ei(J),Pe=J},Ce=Je({},[...Tp,...Ap,...qO]),ze=Je({},[...Rp,...KO]),It=function(J){let me=x(J);(!me||!me.tagName)&&(me={namespaceURI:Et,tagName:"template"});const Ee=Bl(J.tagName),Qe=Bl(me.tagName);return Yi[J.namespaceURI]?J.namespaceURI===Ht?me.namespaceURI===$t?Ee==="svg":me.namespaceURI===hn?Ee==="svg"&&(Qe==="annotation-xml"||Ln[Qe]):!!Ce[Ee]:J.namespaceURI===hn?me.namespaceURI===$t?Ee==="math":me.namespaceURI===Ht?Ee==="math"&&$n[Qe]:!!ze[Ee]:J.namespaceURI===$t?me.namespaceURI===Ht&&!$n[Qe]||me.namespaceURI===hn&&!Ln[Qe]?!1:!ze[Ee]&&(Xi[Ee]||!Ce[Ee]):!!(rn==="application/xhtml+xml"&&Yi[J.namespaceURI]):!1},et=function(J){Rl(t.removed,{element:J});try{x(J).removeChild(J)}catch{m(J)}},dn=function(J,me){try{Rl(t.removed,{attribute:me.getAttributeNode(J),from:me})}catch{Rl(t.removed,{attribute:null,from:me})}if(me.removeAttribute(J),J==="is")if(dt||Pt)try{et(me)}catch{}else try{me.setAttribute(J,"")}catch{}},Mi=function(J){let me=null,Ee=null;if(ke)J="<remove></remove>"+J;else{const yt=Oy(J,/^[\r\n\t ]+/);Ee=yt&&yt[0]}rn==="application/xhtml+xml"&&Et===$t&&(J='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+J+"</body></html>");const Qe=k?k.createHTML(J):J;if(Et===$t)try{me=new S().parseFromString(Qe,rn)}catch{}if(!me||!me.documentElement){me=R.createDocument(Et,"template",null);try{me.documentElement.innerHTML=mi?L:Qe}catch{}}const $e=me.body||me.documentElement;return J&&Ee&&$e.insertBefore(i.createTextNode(Ee),$e.childNodes[0]||null),Et===$t?I.call(me,Be?"html":"body")[0]:Be?me.documentElement:$e},Ni=function(J){return N.call(J.ownerDocument||J,J,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Mn=function(J){return J instanceof g&&(typeof J.nodeName!="string"||typeof J.textContent!="string"||typeof J.removeChild!="function"||!(J.attributes instanceof _)||typeof J.removeAttribute!="function"||typeof J.setAttribute!="function"||typeof J.namespaceURI!="string"||typeof J.insertBefore!="function"||typeof J.hasChildNodes!="function")},de=function(J){return typeof c=="function"&&J instanceof c};function je(Re,J,me){Al(Re,Ee=>{Ee.call(t,J,me,Pe)})}const vt=function(J){let me=null;if(je(F.beforeSanitizeElements,J,null),Mn(J))return et(J),!0;const Ee=xe(J.nodeName);if(je(F.uponSanitizeElement,J,{tagName:Ee,allowedTags:D}),Fe&&J.hasChildNodes()&&!de(J.firstElementChild)&&Pn(/<[/\w!]/g,J.innerHTML)&&Pn(/<[/\w!]/g,J.textContent)||Fe&&J.namespaceURI===$t&&Ee==="style"&&de(J.firstElementChild)||J.nodeType===Ml.progressingInstruction||Fe&&J.nodeType===Ml.comment&&Pn(/<[/\w]/g,J.data))return et(J),!0;if(ie[Ee]||!(H.tagCheck instanceof Function&&H.tagCheck(Ee))&&!D[Ee]){if(!ie[Ee]&&bt(Ee)&&(re.tagNameCheck instanceof RegExp&&Pn(re.tagNameCheck,Ee)||re.tagNameCheck instanceof Function&&re.tagNameCheck(Ee)))return!1;if(ht&&!Kt[Ee]){const Qe=x(J)||J.parentNode,$e=v(J)||J.childNodes;if($e&&Qe){const yt=$e.length;for(let wt=yt-1;wt>=0;--wt){const Dt=w($e[wt],!0);Qe.insertBefore(Dt,b(J))}}}return et(J),!0}return J instanceof h&&!It(J)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&Pn(/<\/no(script|embed|frames)/i,J.innerHTML)?(et(J),!0):(De&&J.nodeType===Ml.text&&(me=J.textContent,Al([G,B,Y],Qe=>{me=Ya(me,Qe," ")}),J.textContent!==me&&(Rl(t.removed,{element:J.cloneNode()}),J.textContent=me)),je(F.afterSanitizeElements,J,null),!1)},nt=function(J,me,Ee){if(Z[me]||Gn&&(me==="id"||me==="name")&&(Ee in i||Ee in xt))return!1;const Qe=q[me]||H.attributeCheck instanceof Function&&H.attributeCheck(me,J);if(!(fe&&!Z[me]&&Pn(W,me))){if(!(oe&&Pn(z,me))){if(!Qe||Z[me]){if(!(bt(J)&&(re.tagNameCheck instanceof RegExp&&Pn(re.tagNameCheck,J)||re.tagNameCheck instanceof Function&&re.tagNameCheck(J))&&(re.attributeNameCheck instanceof RegExp&&Pn(re.attributeNameCheck,me)||re.attributeNameCheck instanceof Function&&re.attributeNameCheck(me,J))||me==="is"&&re.allowCustomizedBuiltInElements&&(re.tagNameCheck instanceof RegExp&&Pn(re.tagNameCheck,Ee)||re.tagNameCheck instanceof Function&&re.tagNameCheck(Ee))))return!1}else if(!Qt[me]){if(!Pn(P,Ya(Ee,X,""))){if(!((me==="src"||me==="xlink:href"||me==="href")&&J!=="script"&&Dy(Ee,"data:")===0&&ni[J])){if(!(Se&&!Pn(V,Ya(Ee,X,"")))){if(Ee)return!1}}}}}}return!0},Ae=Je({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),bt=function(J){return!Ae[Bl(J)]&&Pn(j,J)},en=function(J){je(F.beforeSanitizeAttributes,J,null);const{attributes:me}=J;if(!me||Mn(J))return;const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let Qe=me.length;for(;Qe--;){const $e=me[Qe],{name:yt,namespaceURI:wt,value:Dt}=$e,be=xe(yt),Me=Dt;let Ie=yt==="value"?Me:zO(Me);if(Ee.attrName=be,Ee.attrValue=Ie,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,je(F.uponSanitizeAttribute,J,Ee),Ie=Ee.attrValue,qn&&(be==="id"||be==="name")&&Dy(Ie,Zt)!==0&&(dn(yt,J),Ie=Zt+Ie),Fe&&Pn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ie)){dn(yt,J);continue}if(be==="attributename"&&Oy(Ie,"href")){dn(yt,J);continue}if(Ee.forceKeepAttr)continue;if(!Ee.keepAttr){dn(yt,J);continue}if(!ye&&Pn(/\/>/i,Ie)){dn(yt,J);continue}De&&Al([G,B,Y],Vt=>{Ie=Ya(Ie,Vt," ")});const pt=xe(J.nodeName);if(!nt(pt,be,Ie)){dn(yt,J);continue}if(k&&typeof C=="object"&&typeof C.getAttributeType=="function"&&!wt)switch(C.getAttributeType(pt,be)){case"TrustedHTML":{Ie=k.createHTML(Ie);break}case"TrustedScriptURL":{Ie=k.createScriptURL(Ie);break}}if(Ie!==Me)try{wt?J.setAttributeNS(wt,yt,Ie):J.setAttribute(yt,Ie),Mn(J)?et(J):Ny(t.removed)}catch{dn(yt,J)}}je(F.afterSanitizeAttributes,J,null)},wn=function(J){let me=null;const Ee=Ni(J);for(je(F.beforeSanitizeShadowDOM,J,null);me=Ee.nextNode();)je(F.uponSanitizeShadowNode,me,null),vt(me),en(me),me.content instanceof f&&wn(me.content);je(F.afterSanitizeShadowDOM,J,null)};return t.sanitize=function(Re){let J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},me=null,Ee=null,Qe=null,$e=null;if(mi=!Re,mi&&(Re="<!-->"),typeof Re!="string"&&!de(Re)&&(Re=WO(Re),typeof Re!="string"))throw Du("dirty is not a string, aborting");if(!t.isSupported)return Re;if(Ke||Te(J),t.removed=[],typeof Re=="string"&&(Jt=!1),Jt){const Dt=Re.nodeName;if(typeof Dt=="string"){const be=xe(Dt);if(!D[be]||ie[be])throw Du("root node is forbidden and cannot be sanitized in-place")}}else if(Re instanceof c)me=Mi("<!---->"),Ee=me.ownerDocument.importNode(Re,!0),Ee.nodeType===Ml.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?me=Ee:me.appendChild(Ee);else{if(!dt&&!De&&!Be&&Re.indexOf("<")===-1)return k&&Ct?k.createHTML(Re):Re;if(me=Mi(Re),!me)return dt?null:Ct?L:""}me&&ke&&et(me.firstChild);const yt=Ni(Jt?Re:me);for(;Qe=yt.nextNode();)vt(Qe),en(Qe),Qe.content instanceof f&&wn(Qe.content);if(Jt)return Re;if(dt){if(De){me.normalize();let Dt=me.innerHTML;Al([G,B,Y],be=>{Dt=Ya(Dt,be," ")}),me.innerHTML=Dt}if(Pt)for($e=A.call(me.ownerDocument);me.firstChild;)$e.appendChild(me.firstChild);else $e=me;return(q.shadowroot||q.shadowrootmode)&&($e=K.call(s,$e,!0)),$e}let wt=Be?me.outerHTML:me.innerHTML;return Be&&D["!doctype"]&&me.ownerDocument&&me.ownerDocument.doctype&&me.ownerDocument.doctype.name&&Pn(bC,me.ownerDocument.doctype.name)&&(wt="<!DOCTYPE "+me.ownerDocument.doctype.name+`>
158
+ `+wt),De&&Al([G,B,Y],Dt=>{wt=Ya(wt,Dt," ")}),k&&Ct?k.createHTML(wt):wt},t.setConfig=function(){let Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Te(Re),Ke=!0},t.clearConfig=function(){Pe=null,Ke=!1},t.isValidAttribute=function(Re,J,me){Pe||Te({});const Ee=xe(Re),Qe=xe(J);return nt(Ee,Qe,me)},t.addHook=function(Re,J){typeof J=="function"&&Rl(F[Re],J)},t.removeHook=function(Re,J){if(J!==void 0){const me=BO(F[Re],J);return me===-1?void 0:PO(F[Re],me,1)[0]}return Ny(F[Re])},t.removeHooks=function(Re){F[Re]=[]},t.removeAllHooks=function(){F=Uy()},t}var Wl=yC(),Mp,Fy;function rD(){if(Fy)return Mp;Fy=1;function e(ee){return ee instanceof Map?ee.clear=ee.delete=ee.set=function(){throw new Error("map is read-only")}:ee instanceof Set&&(ee.add=ee.clear=ee.delete=function(){throw new Error("set is read-only")}),Object.freeze(ee),Object.getOwnPropertyNames(ee).forEach(pe=>{const xe=ee[pe],Pe=typeof xe;(Pe==="object"||Pe==="function")&&!Object.isFrozen(xe)&&e(xe)}),ee}class t{constructor(pe){pe.data===void 0&&(pe.data={}),this.data=pe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(ee){return ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function s(ee,...pe){const xe=Object.create(null);for(const Pe in ee)xe[Pe]=ee[Pe];return pe.forEach(function(Pe){for(const xt in Pe)xe[xt]=Pe[xt]}),xe}const o="</span>",f=ee=>!!ee.scope,p=(ee,{prefix:pe})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const xe=ee.split(".");return[`${pe}${xe.shift()}`,...xe.map((Pe,xt)=>`${Pe}${"_".repeat(xt+1)}`)].join(" ")}return`${pe}${ee}`};class c{constructor(pe,xe){this.buffer="",this.classPrefix=xe.classPrefix,pe.walk(this)}addText(pe){this.buffer+=i(pe)}openNode(pe){if(!f(pe))return;const xe=p(pe.scope,{prefix:this.classPrefix});this.span(xe)}closeNode(pe){f(pe)&&(this.buffer+=o)}value(){return this.buffer}span(pe){this.buffer+=`<span class="${pe}">`}}const h=(ee={})=>{const pe={children:[]};return Object.assign(pe,ee),pe};class d{constructor(){this.rootNode=h(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(pe){this.top.children.push(pe)}openNode(pe){const xe=h({scope:pe});this.add(xe),this.stack.push(xe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(pe){return this.constructor._walk(pe,this.rootNode)}static _walk(pe,xe){return typeof xe=="string"?pe.addText(xe):xe.children&&(pe.openNode(xe),xe.children.forEach(Pe=>this._walk(pe,Pe)),pe.closeNode(xe)),pe}static _collapse(pe){typeof pe!="string"&&pe.children&&(pe.children.every(xe=>typeof xe=="string")?pe.children=[pe.children.join("")]:pe.children.forEach(xe=>{d._collapse(xe)}))}}class _ extends d{constructor(pe){super(),this.options=pe}addText(pe){pe!==""&&this.add(pe)}startScope(pe){this.openNode(pe)}endScope(){this.closeNode()}__addSublanguage(pe,xe){const Pe=pe.root;xe&&(Pe.scope=`language:${xe}`),this.add(Pe)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function g(ee){return ee?typeof ee=="string"?ee:ee.source:null}function S(ee){return w("(?=",ee,")")}function C(ee){return w("(?:",ee,")*")}function T(ee){return w("(?:",ee,")?")}function w(...ee){return ee.map(xe=>g(xe)).join("")}function m(ee){const pe=ee[ee.length-1];return typeof pe=="object"&&pe.constructor===Object?(ee.splice(ee.length-1,1),pe):{}}function b(...ee){return"("+(m(ee).capture?"":"?:")+ee.map(Pe=>g(Pe)).join("|")+")"}function v(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function x(ee,pe){const xe=ee&&ee.exec(pe);return xe&&xe.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(ee,{joinWith:pe}){let xe=0;return ee.map(Pe=>{xe+=1;const xt=xe;let ft=g(Pe),Te="";for(;ft.length>0;){const Ce=k.exec(ft);if(!Ce){Te+=ft;break}Te+=ft.substring(0,Ce.index),ft=ft.substring(Ce.index+Ce[0].length),Ce[0][0]==="\\"&&Ce[1]?Te+="\\"+String(Number(Ce[1])+xt):(Te+=Ce[0],Ce[0]==="("&&xe++)}return Te}).map(Pe=>`(${Pe})`).join(pe)}const R=/\b\B/,N="[a-zA-Z]\\w*",A="[a-zA-Z_]\\w*",I="\\b\\d+(\\.\\d+)?",K="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",F="\\b(0b[01]+)",G="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",B=(ee={})=>{const pe=/^#![ ]*\//;return ee.binary&&(ee.begin=w(pe,/.*\b/,ee.binary,/\b.*/)),s({scope:"meta",begin:pe,end:/$/,relevance:0,"on:begin":(xe,Pe)=>{xe.index!==0&&Pe.ignoreMatch()}},ee)},Y={begin:"\\\\[\\s\\S]",relevance:0},W={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Y]},z={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Y]},V={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/},X=function(ee,pe,xe={}){const Pe=s({scope:"comment",begin:ee,end:pe,contains:[]},xe);Pe.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 xt=b("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 Pe.contains.push({begin:w(/[ ]+/,"(",xt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},j=X("//","$"),P=X("/\\*","\\*/"),D=X("#","$"),U={scope:"number",begin:I,relevance:0},q={scope:"number",begin:K,relevance:0},Q={scope:"number",begin:F,relevance:0},re={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Y,{begin:/\[/,end:/\]/,relevance:0,contains:[Y]}]},ie={scope:"title",begin:N,relevance:0},Z={scope:"title",begin:A,relevance:0},H={begin:"\\.\\s*"+A,relevance:0};var fe=Object.freeze({__proto__:null,APOS_STRING_MODE:W,BACKSLASH_ESCAPE:Y,BINARY_NUMBER_MODE:Q,BINARY_NUMBER_RE:F,COMMENT:X,C_BLOCK_COMMENT_MODE:P,C_LINE_COMMENT_MODE:j,C_NUMBER_MODE:q,C_NUMBER_RE:K,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(pe,xe)=>{xe.data._beginMatch=pe[1]},"on:end":(pe,xe)=>{xe.data._beginMatch!==pe[1]&&xe.ignoreMatch()}})},HASH_COMMENT_MODE:D,IDENT_RE:N,MATCH_NOTHING_RE:R,METHOD_GUARD:H,NUMBER_MODE:U,NUMBER_RE:I,PHRASAL_WORDS_MODE:V,QUOTE_STRING_MODE:z,REGEXP_MODE:re,RE_STARTERS_RE:G,SHEBANG:B,TITLE_MODE:ie,UNDERSCORE_IDENT_RE:A,UNDERSCORE_TITLE_MODE:Z});function Se(ee,pe){ee.input[ee.index-1]==="."&&pe.ignoreMatch()}function ye(ee,pe){ee.className!==void 0&&(ee.scope=ee.className,delete ee.className)}function De(ee,pe){pe&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=Se,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function Fe(ee,pe){Array.isArray(ee.illegal)&&(ee.illegal=b(...ee.illegal))}function Be(ee,pe){if(ee.match){if(ee.begin||ee.end)throw new Error("begin & end are not supported with match");ee.begin=ee.match,delete ee.match}}function Ke(ee,pe){ee.relevance===void 0&&(ee.relevance=1)}const ke=(ee,pe)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const xe=Object.assign({},ee);Object.keys(ee).forEach(Pe=>{delete ee[Pe]}),ee.keywords=xe.keywords,ee.begin=w(xe.beforeMatch,S(xe.begin)),ee.starts={relevance:0,contains:[Object.assign(xe,{endsParent:!0})]},ee.relevance=0,delete xe.beforeMatch},dt=["of","and","for","in","not","or","if","then","parent","list","value"],Pt="keyword";function Ct(ee,pe,xe=Pt){const Pe=Object.create(null);return typeof ee=="string"?xt(xe,ee.split(" ")):Array.isArray(ee)?xt(xe,ee):Object.keys(ee).forEach(function(ft){Object.assign(Pe,Ct(ee[ft],pe,ft))}),Pe;function xt(ft,Te){pe&&(Te=Te.map(Ce=>Ce.toLowerCase())),Te.forEach(function(Ce){const ze=Ce.split("|");Pe[ze[0]]=[ft,Gn(ze[0],ze[1])]})}}function Gn(ee,pe){return pe?Number(pe):qn(ee)?0:1}function qn(ee){return dt.includes(ee.toLowerCase())}const Zt={},ht=ee=>{console.error(ee)},Jt=(ee,...pe)=>{console.log(`WARN: ${ee}`,...pe)},zt=(ee,pe)=>{Zt[`${ee}/${pe}`]||(console.log(`Deprecated as of ${ee}. ${pe}`),Zt[`${ee}/${pe}`]=!0)},Kt=new Error;function nn(ee,pe,{key:xe}){let Pe=0;const xt=ee[xe],ft={},Te={};for(let Ce=1;Ce<=pe.length;Ce++)Te[Ce+Pe]=xt[Ce],ft[Ce+Pe]=!0,Pe+=v(pe[Ce-1]);ee[xe]=Te,ee[xe]._emit=ft,ee[xe]._multi=!0}function ni(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw ht("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Kt;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw ht("beginScope must be object"),Kt;nn(ee,ee.begin,{key:"beginScope"}),ee.begin=L(ee.begin,{joinWith:""})}}function xn(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw ht("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Kt;if(typeof ee.endScope!="object"||ee.endScope===null)throw ht("endScope must be object"),Kt;nn(ee,ee.end,{key:"endScope"}),ee.end=L(ee.end,{joinWith:""})}}function Qt(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function lt(ee){Qt(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),ni(ee),xn(ee)}function hn(ee){function pe(Te,Ce){return new RegExp(g(Te),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Ce?"g":""))}class xe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ce,ze){ze.position=this.position++,this.matchIndexes[this.matchAt]=ze,this.regexes.push([ze,Ce]),this.matchAt+=v(Ce)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ce=this.regexes.map(ze=>ze[1]);this.matcherRe=pe(L(Ce,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ce){this.matcherRe.lastIndex=this.lastIndex;const ze=this.matcherRe.exec(Ce);if(!ze)return null;const It=ze.findIndex((dn,Mi)=>Mi>0&&dn!==void 0),et=this.matchIndexes[It];return ze.splice(0,It),Object.assign(ze,et)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ce){if(this.multiRegexes[Ce])return this.multiRegexes[Ce];const ze=new xe;return this.rules.slice(Ce).forEach(([It,et])=>ze.addRule(It,et)),ze.compile(),this.multiRegexes[Ce]=ze,ze}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ce,ze){this.rules.push([Ce,ze]),ze.type==="begin"&&this.count++}exec(Ce){const ze=this.getMatcher(this.regexIndex);ze.lastIndex=this.lastIndex;let It=ze.exec(Ce);if(this.resumingScanAtSamePosition()&&!(It&&It.index===this.lastIndex)){const et=this.getMatcher(0);et.lastIndex=this.lastIndex+1,It=et.exec(Ce)}return It&&(this.regexIndex+=It.position+1,this.regexIndex===this.count&&this.considerAll()),It}}function xt(Te){const Ce=new Pe;return Te.contains.forEach(ze=>Ce.addRule(ze.begin,{rule:ze,type:"begin"})),Te.terminatorEnd&&Ce.addRule(Te.terminatorEnd,{type:"end"}),Te.illegal&&Ce.addRule(Te.illegal,{type:"illegal"}),Ce}function ft(Te,Ce){const ze=Te;if(Te.isCompiled)return ze;[ye,Be,lt,ke].forEach(et=>et(Te,Ce)),ee.compilerExtensions.forEach(et=>et(Te,Ce)),Te.__beforeBegin=null,[De,Fe,Ke].forEach(et=>et(Te,Ce)),Te.isCompiled=!0;let It=null;return typeof Te.keywords=="object"&&Te.keywords.$pattern&&(Te.keywords=Object.assign({},Te.keywords),It=Te.keywords.$pattern,delete Te.keywords.$pattern),It=It||/\w+/,Te.keywords&&(Te.keywords=Ct(Te.keywords,ee.case_insensitive)),ze.keywordPatternRe=pe(It,!0),Ce&&(Te.begin||(Te.begin=/\B|\b/),ze.beginRe=pe(ze.begin),!Te.end&&!Te.endsWithParent&&(Te.end=/\B|\b/),Te.end&&(ze.endRe=pe(ze.end)),ze.terminatorEnd=g(ze.end)||"",Te.endsWithParent&&Ce.terminatorEnd&&(ze.terminatorEnd+=(Te.end?"|":"")+Ce.terminatorEnd)),Te.illegal&&(ze.illegalRe=pe(Te.illegal)),Te.contains||(Te.contains=[]),Te.contains=[].concat(...Te.contains.map(function(et){return $t(et==="self"?Te:et)})),Te.contains.forEach(function(et){ft(et,ze)}),Te.starts&&ft(Te.starts,Ce),ze.matcher=xt(ze),ze}if(ee.compilerExtensions||(ee.compilerExtensions=[]),ee.contains&&ee.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ee.classNameAliases=s(ee.classNameAliases||{}),ft(ee)}function Ht(ee){return ee?ee.endsWithParent||Ht(ee.starts):!1}function $t(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(pe){return s(ee,{variants:null},pe)})),ee.cachedVariants?ee.cachedVariants:Ht(ee)?s(ee,{starts:ee.starts?s(ee.starts):null}):Object.isFrozen(ee)?s(ee):ee}var Et="11.11.1";class mi extends Error{constructor(pe,xe){super(pe),this.name="HTMLInjectionError",this.html=xe}}const Yi=i,Hn=s,Ln=Symbol("nomatch"),$n=7,Xi=function(ee){const pe=Object.create(null),xe=Object.create(null),Pe=[];let xt=!0;const ft="Could not find the language '{}', did you forget to load/include a language module?",Te={disableAutodetect:!0,name:"Plain text",contains:[]};let Ce={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:_};function ze(be){return Ce.noHighlightRe.test(be)}function It(be){let Me=be.className+" ";Me+=be.parentNode?be.parentNode.className:"";const Ie=Ce.languageDetectRe.exec(Me);if(Ie){const pt=J(Ie[1]);return pt||(Jt(ft.replace("{}",Ie[1])),Jt("Falling back to no-highlight mode for this block.",be)),pt?Ie[1]:"no-highlight"}return Me.split(/\s+/).find(pt=>ze(pt)||J(pt))}function et(be,Me,Ie){let pt="",Vt="";typeof Me=="object"?(pt=be,Ie=Me.ignoreIllegals,Vt=Me.language):(zt("10.7.0","highlight(lang, code, ...args) has been deprecated."),zt("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Vt=be,pt=Me),Ie===void 0&&(Ie=!0);const Un={code:pt,language:Vt};wt("before:highlight",Un);const _i=Un.result?Un.result:dn(Un.language,Un.code,Ie);return _i.code=Un.code,wt("after:highlight",_i),_i}function dn(be,Me,Ie,pt){const Vt=Object.create(null);function Un(we,Ne){return we.keywords[Ne]}function _i(){if(!Ge.keywords){gn.addText(kt);return}let we=0;Ge.keywordPatternRe.lastIndex=0;let Ne=Ge.keywordPatternRe.exec(kt),Ve="";for(;Ne;){Ve+=kt.substring(we,Ne.index);const st=Nn.case_insensitive?Ne[0].toLowerCase():Ne[0],tn=Un(Ge,st);if(tn){const[Oi,Ro]=tn;if(gn.addText(Ve),Ve="",Vt[st]=(Vt[st]||0)+1,Vt[st]<=$n&&(Kr+=Ro),Oi.startsWith("_"))Ve+=Ne[0];else{const dc=Nn.classNameAliases[Oi]||Oi;vi(Ne[0],dc)}}else Ve+=Ne[0];we=Ge.keywordPatternRe.lastIndex,Ne=Ge.keywordPatternRe.exec(kt)}Ve+=kt.substring(we),gn.addText(Ve)}function ii(){if(kt==="")return;let we=null;if(typeof Ge.subLanguage=="string"){if(!pe[Ge.subLanguage]){gn.addText(kt);return}we=dn(Ge.subLanguage,kt,!0,hc[Ge.subLanguage]),hc[Ge.subLanguage]=we._top}else we=Ni(kt,Ge.subLanguage.length?Ge.subLanguage:null);Ge.relevance>0&&(Kr+=we.relevance),gn.__addSublanguage(we._emitter,we.language)}function Bt(){Ge.subLanguage!=null?ii():_i(),kt=""}function vi(we,Ne){we!==""&&(gn.startScope(Ne),gn.addText(we),gn.endScope())}function cc(we,Ne){let Ve=1;const st=Ne.length-1;for(;Ve<=st;){if(!we._emit[Ve]){Ve++;continue}const tn=Nn.classNameAliases[we[Ve]]||we[Ve],Oi=Ne[Ve];tn?vi(Oi,tn):(kt=Oi,_i(),kt=""),Ve++}}function da(we,Ne){return we.scope&&typeof we.scope=="string"&&gn.openNode(Nn.classNameAliases[we.scope]||we.scope),we.beginScope&&(we.beginScope._wrap?(vi(kt,Nn.classNameAliases[we.beginScope._wrap]||we.beginScope._wrap),kt=""):we.beginScope._multi&&(cc(we.beginScope,Ne),kt="")),Ge=Object.create(we,{parent:{value:Ge}}),Ge}function ko(we,Ne,Ve){let st=x(we.endRe,Ve);if(st){if(we["on:end"]){const tn=new t(we);we["on:end"](Ne,tn),tn.isMatchIgnored&&(st=!1)}if(st){for(;we.endsParent&&we.parent;)we=we.parent;return we}}if(we.endsWithParent)return ko(we.parent,Ne,Ve)}function fa(we){return Ge.matcher.regexIndex===0?(kt+=we[0],1):(Vr=!0,0)}function Kh(we){const Ne=we[0],Ve=we.rule,st=new t(Ve),tn=[Ve.__beforeBegin,Ve["on:begin"]];for(const Oi of tn)if(Oi&&(Oi(we,st),st.isMatchIgnored))return fa(Ne);return Ve.skip?kt+=Ne:(Ve.excludeBegin&&(kt+=Ne),Bt(),!Ve.returnBegin&&!Ve.excludeBegin&&(kt=Ne)),da(Ve,we),Ve.returnBegin?0:Ne.length}function ri(we){const Ne=we[0],Ve=Me.substring(we.index),st=ko(Ge,we,Ve);if(!st)return Ln;const tn=Ge;Ge.endScope&&Ge.endScope._wrap?(Bt(),vi(Ne,Ge.endScope._wrap)):Ge.endScope&&Ge.endScope._multi?(Bt(),cc(Ge.endScope,we)):tn.skip?kt+=Ne:(tn.returnEnd||tn.excludeEnd||(kt+=Ne),Bt(),tn.excludeEnd&&(kt=Ne));do Ge.scope&&gn.closeNode(),!Ge.skip&&!Ge.subLanguage&&(Kr+=Ge.relevance),Ge=Ge.parent;while(Ge!==st.parent);return st.starts&&da(st.starts,we),tn.returnEnd?0:Ne.length}function To(){const we=[];for(let Ne=Ge;Ne!==Nn;Ne=Ne.parent)Ne.scope&&we.unshift(Ne.scope);we.forEach(Ne=>gn.openNode(Ne))}let Ms={};function pa(we,Ne){const Ve=Ne&&Ne[0];if(kt+=we,Ve==null)return Bt(),0;if(Ms.type==="begin"&&Ne.type==="end"&&Ms.index===Ne.index&&Ve===""){if(kt+=Me.slice(Ne.index,Ne.index+1),!xt){const st=new Error(`0 width match regex (${be})`);throw st.languageName=be,st.badRule=Ms.rule,st}return 1}if(Ms=Ne,Ne.type==="begin")return Kh(Ne);if(Ne.type==="illegal"&&!Ie){const st=new Error('Illegal lexeme "'+Ve+'" for mode "'+(Ge.scope||"<unnamed>")+'"');throw st.mode=Ge,st}else if(Ne.type==="end"){const st=ri(Ne);if(st!==Ln)return st}if(Ne.type==="illegal"&&Ve==="")return kt+=`
160
+ `,1;if(Ao>1e5&&Ao>Ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return kt+=Ve,Ve.length}const Nn=J(be);if(!Nn)throw ht(ft.replace("{}",be)),new Error('Unknown language: "'+be+'"');const uc=hn(Nn);let ga="",Ge=pt||uc;const hc={},gn=new Ce.__emitter(Ce);To();let kt="",Kr=0,br=0,Ao=0,Vr=!1;try{if(Nn.__emitTokens)Nn.__emitTokens(Me,gn);else{for(Ge.matcher.considerAll();;){Ao++,Vr?Vr=!1:Ge.matcher.considerAll(),Ge.matcher.lastIndex=br;const we=Ge.matcher.exec(Me);if(!we)break;const Ne=Me.substring(br,we.index),Ve=pa(Ne,we);br=we.index+Ve}pa(Me.substring(br))}return gn.finalize(),ga=gn.toHTML(),{language:be,value:ga,relevance:Kr,illegal:!1,_emitter:gn,_top:Ge}}catch(we){if(we.message&&we.message.includes("Illegal"))return{language:be,value:Yi(Me),illegal:!0,relevance:0,_illegalBy:{message:we.message,index:br,context:Me.slice(br-100,br+100),mode:we.mode,resultSoFar:ga},_emitter:gn};if(xt)return{language:be,value:Yi(Me),illegal:!1,relevance:0,errorRaised:we,_emitter:gn,_top:Ge};throw we}}function Mi(be){const Me={value:Yi(be),illegal:!1,relevance:0,_top:Te,_emitter:new Ce.__emitter(Ce)};return Me._emitter.addText(be),Me}function Ni(be,Me){Me=Me||Ce.languages||Object.keys(pe);const Ie=Mi(be),pt=Me.filter(J).filter(Ee).map(Bt=>dn(Bt,be,!1));pt.unshift(Ie);const Vt=pt.sort((Bt,vi)=>{if(Bt.relevance!==vi.relevance)return vi.relevance-Bt.relevance;if(Bt.language&&vi.language){if(J(Bt.language).supersetOf===vi.language)return 1;if(J(vi.language).supersetOf===Bt.language)return-1}return 0}),[Un,_i]=Vt,ii=Un;return ii.secondBest=_i,ii}function Mn(be,Me,Ie){const pt=Me&&xe[Me]||Ie;be.classList.add("hljs"),be.classList.add(`language-${pt}`)}function de(be){let Me=null;const Ie=It(be);if(ze(Ie))return;if(wt("before:highlightElement",{el:be,language:Ie}),be.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",be);return}if(be.children.length>0&&(Ce.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(be)),Ce.throwUnescapedHTML))throw new mi("One of your code blocks includes unescaped HTML.",be.innerHTML);Me=be;const pt=Me.textContent,Vt=Ie?et(pt,{language:Ie,ignoreIllegals:!0}):Ni(pt);be.innerHTML=Vt.value,be.dataset.highlighted="yes",Mn(be,Ie,Vt.language),be.result={language:Vt.language,re:Vt.relevance,relevance:Vt.relevance},Vt.secondBest&&(be.secondBest={language:Vt.secondBest.language,relevance:Vt.secondBest.relevance}),wt("after:highlightElement",{el:be,result:Vt,text:pt})}function je(be){Ce=Hn(Ce,be)}const vt=()=>{bt(),zt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function nt(){bt(),zt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ae=!1;function bt(){function be(){bt()}if(document.readyState==="loading"){Ae||window.addEventListener("DOMContentLoaded",be,!1),Ae=!0;return}document.querySelectorAll(Ce.cssSelector).forEach(de)}function en(be,Me){let Ie=null;try{Ie=Me(ee)}catch(pt){if(ht("Language definition for '{}' could not be registered.".replace("{}",be)),xt)ht(pt);else throw pt;Ie=Te}Ie.name||(Ie.name=be),pe[be]=Ie,Ie.rawDefinition=Me.bind(null,ee),Ie.aliases&&me(Ie.aliases,{languageName:be})}function wn(be){delete pe[be];for(const Me of Object.keys(xe))xe[Me]===be&&delete xe[Me]}function Re(){return Object.keys(pe)}function J(be){return be=(be||"").toLowerCase(),pe[be]||pe[xe[be]]}function me(be,{languageName:Me}){typeof be=="string"&&(be=[be]),be.forEach(Ie=>{xe[Ie.toLowerCase()]=Me})}function Ee(be){const Me=J(be);return Me&&!Me.disableAutodetect}function Qe(be){be["before:highlightBlock"]&&!be["before:highlightElement"]&&(be["before:highlightElement"]=Me=>{be["before:highlightBlock"](Object.assign({block:Me.el},Me))}),be["after:highlightBlock"]&&!be["after:highlightElement"]&&(be["after:highlightElement"]=Me=>{be["after:highlightBlock"](Object.assign({block:Me.el},Me))})}function $e(be){Qe(be),Pe.push(be)}function yt(be){const Me=Pe.indexOf(be);Me!==-1&&Pe.splice(Me,1)}function wt(be,Me){const Ie=be;Pe.forEach(function(pt){pt[Ie]&&pt[Ie](Me)})}function Dt(be){return zt("10.7.0","highlightBlock will be removed entirely in v12.0"),zt("10.7.0","Please use highlightElement now."),de(be)}Object.assign(ee,{highlight:et,highlightAuto:Ni,highlightAll:bt,highlightElement:de,highlightBlock:Dt,configure:je,initHighlighting:vt,initHighlightingOnLoad:nt,registerLanguage:en,unregisterLanguage:wn,listLanguages:Re,getLanguage:J,registerAliases:me,autoDetection:Ee,inherit:Hn,addPlugin:$e,removePlugin:yt}),ee.debugMode=function(){xt=!1},ee.safeMode=function(){xt=!0},ee.versionString=Et,ee.regex={concat:w,lookahead:S,either:b,optional:T,anyNumberOfTimes:C};for(const be in fe)typeof fe[be]=="object"&&e(fe[be]);return Object.assign(ee,fe),ee},rn=Xi({});return rn.newInstance=()=>Xi({}),Mp=rn,rn.HighlightJS=rn,rn.default=rn,Mp}var sD=rD();const Ui=fm(sD);function Wy(e){const t=e.regex,i={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},f=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),p={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,o]};o.contains.push(c);const h={match:/\\"/},d={className:"string",begin:/'/,end:/'/},_={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},S=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=e.SHEBANG({binary:`(${S.join("|")})`,relevance:10}),T={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},w=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],m=["true","false"],b={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],x=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["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"],L=["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:w,literal:m,built_in:[...v,...x,"set","shopt",...k,...L]},contains:[C,e.SHEBANG(),T,g,f,p,b,c,h,d,_,i]}}const Gy="[A-Za-z$_][0-9A-Za-z$_]*",aD=["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"],oD=["true","false","null","undefined","NaN","Infinity"],SC=["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"],xC=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],wC=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],lD=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],cD=[].concat(wC,SC,xC);function qy(e){const t=e.regex,i=(X,{after:j})=>{const P="</"+X[0].slice(1);return X.input.indexOf(P,j)!==-1},s=Gy,o={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,j)=>{const P=X[0].length+X.index,D=X.input[P];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(X,{after:P})||j.ignoreMatch());let U;const q=X.input.substring(P);if(U=q.match(/^\s*=/)){j.ignoreMatch();return}if((U=q.match(/^\s+extends\s+/))&&U.index===0){j.ignoreMatch();return}}},c={$pattern:Gy,keyword:aD,literal:oD,built_in:cD,"variable.language":lD},h="[0-9](_?[0-9])*",d=`\\.(${h})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${d})|\\.)?|(${d}))[eE][+-]?(${h})\\b`},{begin:`\\b(${_})\\b((${d})\\b|\\.)?|(${d})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,{match:/\$\d+/},g];S.contains=x.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(x)});const k=[].concat(v,S.contains),L=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:L},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},A={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:{_:[...SC,...xC]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},K={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(X){return t.concat("(?!",X.join("|"),")")}const B={match:t.concat(/\b/,G([...wC,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},W={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},z="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",V={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,v,{match:/\$\d+/},g,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},V,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:z,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:c,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:f},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},K,{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:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},B,F,N,W,{match:/\$[(.]/}]}}function uD(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],o={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,i,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function Ky(e){const t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},o={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}]},f={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},p={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},c=/[A-Za-z][A-Za-z0-9+.-]*/,h={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,c,/:\/\/.*?\)/),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}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},_={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(d,{contains:[]}),S=e.inherit(_,{contains:[]});d.contains.push(S),_.contains.push(g);let C=[i,h];return[d,_,g,S].forEach(b=>{b.contains=b.contains.concat(C)}),C=C.concat(d,_),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:C},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:C}]}]},i,f,d,_,{className:"quote",begin:"^>\\s+",contains:C,end:"$"},o,s,h,p,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Vy(e){const t=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["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"],c={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,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"]},h={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},_={begin:/\{\{/,relevance:0},g={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h,_,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,_,d]},{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,_,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,_,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S="[0-9](_?[0-9])*",C=`(\\b(${S}))?\\.(${S})|\\b(${S})\\.`,T=`\\b|${s.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${S})|(${C}))[eE][+-]?(${S})[jJ]?(?=${T})`},{begin:`(${C})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${T})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${T})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${T})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${T})`},{begin:`\\b(${S})[jJ](?=${T})`}]},m={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:c,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:["self",h,w,g,e.HASH_COMMENT_MODE]}]};return d.contains=[g,w,h],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:c,illegal:/(<\/|\?)|=>/,contains:[h,w,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},g,m,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[w,b,g]}]}}const Sh="[A-Za-z$_][0-9A-Za-z$_]*",CC=["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"],EC=["true","false","null","undefined","NaN","Infinity"],kC=["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"],TC=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],AC=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],RC=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],LC=[].concat(AC,kC,TC);function hD(e){const t=e.regex,i=(X,{after:j})=>{const P="</"+X[0].slice(1);return X.input.indexOf(P,j)!==-1},s=Sh,o={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,j)=>{const P=X[0].length+X.index,D=X.input[P];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(X,{after:P})||j.ignoreMatch());let U;const q=X.input.substring(P);if(U=q.match(/^\s*=/)){j.ignoreMatch();return}if((U=q.match(/^\s+extends\s+/))&&U.index===0){j.ignoreMatch();return}}},c={$pattern:Sh,keyword:CC,literal:EC,built_in:LC,"variable.language":RC},h="[0-9](_?[0-9])*",d=`\\.(${h})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${_})((${d})|\\.)?|(${d}))[eE][+-]?(${h})\\b`},{begin:`\\b(${_})\\b((${d})\\b|\\.)?|(${d})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={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:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,{match:/\$\d+/},g];S.contains=x.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(x)});const k=[].concat(v,S.contains),L=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),R={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:L},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},A={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:{_:[...kC,...TC]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},K={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},F={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(X){return t.concat("(?!",X.join("|"),")")}const B={match:t.concat(/\b/,G([...AC,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},Y={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},W={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},z="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",V={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(z)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[R]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:L,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,v,{match:/\$\d+/},g,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},V,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:z,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:c,contains:L}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:f},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},K,{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:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},Y,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},B,F,N,W,{match:/\$[(.]/}]}}function Yy(e){const t=e.regex,i=hD(e),s=Sh,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],f={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},p={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[i.exports.CLASS_REFERENCE]},c={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},h=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:Sh,keyword:CC.concat(h),literal:EC,built_in:LC.concat(o),"variable.language":RC},_={className:"meta",begin:"@"+s},g=(w,m,b)=>{const v=w.contains.findIndex(x=>x.label===m);if(v===-1)throw new Error("can not find mode to replace");w.contains.splice(v,1,b)};Object.assign(i.keywords,d),i.exports.PARAMS_CONTAINS.push(_);const S=i.contains.find(w=>w.scope==="attr"),C=Object.assign({},S,{match:t.concat(s,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,S,C]),i.contains=i.contains.concat([_,f,p,C]),g(i,"shebang",e.SHEBANG()),g(i,"use_strict",c);const T=i.contains.find(w=>w.label==="func.def");return T.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}const dD=/\[\[wiki:([^\]]+)\]\]/g,fD=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,pD=/^(\S[^:]*?):[ \t]*(.*)$/,gD=new mC({gfm:!0,breaks:!1}),Xy={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},Np=RD();function xh(e,t={}){const{entries:i,content:s}=vD(e),o=SD(s,t.resolveWikiLink),f=gD.parse(o,{async:!1}),p=yD(i),c=Wl.sanitize(p+f,Xy),h=new DOMParser().parseFromString(c,"text/html");return wD(h,t.omitDuplicateTitle),xD(h),CD(h),kD(h),{html:Wl.sanitize(h.body.innerHTML,Xy),toc:TD(h)}}function mD(e){const t=new TextEncoder().encode(e);let i="";for(const s of t)i+=String.fromCharCode(s);return btoa(i)}function _D(e){const t=atob(e),i=new Uint8Array(t.length);for(let s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return new TextDecoder().decode(i)}function vD(e){const t=fD.exec(e);return t?{entries:bD(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function bD(e){const t=[];for(const i of e.split(/\r?\n/)){const s=i.replace(/\s+$/,"");if(s.trim()==="")continue;const o=pD.exec(s);if(o){const[,c="",h=""]=o;t.push({key:c.trim(),value:h.trim()});continue}const f=t[t.length-1];if(!f)continue;const p=s.trim();f.value=f.value?`${f.value} ${p}`:p}return t}function yD(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${Gl(i.key)}</dt><dd>${Gl(i.value)}</dd>`).join("")}</dl>`}function SD(e,t){return e.replace(dD,(i,s)=>{const o=s.trim();if(!o)return"";if(!t)return Gl(`[[wiki:${o}]]`);const f=t(o);if(f===null)return Gl(`[[wiki:${o}]]`);const p=Gl(o),c=encodeURIComponent(o);return`<a href="${f}" data-entry-id="${c}">${p}</a>`})}function xD(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const s=i.textContent?.trim()??"",o=ND(s||"section"),f=t.get(o)??0;t.set(o,f+1),i.id=f===0?o:`${o}-${f+1}`}}function wD(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||Zy(i.textContent??"")===Zy(t)&&i.remove()}function CD(e){for(const t of e.querySelectorAll("pre > code")){const i=LD(t.className),s=t.textContent??"",o=t.parentElement;if(!o)continue;if(i==="mermaid"){const p=e.createElement("div");p.className="diagram-block",p.setAttribute("data-mermaid-source",mD(s)),p.setAttribute("data-diagram-state","pending"),o.replaceWith(p);continue}const f=AD(s,i);t.innerHTML=f,t.classList.add("hljs"),o.classList.add("code-block"),o.dataset.code=s,o.insertBefore(ED(e,i||"text"),o.firstChild)}}function ED(e,t){const i=e.createElement("div");i.className="code-block-toolbar";const s=e.createElement("span");s.className="code-block-dots",s.setAttribute("aria-hidden","true");for(let p=0;p<3;p++)s.append(e.createElement("span"));const o=e.createElement("span");o.className="code-block-language",o.textContent=t;const f=e.createElement("button");return f.className="copy-code",f.type="button",f.dataset.action="copy-code",f.setAttribute("aria-label",`Copy ${t} code`),f.textContent="Copy",i.append(s,o,f),i}function kD(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";MD(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function TD(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 AD(e,t){return t&&Np.getLanguage(t)?Np.highlight(e,{language:t}).value:Np.highlightAuto(e).value}function RD(){return Ui.registerLanguage("bash",Wy),Ui.registerLanguage("sh",Wy),Ui.registerLanguage("javascript",qy),Ui.registerLanguage("js",qy),Ui.registerLanguage("json",uD),Ui.registerLanguage("markdown",Ky),Ui.registerLanguage("md",Ky),Ui.registerLanguage("python",Vy),Ui.registerLanguage("py",Vy),Ui.registerLanguage("typescript",Yy),Ui.registerLanguage("ts",Yy),Ui}function LD(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function MD(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function ND(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function Zy(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Gl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const OD="modulepreload",DD=function(e){return"/console/"+e},Jy={},jD=function(t,i,s){let o=Promise.resolve();if(i&&i.length>0){let h=function(d){return Promise.all(d.map(_=>Promise.resolve(_).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),c=p?.nonce||p?.getAttribute("nonce");o=h(i.map(d=>{if(d=DD(d),d in Jy)return;Jy[d]=!0;const _=d.endsWith(".css"),g=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const S=document.createElement("link");if(S.rel=_?"stylesheet":OD,_||(S.as="script"),S.crossOrigin="",S.href=d,c&&S.setAttribute("nonce",c),document.head.appendChild(S),_)return new Promise((C,T)=>{S.addEventListener("load",C),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${d}`)))})}))}function f(p){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=p,window.dispatchEvent(c),!c.defaultPrevented)throw p}return o.then(p=>{for(const c of p||[])c.status==="rejected"&&f(c.reason);return t().catch(f)})},ID=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",BD=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),PD=/^on/i,zD={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},Qy="diagramInteractionBound",HD=/^oklch\s*\(\s*([^)]+)\s*\)$/i,$D=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Gi=[25,50,75,100,125,150,200],UD=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let Op=null;const eS=new WeakSet;let FD=0,WD=0,ec=null;function Cs(e){const t=e.trim();if(!t)return t;const i=d8(t);return i?f8(i):t}function MC(e){if(eS.has(e))return;eS.add(e),tS(e);const t=e instanceof Node?e:document.body;new MutationObserver(s=>{let o=!1;for(const f of s)if(f.type==="childList"){ec&&!ec.trigger.isConnected&&Pl(!1);for(const p of f.addedNodes)if(p instanceof Element&&(p.matches?.(".diagram-block[data-mermaid-source]")||p.querySelector?.(".diagram-block[data-mermaid-source]"))){o=!0;break}if(o)break}o&&tS(e)}).observe(t,{childList:!0,subtree:!0})}function tS(e){const t=e.querySelectorAll(ID);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",GD(i))}async function GD(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=_D(t)}catch{Dp(e,"Invalid diagram source");return}if(!i.trim()){Dp(e,"Empty diagram source");return}try{const s=await KD(),o=`mermaid-diagram-${++FD}`,{svg:f}=await s.render(o,i);e.innerHTML=qD(f),XD(e,f),ZD(e),JD(e),e.dataset.diagramState="rendered"}catch(s){const o=s instanceof Error?s.message:String(s);Dp(e,o)}}function Dp(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function qD(e){const t=(i,s)=>{PD.test(s.attrName)&&(s.keepAttr=!1)};Wl.addHook("uponSanitizeAttribute",t);try{return Wl.sanitize(e,zD)}finally{Wl.removeHook("uponSanitizeAttribute",t)}}async function KD(){return Op||(Op=(async()=>{const e=await jD(()=>import("./mermaid.core-D9phfpQo.js").then(i=>i.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:VD(),themeCSS:YD(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),Op}function VD(){const e=getComputedStyle(document.documentElement),t=(w,m)=>{const b=e.getPropertyValue(w).trim();return Cs(b||m)},i=(w,m)=>e.getPropertyValue(w).trim()||m,s=t("--brass","#c69a4a"),o=t("--brass-bright","#e6b86a"),f=t("--brass-deep","#a0782a"),p=t("--aurora","#8bd7e6"),c=t("--aurora-deep","#1f8aa8"),h=t("--coral","#ef7c63"),d=t("--ink-deep","#1d2734"),_=t("--ink-fog","#a6afbb"),g=t("--ink-pearl","#e6e9ef"),S=t("--ink-spectral","#bcc4d0"),C=[o,s,p,h,Cs("oklch(70% 0.11 68)"),c,Cs("oklch(76% 0.09 205)"),f,Cs("oklch(68% 0.14 30)"),_,Cs("oklch(62% 0.08 228)"),Cs("oklch(52% 0.05 248)")],T=Object.fromEntries(UD.map((w,m)=>[w,C[m]??d]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:g,primaryBorderColor:s,secondaryColor:"transparent",secondaryTextColor:g,secondaryBorderColor:o,tertiaryColor:"transparent",tertiaryTextColor:S,tertiaryBorderColor:s,lineColor:c,edgeLabelBackground:"transparent",titleColor:o,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:s,clusterBkg:"transparent",clusterBorder:s,pieTitleTextColor:o,pieTitleTextSize:i("--font-size-title-lg","19px"),pieSectionTextColor:g,pieSectionTextSize:i("--font-size-md","13px"),pieLegendTextColor:g,pieLegendTextSize:i("--font-size-lg","14px"),pieStrokeColor:f,pieStrokeWidth:"1.35px",pieOuterStrokeColor:o,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...T}}function YD(){const e=getComputedStyle(document.documentElement),t=(d,_)=>{const g=e.getPropertyValue(d).trim();return Cs(g||_)},i=t("--brass-deep","#a0782a"),s=t("--brass-bright","#e6b86a"),o=t("--aurora-deep","#1f8aa8"),f=t("--ink-abyss","#131920"),p=Cs("oklch(15% 0.04 250 / 34%)"),c=t("--surface-glass","#1d2734"),h=t("--ink-pearl","#e6e9ef");return`
161
+ .node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
162
+ stroke: ${i};
163
+ fill: ${c};
164
+ }
165
+ .edgePath path, .messageLine0, .messageLine1, .relation {
166
+ stroke: ${o};
167
+ }
168
+ .nodeLabel, .edgeLabel, .actor text, .messageText {
169
+ fill: ${h};
170
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
171
+ }
172
+ .pieCircle {
173
+ stroke: ${i};
174
+ stroke-width: 1.35px;
175
+ opacity: 0.96;
176
+ filter: drop-shadow(0 0 1.5px ${p});
177
+ }
178
+ .pieOuterCircle {
179
+ stroke: ${s};
180
+ opacity: 0.7;
181
+ }
182
+ .slice, .legend text, .pieTitleText {
183
+ fill: ${h};
184
+ paint-order: stroke;
185
+ stroke: ${f};
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: ${f};
209
+ stroke-width: 1.5px;
210
+ paint-order: stroke;
211
+ filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${s});
212
+ }
213
+ `}function XD(e,t){const i=new DOMParser().parseFromString(t,"image/svg+xml"),s=Array.from(i.querySelectorAll("a")),o=Array.from(e.querySelectorAll("a")),f=Math.min(s.length,o.length);for(let p=0;p<f;p++){const c=s[p],h=o[p];if(!c||!h)continue;const d=c.getAttribute("href")??c.getAttribute("xlink:href")??"",_=OC(d);_&&h.setAttribute("href",_)}}function ZD(e){const t=e.querySelector("svg");if(!t)return;let i;try{i=t.getBBox()}catch{return}const{x:s,y:o,width:f,height:p}=i;!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(f)||!Number.isFinite(p)||s<0||o<0||f<=0||p<=0||t.setAttribute("viewBox",`${so(s)} ${so(o)} ${so(f)} ${so(p)}`)}function JD(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),c8(e),e.dataset[Qy]!=="true"&&(e.dataset[Qy]="true",e.addEventListener("click",QD),e.addEventListener("keydown",e8))}function QD(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||wh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),NC(t))}function e8(e){if(e.key!=="Enter"&&e.key!==" "||wh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),NC(t))}function NC(e){const t=e.querySelector("svg");if(!t)return;Pl(!1);const i=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",s=document.createElement(i?"dialog":"div"),o=++WD,f=`diagram-lightbox-title-${o}`;s.className="diagram-lightbox",s.setAttribute("aria-labelledby",f),i||(s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.tabIndex=-1);const p=document.createElement("div");p.className="diagram-lightbox__frame";const c=document.createElement("div");c.className="diagram-lightbox__header";const h=document.createElement("h2");h.id=f,h.textContent="MANIFEST · DIAGRAM";const d=document.createElement("button");d.className="diagram-lightbox__close",d.type="button",d.setAttribute("aria-label","Close expanded diagram"),d.textContent="Close";const _=document.createElement("div");_.className="diagram-lightbox__controls",_.setAttribute("aria-label","Diagram zoom controls");const g=Iu("−","Zoom out","out"),S=document.createElement("span");S.className="diagram-lightbox__zoom-readout",S.setAttribute("aria-live","polite");const C=Iu("+","Zoom in","in"),T=Iu("Fit","Fit diagram to viewport","fit"),w=Iu("Reset","Reset diagram zoom","reset");_.append(g,S,C,T,w);const m=document.createElement("div");m.className="diagram-lightbox__viewport";const b=i8(t),v=t.cloneNode(!0);v.removeAttribute("style"),s8(v,`diagram-lightbox-svg-${o}`),m.append(v),c.append(h,_,d),p.append(c,m),s.append(p),document.body.append(s);const x=new t8(m,v,S,b);g.addEventListener("click",()=>x.zoomOut()),C.addEventListener("click",()=>x.zoomIn()),T.addEventListener("click",()=>x.fit()),w.addEventListener("click",()=>x.reset());const k=a8(s),L=A=>{(A.target===s||A.target===d)&&Pl(!0)},R=A=>{if(A.key==="Escape"){A.preventDefault(),Pl(!0);return}x.handleKeyboard(A)||A.key==="Tab"&&l8(A,s)},N={dialog:s,trigger:e,inertStates:k,onClick:L,onKeyDown:R,cleanupPanZoom:()=>x.destroy()};i&&(N.onCancel=A=>{A.preventDefault(),Pl(!0)},s.addEventListener("cancel",N.onCancel),s.showModal()),s.addEventListener("click",L),document.addEventListener("keydown",R,!0),ec=N,x.fit(),d.focus()}function Iu(e,t,i){const s=document.createElement("button");return s.className="diagram-lightbox__zoom-button",s.type="button",s.dataset.zoomAction=i,s.setAttribute("aria-label",t),s.textContent=e,s}class t8{constructor(t,i,s,o){this.viewport=t,this.svg=i,this.readout=s,this.baseSize=o,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=Gi.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,Gi.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Gi.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,i=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,s=Math.min(t/this.baseSize.width,i/this.baseSize.height),o=Math.floor(s*100),f=Gi.findIndex(c=>c>o),p=f===-1?Gi.length-1:Math.max(0,f-1);this.applyZoom(p),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-i)/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*(Bu(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Bu(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=Bu(this.zoomIndex),s=i/100;this.svg.setAttribute("width",so(this.baseSize.width*s)),this.svg.setAttribute("height",so(this.baseSize.height*s)),this.readout.textContent=`${i}%`}zoomAroundViewportCenter(t){const i=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,i.left+i.width/2,i.top+i.height/2)}zoomAroundPoint(t,i,s){if(t===this.zoomIndex)return;const o=this.svgWidth,f=this.svgHeight,p=this.viewport.getBoundingClientRect(),c=this.viewport.scrollLeft+i-p.left,h=this.viewport.scrollTop+s-p.top;this.applyZoom(t),this.viewport.scrollLeft=c/o*this.svgWidth-(i-p.left),this.viewport.scrollTop=h/f*this.svgHeight-(s-p.top)}onPointerDown=t=>{if(t.button!==0||wh(t.target))return;const i=t.pointerId??1;if(this.pointers.set(i,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:i},this.viewport.setPointerCapture?.(i)};onPointerMove=t=>{const i=t.pointerId??1;if(this.pointers.has(i)&&this.pointers.set(i,t),this.pinchStart&&this.pointers.size>=2){const s=this.pointerDistance()/this.pinchStart.distance,o=Bu(this.pinchStart.zoomIndex)*s;this.applyZoom(r8(o));return}!this.dragStart||this.dragStart.pointerId!==i||(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 i=t.pointerId??1;this.pointers.delete(i),this.viewport.releasePointerCapture?.(i),this.dragStart?.pointerId===i&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const i=t.deltaY<0?Math.min(this.zoomIndex+1,Gi.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{wh(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Gi.indexOf(200)?Gi.indexOf(100):Gi.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,i]=Array.from(this.pointers.values());return!t||!i?1:Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY)}}function n8(e){const t=nS(e.getAttribute("width")),i=nS(e.getAttribute("height"));if(t&&i)return{width:t,height:i};const s=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],o=s[2],f=s[3],p=o!==void 0&&Number.isFinite(o)&&o>0?o:null,c=f!==void 0&&Number.isFinite(f)&&f>0?f:null;return{width:t??p??800,height:i??c??600}}function i8(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:n8(e)}function nS(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)&&i>0?i:null}function so(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function r8(e){let t=0,i=Number.POSITIVE_INFINITY;return Gi.forEach((s,o)=>{const f=Math.abs(s-e);f<i&&(i=f,t=o)}),t}function Bu(e){return Gi[e]??Gi[0]}function s8(e,t){const i=e.getAttribute("id")??"";e.setAttribute("id",t);const s=e.querySelector("style");!i||!s?.textContent||(s.textContent=s.textContent.split(`#${i}`).join(`#${t}`))}function Pl(e){const t=ec;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),o8(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),ec=null,e&&t.trigger.isConnected&&t.trigger.focus())}function a8(e){const t=[];for(const i of Array.from(document.body.children))!(i instanceof HTMLElement)||i===e||(t.push({element:i,ariaHidden:i.getAttribute("aria-hidden"),inert:i.inert}),i.inert=!0,i.setAttribute("aria-hidden","true"));return t}function o8(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 l8(e,t){const i=Array.from(t.querySelectorAll(BD)).filter(h8);if(i.length===0){e.preventDefault(),t.focus();return}const s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function c8(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function wh(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!u8(t)}function u8(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function h8(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function OC(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 s;try{s=new URL(t)}catch{return null}return s.origin!==window.location.origin?null:OC(s.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const s=t.slice(7);let o;try{o=decodeURIComponent(s)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(o)?`/entry/${encodeURIComponent(o)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function d8(e){const t=HD.exec(e);if(!t)return null;const i=t[1]?.trim();if(!i)return null;const s=i.indexOf("/"),o=s>=0?i.slice(0,s):i,f=s>=0?i.slice(s+1).trim():"",p=o.trim().split(/[\s,]+/).filter(Boolean);if(p.length!==3)return null;const[c,h,d]=p;if(!c||!h||!d)return null;const _=jp(c,1),g=jp(h,.4),S=p8(d);if(_===null||g===null||S===null)return null;let C=1;if(s>=0){const T=jp(f,1);if(T===null)return null;C=T}return{L:_,C:g,h:S,alpha:C}}function f8(e){const t=e.h*Math.PI/180,i=e.C*Math.cos(t),s=e.C*Math.sin(t),o=e.L,f=o+.3963377774*i+.2158037573*s,p=o-.1055613458*i-.0638541728*s,c=o-.0894841775*i-1.291485548*s,h=f**3,d=p**3,_=c**3,g=4.0767416621*h-3.3077115913*d+.2309699292*_,S=-1.2684380046*h+2.6097574011*d-.3413193965*_,C=-.0041960863*h-.7034186147*d+1.707614701*_,T=Pu(Ip(g)),w=Pu(Ip(S)),m=Pu(Ip(C));if(e.alpha<1){const b=Pu(e.alpha);return`#${Ys(T)}${Ys(w)}${Ys(m)}${Ys(b)}`}return`#${Ys(T)}${Ys(w)}${Ys(m)}`}function jp(e,t){if(!e)return null;if(e.endsWith("%")){const s=Number(e.slice(0,-1));return Number.isFinite(s)?s/100*t:null}const i=Number(e);return Number.isFinite(i)?i:null}function p8(e){const t=$D.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function Ip(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 Pu(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function Ys(e){return e.toString(16).padStart(2,"0")}const g8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),m8=new Set(["img.shields.io"]),_8=/^[a-z][a-z0-9+.-]*:/i;function iS(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||_8.test(i))return null;const s=DC(i);if(!s)return null;const o=y8(s);return o===null?null:S8(o,t)}function v8(e){const t=DC(e).toLowerCase();return[...g8].some(i=>t.endsWith(i))}function rS(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function b8(e){try{const t=new URL(e);return t.protocol==="https:"&&m8.has(t.hostname)}catch{return!1}}function DC(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function y8(e){try{return decodeURI(e)}catch{return null}}function S8(e,t){const i=e.replace(/\\/g,"/"),s=t.replace(/\\/g,"/"),o=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",f=i.startsWith("/")?i:`${o}/${i}`,p=[];for(const c of f.split("/"))if(!(!c||c===".")){if(c===".."){if(p.length===0)return null;p.pop();continue}p.push(c)}return p.length>0?p.join("/"):null}function x8({content:e,onOpenPath:t,relativePath:i,theaterId:s,truncated:o}){const f=M.useMemo(()=>{const g=xh(e).html,S=new DOMParser().parseFromString(g,"text/html");return Bp(S.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:s}),S.body.innerHTML},[e,i,s]),p=M.useRef(null);M.useEffect(()=>{const g=p.current;if(!g)return;MC(g),Bp(g,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s});const S=new MutationObserver(()=>Bp(g,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s}));return S.observe(g,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>S.disconnect()},[f,i,s]);const c=M.useCallback(g=>{const S=g.target.closest('[data-action="copy-code"]');if(!S)return;const C=S.closest("pre")?.getAttribute("data-code");if(!C)return;navigator.clipboard?.writeText(C);const T=S.textContent;S.textContent="Copied",window.setTimeout(()=>{S.textContent=T},1200)},[]),h=M.useCallback(g=>{const C=g.target.closest("[data-fexp-open-path]");if(!C)return;const T=C.dataset.fexpOpenPath;T&&(g.preventDefault(),t(T))},[t]),d=M.useCallback(g=>{if(g.key!=="Enter"&&g.key!==" ")return;const C=g.target.closest("[data-fexp-open-path]");if(!C)return;const T=C.dataset.fexpOpenPath;T&&(g.preventDefault(),t(T))},[t]),_=M.useCallback(g=>{c(g),h(g)},[c,h]);return u.jsxs("div",{className:"fexp-md-wrap",children:[o&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:p,className:"markdown-body",onClick:_,onKeyDown:d,dangerouslySetInnerHTML:{__html:f}})]})}function Bp(e,t){for(const i of e.querySelectorAll("a[href]")){const s=i.getAttribute("href")??"",o=iS(s,t.currentRelativePath);o?(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("data-fexp-open-path",o),i.removeAttribute("aria-disabled")):s&&!/^(https?:|mailto:|#)/i.test(s)&&(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("aria-disabled","true"))}for(const i of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const s=i.getAttribute("src")??"",o=i.getAttribute("data-fexp-local-image-path");if(i.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&o&&s===rS(t.theaterId,o)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&b8(s)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const f=iS(s,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&f&&v8(f)){i.setAttribute("src",rS(t.theaterId,f)),i.setAttribute("data-fexp-local-image-path",f),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&w8(i)}}function w8(e){const t=e.getAttribute("alt")?.trim(),i=e.ownerDocument.createElement("span");i.className="fexp-md-blocked-image",i.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(i)}const C8=360,i_=248,r_=200,Ch=160,Eh=4;function E8(e){return e-r_-Eh>=Ch}function k8(e,t,i){const s=i-r_-Eh;return s<Ch?e:Math.max(Ch,Math.min(s,e-t))}function T8(e){const t=r_+Eh;return`minmax(0, 1fr) ${Eh}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function A8(e){return e?C8:null}const jC="fleet-console.file-explorer.treePaneWidth",s_={selectedPath:null,viewState:{kind:"none"}},R8={...s_,treePaneWidth:i_},IC=new Map,sS=new Map,Wg=new Set;let kh=D8();function L8(e){return M.useSyncExternalStore(O8,()=>N8(e),()=>R8)}function aS(e,t){e&&zC(e,{selectedPath:t})}function bs(e,t){e&&zC(e,{viewState:t})}function M8(e){kh=HC(e);try{localStorage.setItem(jC,String(kh))}catch{}BC()}function BC(){for(const e of Wg)e()}function PC(e){return IC.get(e)??s_}function N8(e){const t=e??"__none__",i=e!=null?PC(e):s_,s=sS.get(t);if(s&&s.selectedPath===i.selectedPath&&s.viewState===i.viewState&&s.treePaneWidth===kh)return s;const o={...i,treePaneWidth:kh};return sS.set(t,o),o}function zC(e,t){IC.set(e,{...PC(e),...t}),BC()}function O8(e){return Wg.add(e),()=>{Wg.delete(e)}}function D8(){try{return HC(Number(localStorage.getItem(jC)))}catch{return i_}}function HC(e){return!Number.isFinite(e)||e<=0?i_:Math.max(Ch,Math.round(e))}const j8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),I8={id:"file-explorer",title:"Files",icon:z8,render:e=>u.jsx(P8,{...e})};function B8(e){return{listFolder:async t=>{if(!e)throw new Error("no_theater");const i=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:t??""})});if(!i.ok){const s=await i.json();throw new Error(s.error??"list_failed")}return i.json()}}}function P8(e){const{theaterId:t}=e,{selectedPath:i,viewState:s,treePaneWidth:o}=L8(t),f=M.useRef(o);f.current=o;const p=M.useRef(null),[c,h]=M.useState(!1),d=M.useMemo(()=>B8(t),[t]),_=M.useCallback(async(w,m)=>{if(!t){bs(t,{kind:"error",message:"no_theater"});return}aS(t,w);const b=m??w.split("/").filter(Boolean).at(-1)??w,v=b.slice(b.lastIndexOf(".")).toLowerCase();if(j8.has(v)){const x=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(w)}`:"";bs(t,{kind:"image",relativePath:w,name:b,src:x});return}bs(t,{kind:"loading"});try{const x=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:w})});if(!x.ok){const L=await x.json();throw new Error(L.error??"read_failed")}const k=await x.json();if(k.binary){bs(t,{kind:"binary",name:b});return}bs(t,{kind:"code",relativePath:k.relativePath,content:k.content,lang:k.lang,truncated:k.truncated})}catch(x){const k=x instanceof Error?x.message:"Unable to load file";k==="binary_file"?bs(t,{kind:"binary",name:b}):bs(t,{kind:"error",message:k})}},[t]),g=M.useCallback(async w=>{w.kind==="file"&&await _(w.relativePath,w.name)},[_]),S=M.useCallback(()=>{bs(t,{kind:"none"}),aS(t,null)},[t]),C=M.useCallback(w=>{w.preventDefault();const m=p.current;if(!m)return;const b=m.getBoundingClientRect().width;if(!E8(b))return;const v=w.clientX,x=f.current;h(!0);const k=R=>{const N=R.clientX-v,A=k8(x,N,b);f.current=A,M8(A)},L=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",L),h(!1)};document.addEventListener("pointermove",k),document.addEventListener("pointerup",L)},[]),T=s.kind!=="none";return M.useLayoutEffect(()=>{e.requestExtraWidth?.(A8(T))},[e,T]),u.jsxs("div",{ref:p,className:`fexp-root${T?" is-split":" is-tree-only"}${c?" is-dragging":""}`,style:T?{gridTemplateColumns:T8(o)}:void 0,children:[T&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:s.kind!=="loading"&&s.kind!=="error"?"relativePath"in s?s.relativePath:s.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:S,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[s.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),s.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:s.message}),s.kind==="code"&&s.lang==="markdown"&&u.jsx(x8,{content:s.content,onOpenPath:_,relativePath:s.relativePath,theaterId:t,truncated:s.truncated}),s.kind==="code"&&s.lang!=="markdown"&&u.jsx(VN,{content:s.content,lang:s.lang,truncated:s.truncated}),s.kind==="image"&&u.jsx(ZN,{src:s.src,name:s.name}),s.kind==="binary"&&u.jsx(BN,{name:s.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:C,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(jN,{files:d,theaterId:t,selectedPath:i,onSelect:g})})]})}function z8(){return u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:u.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 H8={id:"file-explorer",railPanels:[I8]},$8=[H8],U8={M:"M",A:"A",D:"D",R:"R",U:"U"};function F8(e){const t={dirs:{},files:[]};for(const i of e){const s=i.path.split("/");s.pop();let o=t;for(const f of s)o.dirs[f]||(o.dirs[f]={dirs:{},files:[]}),o=o.dirs[f];o.files.push(i)}return t}function W8({files:e,selectedPath:t,onSelect:i}){const s=F8(e);return u.jsx($C,{node:s,depth:0,selectedPath:t,onSelect:i})}function $C({node:e,depth:t,selectedPath:i,onSelect:s}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([o,f])=>u.jsx(G8,{dirKey:o,node:f,depth:t,selectedPath:i,onSelect:s},o)),e.files.map(o=>u.jsx(q8,{entry:o,depth:t,selectedPath:i,onSelect:s},o.path))]})}function G8({dirKey:e,node:t,depth:i,selectedPath:s,onSelect:o}){const[f,p]=M.useState(!1),c=M.useCallback(()=>p(g=>!g),[]);let h=e,d=t;for(;Object.keys(d.dirs).length===1&&d.files.length===0;){const g=Object.keys(d.dirs)[0];h+="/"+g,d=d.dirs[g]}const _=i*16+12;return u.jsxs("div",{className:`diff-folder${f?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-folder-row",style:{paddingLeft:`${_}px`},onClick:c,"aria-expanded":!f,children:[u.jsx("svg",{className:"diff-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"diff-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.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"})}),u.jsx("span",{className:"diff-folder-name",children:h})]}),!f&&u.jsx($C,{node:d,depth:i+1,selectedPath:s,onSelect:o})]})}function q8({entry:e,depth:t,selectedPath:i,onSelect:s}){const o=e.path===i,f=M.useCallback(()=>s(e),[e,s]),p=t*16+12,c=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`diff-file-row${o?" is-cur":""}`,style:{paddingLeft:`${p}px`},title:e.path,onClick:f,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:U8[e.status]??e.status}),u.jsx("span",{className:"diff-file-name",children:u.jsx("span",{className:"diff-file-fn",children:c})}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const oS="fleet-console.diff.changesCollapsed",K8={M:"modified",A:"added",D:"deleted",R:"renamed",U:"untracked"};function V8(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function Y8({ctx:e,viewMode:t,selectedPath:i,subPath:s,onSelect:o}){const[f,p]=M.useState({kind:"loading"}),[c,h]=M.useState(0),[d,_]=M.useState(()=>V8(oS));M.useEffect(()=>{if(!e.theaterId){p({kind:"error",message:"no_theater"});return}let C=!1;return p({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:s})}).then(async T=>{if(!T.ok){const b=(await T.json()).error??"git_failed";C||p(b==="no_git_repo"||b==="git_unavailable"?{kind:"notice",reason:b}:{kind:"error",message:b});return}const w=await T.json();C||p({kind:"ok",files:w.files})}).catch(T=>{C||p({kind:"error",message:T instanceof Error?T.message:"unknown"})}),()=>{C=!0}},[e.theaterId,s,c]);const g=M.useCallback(()=>h(C=>C+1),[]),S=M.useCallback(()=>{_(C=>{const T=!C;try{localStorage.setItem(oS,T?"1":"0")}catch{}return T})},[]);if(f.kind==="loading")return u.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(f.kind==="notice"){const C=f.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",T=f.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 u.jsxs("div",{className:"diff-sections-notice",children:[u.jsx("strong",{className:"diff-notice-title",children:C}),u.jsx("span",{className:"diff-notice-body",children:T}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:g,children:"Retry"})]})}return f.kind==="error"?u.jsxs("div",{className:"diff-sections-error",children:[u.jsx("span",{children:f.message}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:g,children:"Retry"})]}):u.jsx("div",{className:"diff-sections",children:u.jsxs("div",{className:`diff-section${d?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-section-head",onClick:S,children:[u.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-section-name",children:"Changes"}),u.jsx("span",{className:"diff-count-badge",children:f.files.length})]}),!d&&u.jsx("div",{className:"diff-section-rows",children:f.files.length===0?u.jsx("div",{className:"diff-empty-row",children:"No changes"}):t==="tree"?u.jsx(W8,{files:f.files,selectedPath:i,onSelect:o}):f.files.map(C=>u.jsx(X8,{entry:C,isSelected:C.path===i,onSelect:o},C.path))})]})})}function X8({entry:e,isSelected:t,onSelect:i}){const s=M.useCallback(()=>i(e),[e,i]),o=e.path.endsWith("/")?e.path.slice(0,-1):e.path,f=o.lastIndexOf("/"),p=f>=0?o.slice(0,f+1):"",c=(f>=0?o.slice(f+1):o)+(e.path.endsWith("/")?"/":"");return u.jsxs("button",{type:"button",className:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":K8[e.status]??e.status,children:e.status}),u.jsxs("span",{className:"diff-file-name",children:[u.jsx("span",{className:"diff-file-fn",children:c}),p&&u.jsx("span",{className:"diff-file-dir",children:p})]}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const Gg=new Set;let la={file:null,commit:null};function Gh(){for(const e of Gg)e()}function UC(e){return Gg.add(e),()=>{Gg.delete(e)}}function Th(){return la}function Z8(e){const t=M.useSyncExternalStore(UC,Th,Th);return!t.file||t.file.theaterId!==e?null:t.file}function FC(e){const t=M.useSyncExternalStore(UC,Th,Th);return!t.commit||t.commit.theaterId!==e?null:t.commit}function J8(e,t,i){la={file:{entry:e,subPath:t,theaterId:i},commit:null},Gh()}function Q8(e,t,i){la={file:null,commit:{commit:e,subPath:t,theaterId:i}},Gh()}function Pp(){la={file:null,commit:la.commit},Gh()}function zp(){la={file:la.file,commit:null},Gh()}const qg=12,Xa=20,Hp=3,e7=5;function Nl(e){return e*qg+6}function t7({node:e,laneCount:t,collapsed:i=!1}){const s=Math.max(t,1),o=i?10:0,f=s*qg+o,p=Nl(e.lane),c=Xa/2;return u.jsxs("svg",{width:f,height:Xa,viewBox:`0 0 ${f} ${Xa}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(h=>u.jsx("line",{x1:Nl(h),y1:0,x2:Nl(h),y2:Xa,stroke:"var(--ink-rim)",strokeWidth:1.5},`pt-${h}`)),e.connectAbove&&u.jsx("line",{x1:p,y1:0,x2:p,y2:c-Hp,stroke:"var(--ink-rim)",strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:p,y1:c+Hp,x2:p,y2:Xa,stroke:"var(--ink-rim)",strokeWidth:1.5}),e.mergeFromLanes.map(h=>u.jsx("line",{x1:Nl(h),y1:0,x2:p,y2:c,stroke:"var(--ink-rim)",strokeWidth:1.5,strokeLinecap:"round"},`mf-${h}`)),e.branchToLanes.map(h=>u.jsx("line",{x1:p,y1:c,x2:Nl(h),y2:Xa,stroke:"var(--ink-rim)",strokeWidth:1.5,strokeLinecap:"round"},`bt-${h}`)),e.isHead&&u.jsx("circle",{cx:p,cy:c,r:e7,fill:"none",stroke:"var(--brass)",strokeWidth:1.5}),u.jsx("circle",{cx:p,cy:c,r:Hp,fill:e.isHead?"var(--brass)":"var(--ink-fog)"}),i&&u.jsx("text",{x:s*qg+2,y:c+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const lS=3;function n7(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],i=[];let s=!1,o=0;for(let f=0;f<e.length;f++){const p=e[f],c=p.fullHash,h=[...p.parents],d=[];for(let w=0;w<t.length;w++)t[w]===c&&d.push(w);let _;const g=[];if(d.length===0){const w=t.indexOf(null);w>=0?_=w:(_=t.length,t.push(null))}else{_=Math.min(...d);for(const w of d)w!==_&&(g.push(w),t[w]=null)}const S=[];if(h.length===0)t[_]=null;else{t[_]=h[0]??null;for(const w of h.slice(1))if(!(t.indexOf(w)>=0)){const b=t.indexOf(null);if(b>=0)t[b]=w,S.push(b);else{const v=t.length;t.push(w),S.push(v)}}}const C=t.map((w,m)=>({h:w,i:m})).filter(({h:w})=>w!==null).map(({i:w})=>w);if(C.length>lS){s=!0;const w=C.filter(m=>m!==_).sort((m,b)=>b-m).slice(0,C.length-lS);for(const m of w){t[m]=null;const b=S.indexOf(m);b>=0&&S.splice(b,1)}}const T=t.map((w,m)=>({h:w,i:m})).filter(({h:w,i:m})=>w!==null&&m!==_).map(({i:w})=>w);o=Math.max(o,_,...S,...T),i.push({lane:_,isHead:p.refs.some(w=>w==="HEAD"||w.startsWith("HEAD ->"))||f===0,connectAbove:f>0,connectBelow:f<e.length-1,passThroughLanes:T,mergeFromLanes:g,branchToLanes:S})}return{nodes:i,activeLaneCount:o+1,collapsed:s}}function i7(e){const t=[];for(const i of e.refs)i==="HEAD"?t.push({label:"HEAD",kind:"head"}):i.startsWith("tag: ")?t.push({label:i.slice(5),kind:"tag"}):i.startsWith("refs/worktrees/")?t.push({label:i.slice(15),kind:"worktree"}):i.startsWith("refs/heads/")?t.push({label:i.slice(11),kind:"branch"}):t.push({label:i,kind:"branch"});return t}const cS="fleet-console.diff.historyCollapsed";function r7(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function s7({entry:e,isCur:t,onClick:i,graphNode:s,laneCount:o=0,layoutCollapsed:f=!1}){const p=M.useCallback(()=>i(e),[e,i]),c=i7(e);return u.jsxs("button",{type:"button",className:`diff-commit-row${t?" is-cur":""}`,onClick:p,children:[u.jsx("span",{className:"diff-graph-gutter","aria-hidden":"true",children:s?u.jsx(t7,{node:s,laneCount:o,collapsed:f}):null}),u.jsx("span",{className:"diff-commit-sha",children:e.shortHash}),u.jsx("span",{className:"diff-commit-subject",children:e.subject}),c.length>0&&u.jsx("span",{className:"diff-commit-badges",children:c.map((h,d)=>u.jsx("span",{className:`diff-badge badge--${h.kind}`,children:h.label},d))}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]}),u.jsxs("span",{className:"diff-commit-meta",children:[e.authorName," · ",e.relTime]})]})}function a7({ctx:e,subPath:t,refreshToken:i=0,graphMode:s="flat"}){const[o,f]=M.useState({kind:"loading"}),[p,c]=M.useState(()=>r7(cS)),[h,d]=M.useState(0),_=FC(e.theaterId??null);M.useEffect(()=>{if(!e.theaterId){f({kind:"ok",commits:[]});return}let b=!1;return f({kind:"loading"}),e.api.fetch("diff","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:t})}).then(async v=>{if(!v.ok){const L=(await v.json()).error??"unknown";b||f(L==="git_unavailable"?{kind:"ok",commits:[]}:{kind:"error",message:L});return}const x=await v.json();b||f({kind:"ok",commits:x.commits})}).catch(v=>{b||f({kind:"error",message:v instanceof Error?v.message:"unknown"})}),()=>{b=!0}},[e.theaterId,e.api,t,i,h]);const g=M.useCallback(()=>{c(b=>{const v=!b;try{localStorage.setItem(cS,v?"1":"0")}catch{}return v})},[]),S=M.useCallback(()=>d(b=>b+1),[]),C=M.useCallback(b=>{e.theaterId&&Q8(b,t,e.theaterId)},[e.theaterId,t]),T=o.kind==="ok"?o.commits.length:0,w=o.kind==="ok"&&s==="graph"?n7(o.commits):null,m=w?.collapsed??!1;return u.jsxs("div",{className:`diff-section diff-section-history${p?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-section-head",onClick:g,children:[u.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-section-name",children:"History"}),o.kind==="ok"&&u.jsx("span",{className:"diff-count-badge",children:T})]}),!p&&u.jsxs("div",{className:"diff-section-rows",children:[o.kind==="loading"&&u.jsx("div",{className:"diff-empty-row",children:"Loading…"}),o.kind==="error"&&u.jsxs("div",{className:"diff-sections-error",children:[u.jsx("span",{children:o.message}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]}),o.kind==="ok"&&o.commits.length===0&&u.jsx("div",{className:"diff-empty-row",children:"No history"}),o.kind==="ok"&&o.commits.map((b,v)=>u.jsx(s7,{entry:b,isCur:_?.commit.fullHash===b.fullHash,onClick:C,graphNode:w?w.nodes[v]??null:null,laneCount:w?w.activeLaneCount:0,layoutCollapsed:m},b.fullHash))]})]})}const o7=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,l7=/^diff --git a\/(.+) b\/(.+)$/;function c7(e){if(!e)return[];const t=e.split(`
214
+ `);t[t.length-1]===""&&t.pop();const i=[];let s=0,o=0,f=!0;for(const p of t)if(!p.startsWith("\\")){if(p.startsWith("diff --git ")){const c=l7.exec(p),h=c?.[1],d=c?.[2]??p,_=h!==void 0&&h!==d?h:void 0;i.push({kind:"file-label",text:d,oldPath:_}),f=!0;continue}if(f){if(p.startsWith("index ")||p.startsWith("--- ")||p.startsWith("+++ ")||p.startsWith("new file mode")||p.startsWith("deleted file mode")||p.startsWith("old mode")||p.startsWith("new mode")||p.startsWith("rename from ")||p.startsWith("rename to ")||p.startsWith("similarity index")||p.startsWith("dissimilarity index"))continue;if(!p.startsWith("@@")){p!==""&&i.push({kind:"ctx",text:` ${p}`});continue}}if(p.startsWith("@@")){f=!1;const c=o7.exec(p);if(c){s=parseInt(c[1]??"0",10),o=parseInt(c[2]??"0",10);const h=c[3]?.trimEnd()??"",d=`@@ -${c[1]??""} +${c[2]??""} @@${h?` ${h.trimStart()}`:""}`;i.push({kind:"hunk-label",text:d})}else i.push({kind:"hunk-label",text:p});continue}p.startsWith("+")?i.push({kind:"add",text:p,newLine:o++}):p.startsWith("-")?i.push({kind:"del",text:p,oldLine:s++}):i.push({kind:"ctx",text:p,oldLine:s++,newLine:o++})}return i}function $p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uS({ctx:e,file:t,mode:i,subPath:s,commit:o}){const[f,p]=M.useState({kind:"loading"});if(M.useEffect(()=>{if(!e.theaterId){p({kind:"error",message:"no_theater"});return}let _=!1;return p({kind:"loading"}),o?e.api.fetch("diff","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:o.theaterId,ref:o.commit.fullHash,subPath:o.subPath})}).then(async g=>{const S=await g.json();_||p({kind:"ok",result:S})}).catch(g=>{_||p({kind:"error",message:g instanceof Error?g.message:"unknown"})}):e.api.fetch("diff","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,filePath:t.path,mode:i,subPath:s})}).then(async g=>{const S=await g.json();_||p({kind:"ok",result:S})}).catch(g=>{_||p({kind:"error",message:g instanceof Error?g.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,t.path,i,s,o]),f.kind==="loading")return u.jsx("div",{className:"diff-hunk-loading",children:"Loading…"});if(f.kind==="error")return u.jsx("div",{className:"diff-hunk-error",children:f.message});const{result:c}=f,h=c7(c.content),d=o?h:h.filter(_=>_.kind!=="file-label");return u.jsxs("div",{className:"diff-hunk-wrap",children:[c.truncated&&u.jsx("div",{className:"diff-truncated-badge",children:"Diff truncated"}),u.jsx("div",{className:"diff-hunk-scroll",children:u.jsx("table",{className:"diff-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:d.map((_,g)=>u.jsx("tr",{className:`diff-line diff-line-${_.kind}`,children:_.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:$p(_.text)}}):_.kind==="file-label"?u.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:$p(_.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"diff-gutter diff-gutter-old",children:_.oldLine??""}),u.jsx("td",{className:"diff-gutter diff-gutter-new",children:_.newLine??""}),u.jsx("td",{className:"diff-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),u.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:$p(_.text.length>0?_.text.slice(1):_.text)}})]})},g))})})})]})}const Ah=140,tc=4,u7=null;function h7({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:s,hunkPaneMinWidth:o,dividerWidth:f}){const p=i-o-f;return p<s?u7:Math.max(s,Math.min(p,e-t))}function d7(e){const t=Ah+tc;return`minmax(0, 1fr) ${tc}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function f7(e){const t=new Map;for(const o of e)if(o.worktreeOf!==void 0){const f=t.get(o.worktreeOf)??[];f.push(o),t.set(o.worktreeOf,f)}const i=e.filter(o=>o.worktreeOf===void 0);return{groups:i.map(o=>({repo:o,worktrees:t.get(o.relPath)??[]})),topLevelCount:i.length}}function p7(e,t){if(t==="")return e;const i=e.replace(/\\/g,"/"),o=t.replace(/\\/g,"/")+"/";return i.startsWith(o)?i.slice(o.length):i}const WC="fleet-console.diff.viewMode",GC="fleet-console.diff.listPaneWidth",qC="fleet-console.diff.depth",KC="fleet-console.diff.repo.",VC="fleet-console.diff.historyGraphMode",g7=400,YC=248,Rh=220,m7=3,_7=[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"},{value:8,label:"Max"}];function v7(){try{const e=localStorage.getItem(WC);if(e==="list"||e==="tree")return e}catch{}return"list"}function b7(){try{const e=localStorage.getItem(GC);if(e!==null){const t=parseFloat(e);if(Number.isFinite(t)&&t>0)return w7(t)}}catch{}return YC}function y7(){try{const e=localStorage.getItem(qC);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=1)return t}}catch{}return m7}function S7(){try{const e=localStorage.getItem(VC);if(e==="flat"||e==="graph")return e}catch{}return"flat"}function hS(e){try{return localStorage.getItem(KC+e)??""}catch{return""}}function x7(e,t){try{localStorage.setItem(KC+e,t)}catch{}}function w7(e){const t=typeof window>"u"?YC:window.innerWidth-Ah-tc,i=Math.max(Rh,t);return Math.max(Rh,Math.min(i,e))}function C7(e){return e.entry.status==="U"?"untracked":"unified"}function E7(e){return e.split("/").filter(Boolean).pop()??e}function k7({repos:e,loading:t,truncated:i,activeSubPath:s,depth:o,onSelect:f,onDepthChange:p,onRescan:c,onClose:h}){const{groups:d,topLevelCount:_}=f7(e),g=M.useCallback(S=>{S.stopPropagation();const C=parseInt(S.target.value,10);isNaN(C)||p(C)},[p]);return u.jsxs("div",{className:"diff-repo-menu",role:"listbox","aria-label":"Repositories",onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"diff-repo-menu-eyebrow",children:[u.jsx("span",{children:"REPOSITORIES"}),!t&&u.jsxs("span",{children:[_," found · depth ",o]})]}),u.jsxs("div",{className:"diff-repo-menu-scroll",children:[t?u.jsxs("div",{className:"diff-repo-scan",children:[u.jsx("span",{className:"diff-repo-spin","aria-hidden":"true"}),"Scanning to depth ",o,"…"]}):e.length===0?u.jsxs("div",{className:"diff-repo-empty",children:["No Git repositories within depth ",o,"."]}):d.map(({repo:S,worktrees:C})=>{const T=S.relPath===s,w=S.isWorktree===!0&&S.worktreeOf===void 0;return u.jsxs("div",{className:"diff-repo-group",children:[u.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`diff-repo-opt${T?" is-cur":""}`,onClick:()=>{f(S.relPath),h()},children:[u.jsx("svg",{className:"diff-repo-mark",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:T&&u.jsx("path",{d:"M3 7.5L6 10.5L11 4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsxs("span",{children:[u.jsxs("span",{className:"diff-repo-line1",children:[u.jsx("span",{className:"diff-repo-opt-name",children:S.name}),u.jsxs("span",{className:"diff-repo-branch",children:[u.jsx(Kg,{}),u.jsx("span",{children:S.branch})]}),S.relPath===""&&u.jsx("span",{className:"diff-repo-badge diff-repo-badge--root",children:"ROOT"}),w&&u.jsx("span",{className:"diff-repo-badge diff-repo-badge--worktree",children:"WORKTREE"})]}),u.jsx("span",{className:"diff-repo-opt-path",children:S.relPath===""?"· Theater root":S.relPath})]})]}),C.length>0&&u.jsx("div",{className:"diff-repo-children",role:"group",children:C.map(m=>{const b=m.relPath===s,v=p7(m.relPath,S.relPath);return u.jsx("div",{className:"diff-repo-child-row",children:u.jsxs("button",{type:"button",role:"option","aria-selected":b,className:`diff-repo-opt diff-repo-child-opt${b?" is-cur":""}`,onClick:()=>{f(m.relPath),h()},children:[u.jsx("svg",{className:"diff-repo-mark",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b&&u.jsx("path",{d:"M3 7.5L6 10.5L11 4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsxs("span",{children:[u.jsxs("span",{className:"diff-repo-line1",children:[u.jsx("span",{className:"diff-repo-opt-name",children:m.name}),u.jsxs("span",{className:"diff-repo-branch",children:[u.jsx(Kg,{}),u.jsx("span",{children:m.branch})]}),u.jsx("span",{className:"diff-repo-badge diff-repo-badge--worktree",children:"WORKTREE"})]}),u.jsx("span",{className:"diff-repo-opt-path",children:v})]})]})},m.relPath)})})]},S.relPath)}),!t&&i&&u.jsx("div",{className:"diff-repo-truncated",children:"List capped — reduce depth to see all repos."})]}),u.jsxs("div",{className:"diff-repo-menu-foot",children:[u.jsxs("label",{className:"diff-repo-depth",children:["Depth",u.jsx("select",{value:o,onChange:g,onClick:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),children:_7.map(S=>u.jsx("option",{value:S.value,children:S.label},S.value))})]}),u.jsx("button",{type:"button",className:"diff-repo-rescan",onClick:S=>{S.stopPropagation(),c()},children:"⟳ Rescan"})]})]})}function T7(){return u.jsx("svg",{className:"fico",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.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"})})}function Kg(){return u.jsxs("svg",{className:"bico",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:[u.jsx("circle",{cx:"3",cy:"3",r:"1.6",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"3",cy:"9",r:"1.6",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"9",cy:"3.4",r:"1.6",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M3 4.6v2.8M4.4 3.2H7",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round"}),u.jsx("path",{d:"M7.4 4.8C6.4 5.4 4.4 5.6 3.6 7",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round"})]})}function A7(){return u.jsx("svg",{className:"chev",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function R7({ctx:e}){const[t,i]=M.useState(v7),[s,o]=M.useState(S7),f=Z8(e.theaterId??null),p=FC(e.theaterId??null),[c,h]=M.useState(b7),d=M.useRef(c),_=M.useRef(null),[g,S]=M.useState(!1),[C,T]=M.useState(()=>e.theaterId?hS(e.theaterId):""),[w,m]=M.useState(y7),[b,v]=M.useState([]),[x,k]=M.useState(!1),[L,R]=M.useState(!1),[N,A]=M.useState(!1),I=M.useRef(0),K=M.useRef(w);K.current=w;const F=M.useCallback(Z=>{if(!e.theaterId)return;const H=++I.current;k(!0),fetch("/plugins/diff/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:Z})}).then(async oe=>{if(H!==I.current)return;if(!oe.ok){k(!1);return}const fe=await oe.json();if(H!==I.current)return;const Se=fe.repos;v(Se),A(fe.truncated??!1),k(!1)}).catch(()=>{H===I.current&&k(!1)})},[e.theaterId]);M.useEffect(()=>{if(!e.theaterId)return;const Z=hS(e.theaterId);T(Z),v([]),A(!1),R(!1),Pp(),zp(),F(K.current)},[e.theaterId,F]);const G=M.useCallback(Z=>{Z.stopPropagation(),R(H=>!H)},[]),B=M.useCallback(()=>R(!1),[]),Y=M.useCallback(Z=>{Z!==C&&(T(Z),e.theaterId&&x7(e.theaterId,Z),Pp(),zp())},[C,e.theaterId]),W=M.useCallback(Z=>{m(Z);try{localStorage.setItem(qC,String(Z))}catch{}F(Z)},[F]),z=M.useCallback(()=>{F(w)},[F,w]);M.useEffect(()=>{if(!L)return;const Z=()=>R(!1);return document.addEventListener("click",Z),()=>document.removeEventListener("click",Z)},[L]),M.useEffect(()=>{if(!L)return;const Z=H=>{H.key==="Escape"&&R(!1)};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[L]);const V=M.useCallback(Z=>{e.theaterId&&J8(Z,C,e.theaterId)},[e.theaterId,C]),X=M.useCallback(()=>{Pp(),zp()},[]),j=M.useCallback(Z=>{i(Z);try{localStorage.setItem(WC,Z)}catch{}},[]),P=M.useCallback(Z=>{o(Z);try{localStorage.setItem(VC,Z)}catch{}},[]),D=M.useCallback(Z=>{Z.preventDefault();const H=_.current;if(!H)return;const oe=H.getBoundingClientRect().width,fe=Z.clientX,Se=d.current;if(oe-Ah-tc<Rh)return;S(!0);const De=Be=>{const Ke=Be.clientX-fe,ke=h7({startWidth:Se,dx:Ke,containerWidth:oe,listPaneMinWidth:Rh,hunkPaneMinWidth:Ah,dividerWidth:tc});ke!==null&&(d.current=ke,h(ke))},Fe=()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",Fe),S(!1);try{localStorage.setItem(GC,String(d.current))}catch{}};document.addEventListener("pointermove",De),document.addEventListener("pointerup",Fe)},[]);M.useLayoutEffect(()=>{e.requestExtraWidth?.(f||p?g7:null)},[e,f,p]);const U=b.find(Z=>Z.relPath===C)??null,q=U?.name??(C===""?"Working tree":E7(C)||"Working tree"),Q=U?.branch??null,re=f?C7(f):"unified",ie=!!(f||p);return u.jsxs("div",{ref:_,className:`diff-root${ie?" has-hunk":""}${g?" is-dragging":""}`,style:ie?{gridTemplateColumns:d7(c)}:void 0,children:[ie&&u.jsxs("div",{className:"diff-hunk-pane",children:[u.jsxs("div",{className:"diff-hunk-head",children:[p?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"diff-hunk-commit-icon","aria-hidden":"true",children:"⊙"}),u.jsx("span",{className:"diff-hunk-sha",children:p.commit.shortHash}),u.jsx("span",{className:"diff-hunk-filename",children:p.commit.subject})]}):f?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:`diff-status-glyph diff-status-${f.entry.status.toLowerCase()}`,children:f.entry.status}),u.jsx("span",{className:"diff-hunk-filename",children:f.entry.path}),u.jsxs("span",{className:"diff-nums",children:[f.entry.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",f.entry.additions]}),f.entry.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",f.entry.deletions]})]})]}):null,u.jsx("button",{type:"button",className:"diff-hunk-close","aria-label":"Close diff",onClick:X,children:"✕"})]}),u.jsx("div",{className:"diff-hunk-body",children:p?u.jsx(uS,{ctx:e,file:{path:"",status:"M",additions:0,deletions:0},mode:"unified",subPath:p.subPath,commit:p}):f?u.jsx(uS,{ctx:e,file:f.entry,mode:re,subPath:f.subPath}):null})]}),ie&&u.jsx("div",{className:"diff-divider",onPointerDown:D,"aria-hidden":"true"}),u.jsxs("div",{className:"diff-tree-pane",children:[u.jsxs("div",{className:"diff-plugin-toolbar",children:[u.jsxs("button",{type:"button",className:"diff-repo-trigger","aria-haspopup":"listbox","aria-expanded":L,onClick:G,children:[u.jsx(T7,{}),u.jsx("span",{className:"nm",children:q}),Q&&u.jsxs("span",{className:"brc",children:[u.jsx(Kg,{}),u.jsx("span",{className:"bnm",children:Q})]}),u.jsx(A7,{})]}),u.jsxs("div",{className:"diff-view-toggle",children:[u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="list"?" is-active":""}`,title:"List view","aria-pressed":t==="list",onClick:()=>j("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":t==="tree",onClick:()=>j("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]}),u.jsxs("div",{className:"diff-graph-toggle",children:[u.jsx("button",{type:"button",className:`diff-toggle-btn${s==="flat"?" is-active":""}`,title:"Flat history","aria-pressed":s==="flat",onClick:()=>P("flat"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"3",y1:"4",x2:"3",y2:"10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("circle",{cx:"3",cy:"4",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"3",cy:"7",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"3",cy:"10",r:"1.5",fill:"currentColor"}),u.jsx("line",{x1:"6",y1:"4",x2:"12",y2:"4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("line",{x1:"6",y1:"7",x2:"11",y2:"7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("line",{x1:"6",y1:"10",x2:"10",y2:"10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`diff-toggle-btn${s==="graph"?" is-active":""}`,title:"Graph history","aria-pressed":s==="graph",onClick:()=>P("graph"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"3",y1:"2",x2:"3",y2:"12",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("line",{x1:"8",y1:"5",x2:"8",y2:"12",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3 5 Q5 5 8 5",stroke:"currentColor",strokeWidth:"1.2",fill:"none",strokeLinecap:"round"}),u.jsx("circle",{cx:"3",cy:"3",r:"1.8",fill:"currentColor"}),u.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"3",cy:"11.5",r:"1.5",fill:"currentColor"})]})})]})]}),u.jsx(Y8,{ctx:e,viewMode:t,selectedPath:f?.entry.path??null,subPath:C,onSelect:V}),u.jsx(a7,{ctx:e,subPath:C,graphMode:s}),L&&u.jsx(k7,{theaterId:e.theaterId??"",repos:b,loading:x,truncated:N,activeSubPath:C,depth:w,onSelect:Y,onDepthChange:W,onRescan:z,onClose:B})]})]})}function L7(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("line",{x1:"14",y1:"2",x2:"14",y2:"16",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("polyline",{points:"12,4 14,2 16,4",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),u.jsx("polyline",{points:"12,14 14,16 16,14",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})}const M7={id:"diff",title:"Diff",icon:()=>u.jsx(L7,{}),render:e=>u.jsx(R7,{ctx:e})},N7={id:"diff",railPanels:[M7]},O7=[N7],zu=["claude-code","codex","cursor","opencode"],D7={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},j7="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function I7({source:e,skill:t,theaterId:i,onCancel:s,onStarted:o,jobLog:f}){const[p,c]=M.useState(i?"project":"global"),[h,d]=M.useState(!0),[_,g]=M.useState(new Set(zu)),{status:S,start:C}=f,T=S==="running",w=S==="done",m=S==="error",b=M.useCallback(()=>{d(!0),g(new Set(zu))},[]),v=M.useCallback(k=>{d(!1),g(L=>{const R=new Set(L);return R.has(k)?R.delete(k):R.add(k),R})},[]),x=M.useCallback(()=>{const k=h?zu:Array.from(_);if(k.length===0)return;const L={source:e,skill:t,scope:p,agents:k};p==="project"&&i&&(L.theaterId=i),C("/plugins/skills/install",L),o(p)},[h,_,e,t,p,i,C,o]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${p==="project"?" is-active":""}`,onClick:()=>c("project"),disabled:!i||T||w,title:i?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${p==="global"?" is-active":""}`,onClick:()=>c("global"),disabled:T||w,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${h?" is-active":""}`,onClick:b,disabled:T||w,children:"All agents"}),zu.map(k=>u.jsx("button",{type:"button",className:`skills-agent-chip${!h&&_.has(k)?" is-active":""}`,onClick:()=>v(k),disabled:T||w,children:D7[k]},k))]}),u.jsx("p",{className:"skills-permission-warning",children:j7}),!T&&!w&&!m&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:s,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:x,disabled:!h&&_.size===0,children:"Install now"})]})]})}const B7=4e3;function XC({status:e,lines:t,runningLabel:i,doneLabel:s,errorLabel:o,onDismiss:f,onRetry:p}){const[c,h]=M.useState(!1),d=M.useRef(null),_=M.useRef(null);M.useEffect(()=>{e==="running"&&h(!1)},[e]),M.useEffect(()=>{const m=d.current;m&&(m.scrollTop=m.scrollHeight)},[t]),M.useEffect(()=>{if(e==="done")return _.current=setTimeout(()=>{h(!1),f()},B7),()=>{_.current&&(clearTimeout(_.current),_.current=null)}},[e,f]);const g=M.useCallback(()=>{_.current&&(clearTimeout(_.current),_.current=null),h(!1),f()},[f]),S=M.useCallback(()=>h(m=>!m),[]);if(e==="idle")return null;const C=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",T=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",w=e==="running"?i:e==="done"?s:o;return u.jsxs("div",{className:"skills-dock",children:[c&&u.jsxs("div",{ref:d,className:"skills-dock-log",children:[t.map((m,b)=>u.jsx("div",{className:"skills-dock-log-line",children:m},b)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",s]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",o]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${c?" is-open":""}`,"aria-expanded":c,onClick:S,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),S())},children:[u.jsx("span",{className:C,"aria-hidden":"true"}),u.jsx("span",{className:T,"aria-live":"polite",children:w}),e==="running"&&t.length>0&&u.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:m=>{m.stopPropagation(),g()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[p!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:m=>{m.stopPropagation(),p()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:m=>{m.stopPropagation(),g()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${c?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const P7={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,updateJobId:null,updateJobScope:null,installFormOpenId:null},Vg=new Set;let ti=P7;function ua(){for(const e of Vg)e()}function z7(e){return Vg.add(e),()=>{Vg.delete(e)}}function dS(){return ti}function a_(){return M.useSyncExternalStore(z7,dS,dS)}function Hu(e){ti={...ti,activeTab:e},ua()}function fS(e){ti={...ti,scope:e},ua()}function H7(e){ti={...ti,filterText:e},ua()}function $7(e){ti={...ti,searchQuery:e},ua()}function to(e,t){ti={...ti,searchResults:e,searchLoading:t},ua()}function Up(e,t){ti={...ti,installedList:e,installedLoading:t},ua()}function Yg(e){ti={...ti,installFormOpenId:e},ua()}const pS=750;function ZC(){const[e,t]=M.useState({status:"idle",lines:[]}),i=M.useRef(null),s=M.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);M.useEffect(()=>()=>s(),[s]);const o=M.useCallback(()=>{s(),t({status:"idle",lines:[]})},[s]),f=M.useCallback((p,c)=>{s(),t({status:"running",lines:[]}),(async()=>{const h=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).catch(()=>null);if(!h?.ok){t({status:"error",lines:[]});return}const{jobId:d}=await h.json();let _=0;const g=async()=>{const S=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(d)}&cursor=${_}`).catch(()=>null);if(!S?.ok){t(T=>({...T,status:"error"}));return}const C=await S.json();_=C.nextCursor,t(T=>({...T,lines:[...T.lines,...C.lines]})),C.status==="running"?i.current=setTimeout(()=>{g()},pS):t(T=>({...T,status:C.status}))};i.current=setTimeout(()=>{g()},pS)})()},[s]);return{...e,start:f,reset:o}}const U7=300,Qu=2;function F7(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function W7(e){if(e.length<Qu){to([],!1);return}to([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){to([],!1);return}const i=await t.json();to(i.skills??[],!1)}catch{to([],!1)}}function G7({result:e,theaterId:t,isFormOpen:i,onInstallClick:s,onReadMore:o,onInstallStarted:f,jobLog:p}){const c={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${i?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>o(c,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:F7(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:s,children:i?"Cancel":"Install"})}),i&&u.jsx(I7,{source:e.source,skill:e.name,theaterId:t,onCancel:s,onStarted:h=>f(e.name,h),jobLog:p})]})}function q7({theaterId:e,onReadMore:t,onInstallSuccess:i}){const{searchQuery:s,searchResults:o,searchLoading:f,installFormOpenId:p}=a_(),c=M.useRef(null),h=ZC(),[d,_]=M.useState(null),g=M.useCallback(C=>{if($7(C),c.current&&clearTimeout(c.current),C.length<Qu){to([],!1);return}c.current=setTimeout(()=>{W7(C)},U7)},[]);M.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),M.useEffect(()=>{h.status!=="done"||!d||(i(d.name,d.scope),Yg(null),_(null))},[h.status,d,i]);const S=d?`Installing ${d.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:s,onChange:C=>g(C.target.value),"aria-label":"Search skills registry"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!f&&s.length>=Qu&&o.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',s,'".']}),!f&&s.length>0&&s.length<Qu&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:o.map(C=>u.jsx(G7,{result:C,theaterId:e,isFormOpen:p===C.id,onInstallClick:()=>Yg(p===C.id?null:C.id),onReadMore:t,onInstallStarted:(T,w)=>_({name:T,scope:w}),jobLog:h},C.id))})]}),u.jsx(XC,{status:h.status,lines:h.lines,runningLabel:S,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:h.reset})]})}const K7=2600;function V7({skill:e,onReadMore:t,onUpdate:i,onRemove:s,isUpdating:o}){const[f,p]=M.useState(!1),c=M.useRef(null),h=M.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]),d=M.useCallback(()=>{f?(h(),p(!1),s?.(e.name,e.scope)):(p(!0),c.current=setTimeout(()=>p(!1),K7))},[f,h,s,e.name,e.scope]);return M.useEffect(()=>()=>h(),[h]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[i&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>i(e.scope),disabled:o,children:o?"Updating…":"Update all"}),s&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${f?" is-armed":""}`,onClick:d,"aria-label":f?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:f?"Remove?":"✕"})]})]})}async function Y7(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/plugins/skills/list${t}`);return i.ok?(await i.json()).skills??[]:[]}function X7({theaterId:e,onReadMore:t,refreshKey:i}){const{scope:s,filterText:o,installedList:f,installedLoading:p}=a_(),c=ZC(),h=M.useRef(null),d=M.useCallback(m=>{Up([],!0),Y7(m).then(b=>Up(b,!1)).catch(()=>Up([],!1))},[]);M.useEffect(()=>{d(e)},[e,d,i]),M.useEffect(()=>{(c.status==="done"||c.status==="error")&&d(e)},[c.status,e,d]);const _=M.useCallback(m=>{const b=m;h.current=b;const v={scope:b};e&&(v.theaterId=e),c.start("/plugins/skills/update",v)},[e,c]),g=M.useCallback((m,b)=>{const v={scope:b,skill:m};e&&(v.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)}).then(()=>d(e)).catch(()=>null)},[e,d]),S=M.useCallback(()=>{h.current&&_(h.current)},[_]),C=s==="project"&&!e?"global":s,T=f.filter(m=>m.scope!==C?!1:o?m.name.toLowerCase().includes(o.toLowerCase()):!0),w=c.status==="running"&&h.current===C;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${C==="project"?" is-active":""}`,onClick:()=>fS("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${C==="global"?" is-active":""}`,onClick:()=>fS("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:m=>H7(m.target.value),"aria-label":"Filter installed skills"}),p&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!p&&T.length===0&&u.jsx("div",{className:"skills-empty-state",children:o?"No skills match the filter.":`No ${C} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:T.map(m=>u.jsx(V7,{skill:m,onReadMore:t,onUpdate:_,onRemove:g,isUpdating:w},`${m.scope}:${m.name}`))})]}),u.jsx(XC,{status:c.status,lines:c.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:c.reset,onRetry:S})]})}function Fp(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";i&&!/^(https?:|mailto:|#)/i.test(i)&&(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 Z7({content:e}){const t=M.useMemo(()=>{const o=xh(e).html,f=new DOMParser().parseFromString(o,"text/html");return Fp(f.body),f.body.innerHTML},[e]),i=M.useRef(null);M.useEffect(()=>{const o=i.current;if(!o)return;Fp(o);const f=new MutationObserver(()=>Fp(o));return f.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>f.disconnect()},[t]);const s=M.useCallback(o=>{const f=o.target.closest('[data-action="copy-code"]');if(!f)return;const p=f.closest("pre")?.getAttribute("data-code");if(!p)return;navigator.clipboard?.writeText(p);const c=f.textContent;f.textContent="Copied",window.setTimeout(()=>{f.textContent=c},1200)},[]);return u.jsx("div",{ref:i,className:"markdown-body",onClick:s,dangerouslySetInnerHTML:{__html:t}})}const J7=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Q7="Skills run with full agent permissions. Review before use.";function ej(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(J7)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function tj({skill:e,isInstalled:t,theaterId:i,onClose:s,onInstall:o}){const[f,p]=M.useState(null),[c,h]=M.useState(!1),d=M.useRef(null),_=M.useRef(null),g=M.useRef(null);if(M.useEffect(()=>{e&&d.current===null&&(d.current=document.activeElement)},[e]),M.useEffect(()=>{if(!e){p(null);return}h(!0),p(null);let C=!1;return(async()=>{try{let w;if(t){const b={scope:e.scope,skill:e.name};i&&(b.theaterId=i),w=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}else w=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name})});if(C)return;if(!w.ok){h(!1);return}const m=await w.json();C||(p(m.markdown??""),h(!1))}catch{C||h(!1)}})(),()=>{C=!0}},[e,t,i]),M.useEffect(()=>{if(!e)return;const C=T=>{T.key==="Escape"?(T.preventDefault(),s()):T.key==="Tab"&&ej(T,g.current),T.stopImmediatePropagation()};return _.current?.focus(),window.addEventListener("keydown",C,!0),()=>{window.removeEventListener("keydown",C,!0);const T=d.current;d.current=null,T?.focus?.()}},[e,s]),M.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const S=e.displayPath||e.source||null;return pr.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:s,"aria-hidden":"true",children:u.jsxs("div",{ref:g,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:C=>C.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&u.jsx("span",{className:"skills-overlay-meta",children:S}),u.jsx("button",{ref:_,type:"button",className:"skills-overlay-close",onClick:s,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[c&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!c&&f===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),f!==null&&u.jsx(Z7,{content:f})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:Q7}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{s(),o()},children:"Install"})]})]})}),document.body)}const nj=3200;function ij({message:e,onDismiss:t}){return M.useEffect(()=>{if(!e)return;const i=setTimeout(t,nj);return()=>clearTimeout(i)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function rj({ctx:e}){const{theaterId:t}=e,{activeTab:i,installedList:s}=a_(),[o,f]=M.useState(null),[p,c]=M.useState(null),[h,d]=M.useState(0),_=s.length,g=M.useCallback(w=>{f({skill:w,isInstalled:!0})},[]),S=M.useCallback((w,m)=>{f({skill:w,isInstalled:!1,registryId:m})},[]),C=M.useCallback((w,m)=>{c(`Installed ${w} to ${m}`),d(b=>b+1),Hu("installed")},[]),T=M.useCallback(()=>{o?.registryId&&(Yg(o.registryId),Hu("find")),f(null)},[o]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":i==="installed",className:`skills-tab-btn${i==="installed"?" is-active":""}`,onClick:()=>Hu("installed"),children:["Installed",_>0?` ${_}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>Hu("find"),children:"Find"})]}),i==="installed"?u.jsx(X7,{theaterId:t,onReadMore:g,refreshKey:h}):u.jsx(q7,{theaterId:t,onReadMore:S,onInstallSuccess:C}),u.jsx(ij,{message:p,onDismiss:()=>c(null)}),u.jsx(tj,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>f(null),onInstall:T})]})}function sj(){return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:u.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 aj={id:"skills",title:"Skills",icon:sj,render:e=>u.jsx(rj,{ctx:e})},oj={id:"skills",railPanels:[aj]},lj=[oj],JC=[...kN,...$8,...O7,...lj],cj=e2(JC),QC=M.createContext(cj),uj=QC.Provider;async function hj(){const e=[...JC],t=new Set(e.map(s=>s.id)),i=await dj();for(const s of i){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}const o=await fj(s);if(o){if(t.has(o.id)){console.warn(`Skipping external plugin with duplicate id: ${o.id}`);continue}t.add(o.id),e.push(o)}}return e2(e)}function lc(){return M.useContext(QC)}async function dj(){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(gj):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function fj(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return pj(i)?i:(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 e2(e){const t=new Set,i=[];for(const s of e)for(const o of s.railPanels??[]){if(t.has(o.id)){console.warn(`Skipping rail panel with duplicate id: ${o.id}`);continue}t.add(o.id),i.push(o)}return{plugins:e,operationKinds:e.flatMap(s=>s.operationKinds??[]),settingsSections:e.flatMap(s=>s.settingsSections??[]),notificationKinds:e.flatMap(s=>s.notificationKinds??[]),railPanels:i}}function pj(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function gj(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)}const mj=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function t2(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await l_(t),n2(await t.json(),t.status)}async function _j(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await l_(t),yj(await t.json(),t.status)}async function Wp(e,t,i){return o_(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function vj(e,t,i,s){return o_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,s)}async function bj(e,t,i){return o_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function o_(e,t,i,s){const o=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:s});await l_(o);const f=await o.json();if(!f||typeof f!="object"||!("state"in f))throw new ut(o.status,"Invalid carrier settings mutation response");return{state:n2(f.state,o.status)}}async function l_(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ut(e.status,t)}function n2(e,t){i2(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new ut(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(s=>Sj(s,t))}}function yj(e,t){i2(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new ut(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(s=>xj(s,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function Sj(e,t){const i=e;if(!i||typeof i.carrierId!="string"||typeof i.displayName!="string"||typeof i.sourceDisplayName!="string"||typeof i.role!="string"||typeof i.roleDescription!="string"||typeof i.slot!="number"||typeof i.cliType!="string"||typeof i.defaultCliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string"||typeof i.taskForceBackendCount!="number"||!i.taskforce||!Array.isArray(i.taskforce.backends))throw new ut(t,"Invalid carrier settings carrier response");return{carrierId:i.carrierId,displayName:i.displayName,sourceDisplayName:i.sourceDisplayName,role:i.role,roleDescription:i.roleDescription,...i.category?{category:i.category}:{},slot:i.slot,cliType:i.cliType,defaultCliType:i.defaultCliType,model:i.model,...i.effort?{effort:i.effort}:{},taskForceBackendCount:i.taskForceBackendCount,taskforce:{backends:i.taskforce.backends.map(s=>Cj(s,t))}}}function xj(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.displayName!="string"||!Array.isArray(i.models)||typeof i.defaultModel!="string")throw new ut(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(s=>wj(s,t)),defaultModel:i.defaultModel}}function wj(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new ut(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new ut(t,"Invalid carrier settings effort option");return{modelId:i.modelId,name:i.name,...i.effort?{effort:{levels:i.effort.levels.filter(s=>typeof s=="string"),default:i.effort.default}}:{}}}function Cj(e,t){const i=e;if(!i||typeof i.cliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string")throw new ut(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function i2(e,t){const i=[e];for(;i.length>0;){const s=i.pop();if(!(!s||typeof s!="object"))for(const[o,f]of Object.entries(s)){if(mj.has(o))throw new ut(t,"Carrier settings response leaked a restricted field");f&&typeof f=="object"&&i.push(f)}}}const Ej={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Xg=new Set;let zn={loading:!1,state:null,options:null,activeCarrierId:null,draft:Ej,savingActionId:null,error:null};function r2(){return M.useSyncExternalStore(kj,gS,gS)}function gS(){return zn}function kj(e){return Xg.add(e),()=>{Xg.delete(e)}}async function mS(e){gr({loading:!0,error:null});try{const[t,i]=await Promise.all([t2(e),_j(e)]);s2(t,i)}catch(t){if(e?.aborted)return;gr({loading:!1,error:o2(t)})}}function Tj(e){const t=zn.state?.carriers.find(i=>i.carrierId===e);gr({activeCarrierId:e,draft:t?c_(t,zn.options):zn.draft,error:null})}function ao(e){gr({draft:{...zn.draft,...e},error:null})}function Zg(e,t){const i=zn.draft.taskforce[e]??{model:"",effort:""};gr({draft:{...zn.draft,taskforce:{...zn.draft.taskforce,[e]:{...i,...t}}},error:null})}function Aj(){const e=a2();e&&gr({draft:c_(e,zn.options),error:null})}async function Rj(e){const t=a2();return t?Lj("save-all",async()=>{const i=zn.draft;let s=null;i.displayName!==t.displayName&&(s=(await Wp(t.carrierId,{displayName:i.displayName})).state);const o=i.cliType!==t.cliType;return o&&(s=(await Wp(t.carrierId,{cli:i.cliType})).state),(o||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(s=(await Wp(t.carrierId,{model:Nj(i)})).state),s=await Oj(t,e,s),{state:s??await t2()}}):!1}function s2(e,t){const i=Dj(e,zn.activeCarrierId),s=e.carriers.find(o=>o.carrierId===i)??null;gr({loading:!1,state:e,options:t,activeCarrierId:i,draft:s?c_(s,t):zn.draft,error:null})}async function Lj(e,t){gr({savingActionId:e,error:null});try{const i=await t();return s2(i.state,zn.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),gr({savingActionId:null}),!0}catch(i){return gr({savingActionId:null,error:o2(i)}),!1}}function c_(e,t){const i=Object.fromEntries((t?.cliTypes??[]).map(s=>{const o=e.taskforce.backends.find(f=>f.cliType===s.id);return[s.id,{model:o?.model??s.defaultModel,effort:o?.effort??Mj(s.id,o?.model??s.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function Mj(e,t,i){return i?.cliTypes.find(f=>f.id===e)?.models.find(f=>f.modelId===t)?.effort?.default??null}function Nj(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function a2(){return zn.state?.carriers.find(e=>e.carrierId===zn.activeCarrierId)??null}async function Oj(e,t,i){const s=new Set(t.map(o=>o.cliType));for(const o of e.taskforce.backends)s.has(o.cliType)||(i=(await bj(e.carrierId,o.cliType)).state);for(const o of t){const f=e.taskforce.backends.find(p=>p.cliType===o.cliType);f&&f.model===o.model&&(f.effort||"")===(o.effort||"")||(i=(await vj(e.carrierId,o.cliType,{model:o.model,...o.effort?{effort:o.effort}:{}})).state)}return i}function Dj(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function gr(e){zn={...zn,...e};for(const t of Xg)t()}function o2(e){return e instanceof Error?e.message:String(e)}const jj=50,Ij=2400,Bj={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)"};function Pj(){const e=r2(),t=e.state?.carriers.find(w=>w.carrierId===e.activeCarrierId)??null,i=e.options?.cliTypes.find(w=>w.id===e.draft.cliType)??null,s=i?.models.find(w=>w.modelId===e.draft.model)??null,[o,f]=M.useState(!1),[p,c]=M.useState([]),[h,d]=M.useState("idle"),_=e.savingActionId==="save-all",g=t?Wj(t,e.draft,p):!1,S=t?.taskforce.backends.map(w=>`${w.cliType}:${w.model}:${w.effort??""}`).join("|")??"";M.useEffect(()=>{const w=new AbortController;return mS(w.signal),()=>w.abort()},[]),M.useEffect(()=>{f(!1),c(t?.taskforce.backends.map(w=>w.cliType)??[]),d("idle")},[t?.carrierId,S]),M.useEffect(()=>{if(h!=="saved")return;const w=window.setTimeout(()=>d("idle"),Ij);return()=>window.clearTimeout(w)},[h]);function C(){t&&(Aj(),c(t.taskforce.backends.map(w=>w.cliType)),f(!1),d("idle"))}async function T(){if(!t)return;if(d("saving"),!await Rj(qj(p,e.draft.taskforce))){d("idle");return}f(!1),d("saved")}return u.jsxs("main",{className:"carrier-settings-page",children:[u.jsxs("section",{className:"carrier-settings-hero","aria-labelledby":"carrier-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Carrier Control Surface"}),u.jsx("h2",{id:"carrier-settings-title",children:"Carrier Settings"})]}),u.jsxs("div",{className:"carrier-settings-hero-actions",children:[u.jsx("div",{className:`carrier-settings-save-status ${h==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:h==="saving"||_?"Saving…":h==="saved"?"Saved ✓":""}),t?u.jsxs("div",{className:"carrier-settings-save-actions",children:[u.jsx("button",{type:"button",className:`carrier-settings-action-button ${g?"is-dirty":""}`,disabled:!g||_,onClick:()=>{T()},children:"Save"}),u.jsx("button",{type:"button",className:`carrier-settings-action-button ${g?"is-dirty":""}`,disabled:!g||_,onClick:C,children:"Discard"})]}):null,u.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{mS()},children:"Refresh"})]})]}),e.error?u.jsx("p",{className:"carrier-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"carrier-settings-grid",children:[u.jsxs("div",{className:"carrier-settings-list","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"carrier-settings-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"carrier-settings-empty",children:"No carriers registered."}):null,e.state?.carriers.map(w=>u.jsx(zj,{carrier:w,active:w.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>Tj(w.carrierId)},w.carrierId))]}),t&&e.options&&i?u.jsxs("div",{className:"carrier-settings-detail",style:u2(t.carrierId),children:[u.jsxs("div",{className:"carrier-settings-detail-head",children:[u.jsxs("div",{className:"carrier-settings-detail-title-block",children:[u.jsxs("div",{className:"carrier-settings-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`carrier-settings-name-line ${o?"is-editing":""}`,children:o?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"carrier-settings-input carrier-settings-name-input",value:e.draft.displayName,maxLength:jj,onChange:w=>ao({displayName:w.target.value})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:_,onClick:()=>{f(!1)},children:u.jsx(Vj,{})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{ao({displayName:t.displayName}),f(!1)},children:u.jsx(Yj,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"carrier-settings-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Edit display name",onClick:()=>{ao({displayName:t.displayName}),f(!0)},children:u.jsx(Kj,{})})]})}),u.jsx("div",{className:"carrier-settings-captain-role",children:t.role})]}),u.jsxs("div",{className:"carrier-settings-cli-badge",children:[u.jsx("span",{className:"ind","aria-hidden":"true"}),t.cliType]})]}),u.jsxs("div",{className:"carrier-settings-body",children:[u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Identity"}),u.jsxs("div",{className:"carrier-settings-mission",children:['"',t.roleDescription,'"']})]}),u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Runtime"}),u.jsxs("div",{className:"carrier-settings-runtime",children:[u.jsx("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--cli",children:u.jsxs("div",{className:"carrier-settings-field carrier-settings-field--wide",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"carrier-settings-select",value:e.draft.cliType,onChange:w=>$j(w.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(w=>u.jsx("option",{value:w.id,children:w.displayName},w.id))})]})}),u.jsxs("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--model",children:[u.jsx(l2,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:w=>Uj(i,w)}),u.jsx(c2,{id:"carrier-effort",model:s,value:e.draft.effort,onChange:w=>ao({effort:w})})]})]})]}),u.jsx(Hj,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:p,onRowsChange:c})]})]},t.carrierId):u.jsx("div",{className:"carrier-settings-detail",children:u.jsx("p",{className:"carrier-settings-empty",children:"Select a carrier."})})]})]})}function zj({carrier:e,active:t,minBackends:i,onSelect:s}){const o=e.taskForceBackendCount>=i;return u.jsxs("button",{type:"button",className:`carrier-settings-row ${t?"is-active":""}`,style:u2(e.carrierId),onClick:s,children:[u.jsx("span",{className:"carrier-settings-captain-dot","aria-hidden":"true"}),u.jsxs("span",{className:"carrier-settings-row-text",children:[u.jsx("span",{className:"carrier-settings-row-name",children:e.displayName}),u.jsx("span",{className:"carrier-settings-row-role",children:e.role})]}),u.jsx("span",{className:"carrier-settings-row-live","aria-hidden":"true",children:u.jsx("span",{className:`carrier-settings-live-dot ${o?"is-live":""}`})})]})}function l2({id:e,label:t,models:i,value:s,disabled:o=!1,onChange:f}){return u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"carrier-settings-select",value:s,disabled:o,onChange:p=>f(p.target.value),children:i.map(p=>u.jsx("option",{value:p.modelId,children:p.name},p.modelId))})]})}function c2({id:e,model:t,value:i,disabled:s=!1,onChange:o}){return t?.effort?u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"carrier-settings-select",value:i||t.effort.default,disabled:s,onChange:f=>o(f.target.value),children:t.effort.levels.map(f=>u.jsx("option",{value:f,children:f},f))})]}):u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("span",{className:"carrier-settings-label",children:"Effort"}),u.jsx("p",{className:"carrier-settings-help",children:"Not supported for this model."})]})}function Hj({carrier:e,cliOptions:t,minBackends:i,savingActionId:s,rows:o,onRowsChange:f}){const p=r2(),c=e.taskforce.backends.length,[h,d]=M.useState(c>0),[_,g]=M.useState(!1),[S,C]=M.useState(""),T=e.taskForceBackendCount>=i,w=t.filter(b=>!o.includes(b.id)),m=S||w[0]?.id||"";return u.jsxs("div",{className:`carrier-settings-control-group carrier-settings-control-group--taskforce ${h?"is-expanded":""}`,children:[u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"carrier-settings-resp-title",children:"Task Force"}),u.jsx("p",{className:"carrier-settings-help",children:c>0?`${c} backend${c===1?"":"s"} configured${T?" · active":` · needs ${i}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${i} to activate.`})]}),u.jsx("div",{className:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":h,onClick:()=>d(b=>!b),children:h?"Hide":"Configure"})})]}),h?u.jsxs("div",{className:"carrier-settings-tf-list",children:[o.length===0?u.jsx("p",{className:"carrier-settings-tf-empty",children:"No Task Force backend drafted."}):null,o.map(b=>{const v=t.find(R=>R.id===b);if(!v)return null;const x=p.draft.taskforce[v.id]??{model:v.defaultModel,effort:""},k=v.models.find(R=>R.modelId===x.model)??v.models[0]??null,L=e.taskforce.backends.some(R=>R.cliType===v.id);return u.jsxs("div",{className:`carrier-settings-tf-item ${L?"is-active":""}`,children:[u.jsxs("div",{className:"carrier-settings-tf-title",children:[u.jsx("span",{className:`carrier-settings-live-dot ${L?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:v.displayName})]}),u.jsx(l2,{id:`tf-${v.id}-model`,label:"Model",models:v.models,value:x.model,onChange:R=>Fj(v,R)}),u.jsx(c2,{id:`tf-${v.id}-effort`,model:k,value:x.effort,onChange:R=>Zg(v.id,{effort:R})}),u.jsx("div",{className:"carrier-settings-tf-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:s==="save-all",onClick:()=>f(o.filter(R=>R!==v.id)),children:"Remove"})})]},v.id)}),u.jsxs("div",{className:"carrier-settings-tf-add-row",children:[_&&w.length>0?u.jsx("select",{className:"carrier-settings-select carrier-settings-tf-add-select",value:m,onChange:b=>C(b.target.value),"aria-label":"Task Force CLI to add",children:w.map(b=>u.jsx("option",{value:b.id,children:b.displayName},b.id))}):null,u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:w.length===0||s==="save-all",onClick:()=>{if(!_){g(!0);return}const b=m,v=t.find(k=>k.id===b),x=v?.models.find(k=>k.modelId===v.defaultModel)??v?.models[0]??null;!v||!x||(Zg(v.id,{model:x.modelId,effort:x.effort?.default??""}),f(o.includes(v.id)?o:[...o,v.id]),C(""),g(!1))},children:"Add"})]})]}):null]})}function $j(e,t){const i=t.find(o=>o.id===e),s=i?.models.find(o=>o.modelId===i.defaultModel)??i?.models[0]??null;ao({cliType:e,model:s?.modelId??"",effort:s?.effort?.default??""})}function Uj(e,t){const i=e.models.find(s=>s.modelId===t);ao({model:t,effort:i?.effort?.default??""})}function Fj(e,t){const i=e.models.find(s=>s.modelId===t);Zg(e.id,{model:t,effort:i?.effort?.default??""})}function Wj(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:Gj(e,i,t.taskforce)}function Gj(e,t,i){if(t.length!==e.taskforce.backends.length)return!0;const s=new Set(t);for(const o of e.taskforce.backends){if(!s.has(o.cliType))return!0;const f=i[o.cliType];if(!f||f.model!==o.model||(f.effort||"")!==(o.effort||""))return!0}return!1}function qj(e,t){return e.map(i=>{const s=t[i];return s?{cliType:i,model:s.model,...s.effort?{effort:s.effort}:{}}:null}).filter(i=>i!==null)}function u2(e){return{"--cap-color":Bj[e]??"var(--brass)"}}function Kj(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.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"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function Vj(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function Yj(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}async function Xj(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await Zj(t),Jj(await t.json(),t.status).routes}async function Zj(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ut(e.status,t)}function Jj(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new ut(t,"Invalid backend API catalog response");return{routes:i.routes.map(s=>Qj(s,t))}}function Qj(e,t){const i=e;if(!i||typeof i!="object"||typeof i.method!="string"||typeof i.path!="string"||typeof i.summary!="string"||typeof i.category!="string"||typeof i.gate!="string")throw new ut(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const Jg=new Set;let Qg={loading:!1,state:null,error:null};function eI(){return M.useSyncExternalStore(tI,_S,_S)}function _S(){return Qg}function tI(e){return Jg.add(e),()=>{Jg.delete(e)}}async function nI(e){Gp({loading:!0,error:null});try{const t=await Xj(e);Gp({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Gp({loading:!1,error:iI(t)})}}function Gp(e){Qg={...Qg,...e};for(const t of Jg)t()}function iI(e){return e instanceof Error?e.message:String(e)}function rI(){const e=eI(),[t,i]=M.useState(!0),s=M.useMemo(()=>oI(e.state??[]),[e.state]),o=e.state?.length??0,f=s.length;return M.useEffect(()=>{const p=new AbortController;return nI(p.signal),()=>p.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[u.jsx("div",{className:`backend-api-control carrier-settings-control-group--taskforce ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children:o>0?`${o} loopback route${o===1?"":"s"} across ${f} categor${f===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),u.jsx("div",{className:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":t,onClick:()=>i(p=>!p),children:t?"Hide":"Show"})})]})}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?u.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(p=>u.jsx(sI,{group:p},p.category)):null,e.state&&s.length===0?u.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,u.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 sI({group:e}){return u.jsxs("div",{className:"backend-api-group",children:[u.jsxs("div",{className:"backend-api-group-head",children:[u.jsx("span",{children:e.category}),u.jsx("span",{children:e.entries.length})]}),u.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>u.jsx(aI,{entry:t},`${t.method}:${t.path}`))})]})}function aI({entry:e}){return u.jsxs("div",{className:"backend-api-row",children:[u.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),u.jsx("code",{className:"backend-api-path",children:e.path}),u.jsx("span",{className:"backend-api-summary",children:e.summary}),u.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function oI(e){const t=new Map;for(const i of e){const s=i.category.trim()||"Uncategorized",o=t.get(s);o?o.push(i):t.set(s,[i])}return Array.from(t.entries()).map(([i,s])=>({category:i,entries:s}))}async function h2(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await d2(t),f2(await t.json(),t.status)}async function lI(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await d2(i);const s=await i.json();if(!s||typeof s!="object"||!("state"in s))throw new ut(i.status,"Invalid global settings mutation response");return{state:f2(s.state,i.status)}}async function d2(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ut(e.status,t)}function f2(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!cI(i.consoleStaticPort)||i.theme!=="maritime"&&i.theme!=="carbon")throw new ut(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme}}function cI(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}const em=new Set;let tm={loading:!1,state:null,savingField:null,error:null};function uI(){return M.useSyncExternalStore(hI,vS,vS)}function vS(){return tm}function hI(e){return em.add(e),()=>{em.delete(e)}}async function dI(e){po({loading:!0,error:null});try{const t=await h2(e);po({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;po({loading:!1,error:p2(t)})}}async function nm(e,t){po({savingField:e,error:null});try{const i=await lI({[e]:t});return po({state:i.state,savingField:null,error:null}),!0}catch(i){return po({savingField:null,error:p2(i)}),!1}}function po(e){tm={...tm,...e};for(const t of em)t()}function p2(e){return e instanceof Error?e.message:String(e)}const fI=[{id:"maritime",label:"Maritime",swatch:["oklch(78% 0.13 75)","oklch(82% 0.13 195)","oklch(32% 0.04 248)"]},{id:"carbon",label:"Carbon",swatch:["oklch(76% 0.115 62)","oklch(80% 0.105 205)","oklch(25% 0.007 252)"]}],pI=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],gI=1024,mI=65535,_I=[{id:"general",label:"General",eyebrow:"Theme · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function vI(){const e=uI(),t=e.state,i=e.savingField!==null,[s,o]=M.useState("general"),f=lc(),p=yI(f.plugins),c=SI(p);return M.useEffect(()=>{const h=new AbortController;return dI(h.signal),()=>h.abort()},[]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Fleet Control Surface"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:i?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),_I.map(h=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${h.id===s?"is-active":""}`,"aria-pressed":h.id===s,onClick:()=>o(h.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:h.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:h.eyebrow})]},h.id)),p.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),c.map(h=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:h.pluginLabel}),h.sections.map(d=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${d.id===s?"is-active":""}`,"aria-pressed":d.id===s,onClick:()=>o(d.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:d.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:d.pluginLabel})]},d.id))]},h.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:bI(s,t,i,p)},s)]})]})}function bI(e,t,i,s){if(e.includes(":")){const o=s.find(f=>f.id===e);return o?.render?u.jsx(gm,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:o.render()}):u.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(wI,{}),u.jsx(CI,{state:t,saving:i})]});case"backend-api":return u.jsx(rI,{})}}function yI(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:xI(t.id),sectionTitle:i.title,render:i.render})))}function SI(e){const t=[];for(const i of e){const s=t.at(-1);if(s?.pluginId===i.pluginId){t[t.length-1]={...s,sections:[...s.sections,i]};continue}t.push({pluginId:i.pluginId,pluginLabel:i.pluginLabel,sections:[i]})}return t}function xI(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function wI(){const{activeTheme:e}=Gr();return u.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),u.jsx("p",{className:"global-settings-help",children:"Console color scheme. Applies immediately and is saved server-side."})]}),u.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:fI.map(t=>{const i=t.id===e;return u.jsxs("button",{type:"button","aria-pressed":i,className:`theme-card ${i?"is-active":""}`,onClick:()=>{Gx(t.id),nm("theme",t.id)},children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:t.swatch.map(s=>u.jsx("i",{style:{background:s}},s))}),u.jsx("span",{className:"theme-card-label",children:t.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:i?u.jsx(kI,{}):null})]},t.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function CI({state:e,saving:t}){const i=Gr();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsx(u.Fragment,{children:u.jsx(EI,{state:e,saving:t,consoleState:i})}):u.jsx("p",{className:"global-settings-help",children:"Loading settings."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function EI({state:e,saving:t,consoleState:i}){const[s,o]=M.useState(e.consoleStaticPort?.toString()??""),f=i.effectivePort,p=i.portMode==="static"&&!i.portHonored,c=i.requestedPort,h=e.consolePortMode==="static"&&e.consoleStaticPort!==null,d=s.trim(),_=Number(d),g=d.length>0,S=g&&bS(_),C=e.consolePortMode==="static"&&g&&!S;return M.useEffect(()=>{o(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.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."})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:pI.map(T=>{const w=e.consolePortMode===T.id;return u.jsx("button",{type:"button","aria-pressed":w,className:`segmented-option ${w?"is-active":""}`,disabled:t,onClick:()=>{nm("consolePortMode",T.id)},children:T.label},T.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${C?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:s,disabled:t,"aria-invalid":C,"aria-describedby":"console-static-port-hint",onChange:T=>{const w=T.target.value;o(w);const m=Number(w.trim());bS(m)&&nm("consoleStaticPort",m)}}),u.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${C?"is-invalid":""}`,children:"1024–65535"})]})}),u.jsxs("div",{className:`console-port-effective ${p?"is-fallback":""}`,"aria-live":"polite",children:[u.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),u.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",u.jsx("span",{children:f||"..."}),p?" · Dynamic":""]})]})]}),p&&c?u.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",u.jsx("strong",{children:c})," was unavailable — the console fell back to a ",u.jsx("strong",{children:"Dynamic"})," port and is running on ",u.jsxs("strong",{children:["127.0.0.1:",f||"..."]}),"."," ",h?u.jsxs(u.Fragment,{children:["Next restart will try ",u.jsx("strong",{children:e.consoleStaticPort}),"."]}):u.jsx(u.Fragment,{children:"Next restart will use a dynamic port."})]}):null,u.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function bS(e){return Number.isInteger(e)&&e>=gI&&e<=mI}function kI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 TI(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function nc(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function AI(e,t){return{...TI(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const RI=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{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:[["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"}]}],LI=288,MI=520,Ol=12,ys=[{id:"operations",label:"Operations"},{id:"map",label:"Map"},{id:"help",label:"Help"}],NI=/mac|iphone|ipad|ipod/i;function eh({anchor:e,viewportBounds:t,placement:i="cursor",mode:s="full",catalog:o,canLaunch:f,radarEnabled:p,perimeterEnabled:c,renderKindIcon:h,onLaunchKind:d,onResetView:_,onToggleRadar:g,onTogglePerimeter:S,onClose:C}){const T=M.useRef(null),w=M.useRef(null),m=M.useRef({operations:null,map:null,help:null}),[b,v]=M.useState(s==="controls"?"map":"operations"),x=jI(),k=s==="full",L=s==="full"||s==="launch",R=s==="full"||s==="controls";M.useEffect(()=>{const I=F=>{T.current?.contains(F.target)||C()},K=F=>{F.key==="Escape"&&C()};return document.addEventListener("mousedown",I),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",K)}},[C]),M.useEffect(()=>{w.current?.focus()},[]);const N=(I,K=!1)=>{v(I),K&&window.requestAnimationFrame(()=>m.current[I]?.focus())},A=I=>{const K=ys.findIndex(G=>G.id===b),F=ys.length-1;if(I.key==="ArrowRight"||I.key==="ArrowLeft"){I.preventDefault();const G=I.key==="ArrowRight"?1:-1,B=ys[(K+G+ys.length)%ys.length];N(B.id,!0)}else I.key==="Home"?(I.preventDefault(),N(ys[0].id,!0)):I.key==="End"&&(I.preventDefault(),N(ys[F].id,!0))};return u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:T,style:DI(e,t,i),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Operations Control",tabIndex:-1,ref:w,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(OI,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Operations Control"})})]}),k?u.jsx("div",{className:"canvas-context-menu-tabs",role:"tablist","aria-label":"Operations Control sections",children:ys.map(I=>u.jsx("button",{ref:K=>{m.current[I.id]=K},type:"button",id:`canvas-control-tab-${I.id}`,className:"canvas-context-menu-tab",role:"tab","aria-selected":b===I.id,"aria-controls":`canvas-control-panel-${I.id}`,tabIndex:b===I.id?0:-1,onClick:()=>N(I.id),onKeyDown:A,children:I.label},I.id))}):null,L?u.jsxs("div",{id:"canvas-control-panel-operations",role:"tabpanel","aria-labelledby":"canvas-control-tab-operations",className:"canvas-context-menu-panel",hidden:k?b!=="operations":void 0,children:[u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),o.length>0?o.map((I,K)=>u.jsxs("div",{children:[K>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:I.title}),I.kinds.map(F=>{const G=F.disabled===!0||!f;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:G,title:F.disabledReason,onClick:()=>d(I.id,F),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:h(I.id,F)??u.jsx(zI,{})}),u.jsx("span",{className:"theater-menu-label",children:F.title}),F.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:F.disabledReason}):null]},`${I.id}:${F.id}`)})]},I.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]}):null,R?u.jsxs(u.Fragment,{children:[u.jsxs("div",{id:"canvas-control-panel-map",role:"tabpanel","aria-labelledby":"canvas-control-tab-map",className:"canvas-context-menu-panel",hidden:k?b!=="map":void 0,children:[u.jsx("p",{className:"canvas-context-menu-section",children:"View"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item",onClick:_,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(II,{})}),u.jsx("span",{className:"theater-menu-label",children:"Reset view"})]}),u.jsx("div",{className:"theater-menu-divider",role:"separator"}),u.jsx("p",{className:"canvas-context-menu-section",children:"Settings"}),g?u.jsx(SS,{checked:!!p,label:"Radar sweep",onClick:g,children:u.jsx(BI,{})}):null,S?u.jsx(SS,{checked:!!c,label:"Panel pulse",onClick:S,children:u.jsx(PI,{})}):null]}),u.jsx("div",{id:"canvas-control-panel-help",role:"tabpanel","aria-labelledby":"canvas-control-tab-help",className:"canvas-context-menu-panel canvas-context-menu-help",hidden:k?b!=="help":void 0,children:s==="controls"?u.jsxs("details",{className:"canvas-context-menu-help-details",children:[u.jsx("summary",{className:"canvas-context-menu-section canvas-context-menu-help-summary",children:"Shortcuts"}),u.jsx(yS,{modLabel:x})]}):u.jsx(yS,{modLabel:x})})]}):null]})})}function OI(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),u.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"}),u.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function DI(e,t,i){const s=t?Math.max(Ol,Math.min(e.x,t.width-LI-Ol)):e.x;if(i==="above")return{left:s,bottom:Math.max(Ol,e.y)};const o=t?Math.max(Ol,Math.min(e.y,t.height-MI-Ol)):e.y;return{left:s,top:o}}function yS({modLabel:e}){return u.jsx(u.Fragment,{children:RI.map(t=>u.jsxs("section",{className:"canvas-shortcuts-group","aria-labelledby":`canvas-shortcuts-${t.title.toLowerCase()}`,children:[u.jsx("h3",{id:`canvas-shortcuts-${t.title.toLowerCase()}`,children:t.title}),u.jsx("dl",{className:"canvas-shortcuts-list",children:t.entries.map(i=>u.jsxs("div",{className:"canvas-shortcuts-entry",children:[u.jsx("dt",{className:"canvas-shortcuts-combos",children:i.combos.map((s,o)=>u.jsxs("span",{className:"canvas-shortcuts-combo",children:[o>0?u.jsx("span",{className:"canvas-shortcuts-or",children:"or"}):null,u.jsx("span",{className:"canvas-shortcuts-keyset",children:s.map(f=>u.jsx("kbd",{children:f==="Mod"?e:f},f))})]},`${i.description}:${s.join("+")}`))}),u.jsx("dd",{children:i.description})]},`${t.title}:${i.description}`))})]},t.title))})}function SS({checked:e,label:t,onClick:i,children:s}){return u.jsxs("button",{type:"button",role:"switch",className:`canvas-context-menu-switch ${e?"is-on":""}`,"aria-checked":e,onClick:i,children:[u.jsx("span",{className:"canvas-context-menu-switch-icon","aria-hidden":"true",children:s}),u.jsx("span",{className:"canvas-context-menu-switch-label",children:t}),u.jsx("span",{className:"canvas-context-menu-switch-track","aria-hidden":"true"})]})}function jI(){const t=navigator.userAgentData?.platform??navigator.platform;return NI.test(t)?"⌘":"Ctrl"}function II(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.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"}),u.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function BI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M8 8 12 5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"})]})}function PI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"3.2",width:"10",height:"9.6",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M10.9 3.2H13v2.1M5.1 12.8H3v-2.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M12.6 5.1c.5 1.4.4 2.9-.3 4.2M3.4 10.9c-.5-1.4-.4-2.9.3-4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"11.7",cy:"4.2",r:"0.9",fill:"currentColor"})]})}function zI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}const xS=256,wS=176,qp=12,$u=220,g2="fleet-console.map.radarCollapsed";function HI({operations:e,pluginOperations:t,viewport:i,canvasSize:s,onJump:o}){const f=M.useRef(null),p=M.useRef(!1),[c,h]=M.useState($I);if(s.width<=0||s.height<=0||i.zoom<=0)return null;const d=[...Object.entries(e).map(([B,Y])=>({id:B,kind:"op",x:Y.x,y:Y.y,width:Y.width,height:Y.height})),...Object.entries(t).map(([B,Y])=>({id:B,kind:"plugin",x:Y.geometry.x,y:Y.geometry.y,width:Y.geometry.width,height:Y.geometry.height}))];if(d.length===0)return null;const _=()=>{h(B=>{const Y=!B;return UI(Y),Y})};if(c)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:_,"aria-label":"Radar 펼치기",title:"Show radar",children:u.jsx(WI,{})});const g=xS-qp*2,S=wS-qp*2,C={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let T=Math.min(C.x,...d.map(B=>B.x)),w=Math.min(C.y,...d.map(B=>B.y)),m=Math.max(C.x+C.width,...d.map(B=>B.x+B.width)),b=Math.max(C.y+C.height,...d.map(B=>B.y+B.height));T-=$u,w-=$u,m+=$u,b+=$u;const v=m-T,x=b-w,k=Math.min(g/v,S/x),L=(g-v*k)/2,R=(S-x*k)/2,N=B=>L+(B-T)*k,A=B=>R+(B-w)*k,I=B=>{const Y=f.current?.getBoundingClientRect();if(!Y)return;const W=B.clientX-Y.left,z=B.clientY-Y.top;o({x:T+(W-L)/k,y:w+(z-R)/k})},K=B=>{B.stopPropagation(),p.current=!0,B.currentTarget.setPointerCapture(B.pointerId),I(B)},F=B=>{p.current&&(B.stopPropagation(),I(B))},G=B=>{p.current=!1;try{B.currentTarget.releasePointerCapture(B.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:xS,height:wS},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Radar"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:_,"aria-label":"Radar 접기",title:"Collapse radar",children:u.jsx(FI,{})}),u.jsxs("div",{ref:f,className:"canvas-minimap-inner",style:{inset:qp},onPointerDown:K,onPointerMove:F,onPointerUp:G,onPointerCancel:G,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[d.map(B=>u.jsx("div",{className:`canvas-minimap-operation ${B.kind==="plugin"?"is-plugin":""}`,style:{left:N(B.x),top:A(B.y),width:Math.max(2,B.width*k),height:Math.max(2,B.height*k)}},B.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:N(C.x),top:A(C.y),width:C.width*k,height:C.height*k}})]})]})}function $I(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(g2)==="true"}catch{return!1}}function UI(e){if(!(typeof window>"u"))try{window.localStorage.setItem(g2,String(e))}catch{}}function FI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 WI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),u.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}const GI="is-animation-paused";function qI({viewport:e,backgroundAnimationEnabled:t}){const[i,s]=M.useState(()=>document.hidden),o=!t,f=i||o;return M.useEffect(()=>{function p(){s(document.hidden)}return document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}},[]),u.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[u.jsx("div",{className:"operations-canvas-sea"}),u.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`}}),u.jsxs("div",{className:`operations-radar${f?` ${GI}`:""}${o?" is-disabled":""}`,children:[u.jsx("span",{className:"operations-radar-ring operations-radar-ring--outer"}),u.jsx("span",{className:"operations-radar-ring operations-radar-ring--middle"}),u.jsx("span",{className:"operations-radar-ring operations-radar-ring--inner"}),u.jsx("span",{className:"operations-radar-sweep"})]})]})}const qh=[{key:"red",label:"Red",color:"oklch(70% 0.12 25)"},{key:"orange",label:"Orange",color:"oklch(73% 0.12 50)"},{key:"amber",label:"Amber",color:"oklch(78% 0.11 70)"},{key:"yellow",label:"Yellow",color:"oklch(84% 0.11 95)"},{key:"lime",label:"Lime",color:"oklch(81% 0.12 120)"},{key:"green",label:"Green",color:"oklch(74% 0.12 145)"},{key:"emerald",label:"Emerald",color:"oklch(73% 0.10 165)"},{key:"teal",label:"Teal",color:"oklch(74% 0.09 185)"},{key:"cyan",label:"Cyan",color:"oklch(76% 0.09 205)"},{key:"sky",label:"Sky",color:"oklch(74% 0.10 230)"},{key:"blue",label:"Blue",color:"oklch(70% 0.11 255)"},{key:"indigo",label:"Indigo",color:"oklch(68% 0.11 278)"},{key:"violet",label:"Violet",color:"oklch(70% 0.11 300)"},{key:"purple",label:"Purple",color:"oklch(70% 0.12 320)"},{key:"magenta",label:"Magenta",color:"oklch(71% 0.12 340)"},{key:"rose",label:"Rose",color:"oklch(72% 0.11 5)"}];function bo(e){return qh.find(t=>t.key===e)?.color??null}function CS(e){return typeof e.accent=="string"?e.accent:null}const ES=8,KI=120;function VI({anchor:e,accentKey:t,onSelect:i,onClose:s}){const[o,f]=M.useState(void 0);M.useLayoutEffect(()=>{const c=Math.max(8,Math.min(e.left,window.innerWidth-8)),h=e.bottom+ES,d=h+KI>window.innerHeight;f(d?{position:"fixed",left:c,top:"auto",bottom:Math.round(window.innerHeight-e.top+ES)}:{position:"fixed",left:c,top:Math.round(h)})},[e]),M.useEffect(()=>{const c=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return window.addEventListener("keydown",c),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("keydown",c),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[s]);const p=c=>{i(c),s()};return pr.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:s,children:o?u.jsxs("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:o,onPointerDown:c=>c.stopPropagation(),children:[u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":t===null,onClick:()=>p(null),children:[u.jsx("span",{}),"None"]}),qh.map(c=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":c.label,"aria-pressed":t===c.key,onClick:()=>p(c.key),children:u.jsx("span",{style:{background:c.color}})},c.key))]}):null}),document.body)}function m2(e){const{currentTitle:t,onCommit:i,onBegin:s}=e,o=M.useRef(null),f=M.useRef(!1),p=M.useRef(!1),[c,h]=M.useState(!1),[d,_]=M.useState("");M.useEffect(()=>{c&&(o.current?.focus(),o.current?.select())},[c]);const g=()=>{s?.(),p.current=!1,_(t),h(!0)},S=()=>{p.current=!0,h(!1),_("")},C=()=>{if(!f.current){f.current=!0;try{i(d)}finally{f.current=!1,p.current=!0,h(!1)}}};return{renaming:c,draftTitle:d,inputRef:o,begin:g,cancel:S,commit:C,setDraftTitle:_,handleKeyDown:m=>{if(m.key==="Enter"){m.preventDefault(),C();return}m.key==="Escape"&&(m.preventDefault(),S())},handleBlur:()=>{if(p.current){p.current=!1;return}C()}}}const YI=["n","ne","e","se","s","sw","w","nw"],Kp=320,Vp=200;function XI({operation:e,active:t,geometry:i,zoom:s,subtitle:o,status:f,minimized:p=!1,maximized:c=!1,accentKey:h=null,children:d,onActivate:_,onClose:g,onMinimize:S,onMaximize:C,onRename:T,onSetAccent:w,onGeometryChange:m,onGeometryCommit:b}){const v=M.useRef(null),x=M.useRef(null),k=M.useRef(null),[L,R]=M.useState(null),N=e.title,A=m2({currentTitle:N,onCommit:T,onBegin:_}),I=h?bo(h):null,K=["canvas-operation",t?"is-active":"",p?"is-minimized":"",c?"is-maximized":"",JI(f)].filter(Boolean).join(" "),F=Q=>{c||Q.button===0&&(Q.preventDefault(),Q.stopPropagation(),_(),x.current={pointerId:Q.pointerId,startX:Q.clientX,startY:Q.clientY,geometry:i,latest:i},Q.currentTarget.setPointerCapture(Q.pointerId))},G=Q=>{if(c)return;const re=x.current;if(!re||re.pointerId!==Q.pointerId)return;Q.preventDefault(),Q.stopPropagation();const ie={...re.geometry,x:re.geometry.x+(Q.clientX-re.startX)/s,y:re.geometry.y+(Q.clientY-re.startY)/s};re.latest=ie,m(ie)},B=Q=>{if(c){x.current=null;return}const re=x.current;!re||re.pointerId!==Q.pointerId||(Q.preventDefault(),Q.stopPropagation(),x.current=null,Q.currentTarget.releasePointerCapture(Q.pointerId),b(re.latest))},Y=(Q,re)=>{c||(re.preventDefault(),re.stopPropagation(),_(),k.current={direction:Q,pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,geometry:i,latest:i},re.currentTarget.setPointerCapture(re.pointerId))},W=Q=>{if(c)return;const re=k.current;if(!re||re.pointerId!==Q.pointerId)return;Q.preventDefault(),Q.stopPropagation();const ie=ZI(re.geometry,re.direction,(Q.clientX-re.startX)/s,(Q.clientY-re.startY)/s);re.latest=ie,m(ie)},z=Q=>{if(c){k.current=null;return}const re=k.current;!re||re.pointerId!==Q.pointerId||(Q.preventDefault(),Q.stopPropagation(),k.current=null,Q.currentTarget.releasePointerCapture(Q.pointerId),b(re.latest))},V=Q=>{Q.stopPropagation()},X=Q=>{Q.stopPropagation(),_()},j=Q=>{Q.stopPropagation(),_()},P=Q=>{Q.stopPropagation()},D=()=>{const Q=typeof document<"u"?document.activeElement:null;Q instanceof HTMLElement&&v.current?.contains(Q)&&Q.blur(),S()},U=Q=>{_(),R(Q)},q={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...I?{"--op-accent":I}:{}};return u.jsxs("article",{ref:v,className:K,style:q,onPointerDown:_,"data-canvas-operation":!0,"aria-label":`Operation ${N}`,inert:p?!0:void 0,children:[u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:F,onPointerMove:G,onPointerUp:B,onPointerCancel:B,"data-canvas-blocker":!0,children:[w?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:V,onClick:Q=>U(Q.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${N}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:kS(f),"aria-hidden":"true"})}):u.jsx("span",{className:kS(f),"aria-hidden":"true"}),A.renaming?u.jsx("input",{ref:A.inputRef,className:"canvas-operation-rename-input",value:A.draftTitle,"aria-label":`${N} 이름 변경`,onPointerDown:Q=>Q.stopPropagation(),onChange:Q=>A.setDraftTitle(Q.target.value),onKeyDown:A.handleKeyDown,onBlur:A.handleBlur}):u.jsx("span",{className:"canvas-operation-title",onPointerDown:X,onDoubleClick:A.begin,title:"Double-click to rename",children:N}),o?u.jsx("span",{className:"canvas-operation-cli",children:o}):null,u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:V,onClick:D,"aria-label":`Minimize operation ${N}`,title:"Minimize operation",children:u.jsx(QI,{})}),C?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:V,onClick:C,"aria-label":c?`Restore operation ${N}`:`Maximize operation ${N}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(tB,{}):u.jsx(eB,{})}):null,u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:V,onClick:g,"aria-label":`Close operation ${N}`,title:"Close operation",children:u.jsx(nB,{})})]}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:j,onWheel:P,"data-canvas-blocker":!0,children:d}),!c&&YI.map(Q=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${Q}`,onPointerDown:re=>Y(Q,re),onPointerMove:W,onPointerUp:z,onPointerCancel:z,"data-canvas-blocker":!0,"aria-hidden":"true"},Q)),L&&w?u.jsx(VI,{anchor:L,accentKey:h,onSelect:w,onClose:()=>R(null)}):null]})}function ZI(e,t,i,s){let{x:o,y:f,width:p,height:c}=e;return t.includes("e")&&(p+=i),t.includes("s")&&(c+=s),t.includes("w")&&(o+=i,p-=i),t.includes("n")&&(f+=s,c-=s),p<Kp&&(t.includes("w")&&(o-=Kp-p),p=Kp),c<Vp&&(t.includes("n")&&(f-=Vp-c),c=Vp),{...e,x:o,y:f,width:p,height:c}}function JI(e){return e==="running"?"is-running is-running--turn":e==="awaiting"?"is-running is-running--awaiting":""}function kS(e){return e==="running"?"tenant-beacon is-turn-running":e==="awaiting"?"tenant-beacon is-awaiting":e==="dormant"?"tenant-beacon is-dormant":"tenant-beacon is-idle"}function QI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function eB(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 tB(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 nB(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 iB({rect:e,viewport:t}){const i=AI(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:i.x,top:i.y,width:i.width,height:i.height},"aria-hidden":"true"})}const rB=.25,sB=2,aB=200,oB=150,TS=5,lB=.0018;function cB({viewport:e,disabled:t=!1,consumePointerDown:i=!1,onViewportChange:s,onZoom:o,onCreate:f,onConsumePointerDown:p,onClick:c}){const h=M.useRef(null),d=M.useRef(e),[_,g]=M.useState(null),[S,C]=M.useState(!1),[T,w]=M.useState(!1);M.useEffect(()=>{d.current=e},[e]),M.useEffect(()=>{const R=A=>{A.key==="Shift"&&w(!0),!uB(A.target)&&A.code==="Space"&&(A.preventDefault(),C(!0))},N=A=>{A.key==="Shift"&&w(!1),A.code==="Space"&&C(!1)};return window.addEventListener("keydown",R),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",N)}},[]);const m=R=>{if(t||AS(R.target)||R.button!==0&&R.button!==1)return;if(R.preventDefault(),i){p?.();return}const N=Xp(R),A=R.shiftKey&&R.button===0&&!S?"create":"pan";h.current={pointerId:R.pointerId,mode:A,startScreen:N,currentScreen:N,startViewport:d.current},R.currentTarget.setPointerCapture(R.pointerId),A==="create"&&g(Yp(N,N,d.current))},b=R=>{const N=h.current;if(!N||N.pointerId!==R.pointerId)return;R.preventDefault();const A=Xp(R);if(h.current={...N,currentScreen:A},N.mode==="pan"){s({...N.startViewport,x:N.startViewport.x+A.x-N.startScreen.x,y:N.startViewport.y+A.y-N.startScreen.y});return}g(Yp(N.startScreen,A,d.current))},v=R=>{L(R,!0)},x=R=>{L(R,!1)},k=R=>{if(t||AS(R.target))return;R.preventDefault();const N=Xp(R),A=d.current,I=hB(A.zoom*Math.exp(-R.deltaY*lB),rB,sB),K=nc(N,A);o({x:N.x-K.x*I,y:N.y-K.y*I,zoom:I})},L=(R,N)=>{const A=h.current;if(!A||A.pointerId!==R.pointerId||(h.current=null,R.currentTarget.releasePointerCapture(R.pointerId),g(null),!N))return;const I=Math.abs(A.currentScreen.x-A.startScreen.x),K=Math.abs(A.currentScreen.y-A.startScreen.y);if(I<TS&&K<TS){c?.();return}if(A.mode!=="create")return;const F=Yp(A.startScreen,A.currentScreen,d.current),G={x:F.x,y:F.y,width:Math.max(F.width,aB),height:Math.max(F.height,oB)};f(G,A.currentScreen)};return{rubberBand:_,spaceActive:S,shiftActive:T,onPointerDown:m,onPointerMove:b,onPointerUp:v,onPointerCancel:x,onWheel:k}}function Yp(e,t,i){const s=nc(e,i),o=nc(t,i),f=Math.min(s.x,o.x),p=Math.min(s.y,o.y);return{x:f,y:p,width:Math.abs(s.x-o.x),height:Math.abs(s.y-o.y)}}function Xp(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function AS(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function uB(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function hB(e,t,i){return Math.min(i,Math.max(t,e))}const dB="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",fB=560,pB=360;function gB({state:e,catalog:t,canLaunch:i,radarEnabled:s,perimeterEnabled:o,renderKindIcon:f,onLaunchKind:p,onLaunchAtGeometry:c,onResetView:h,onToggleRadar:d,onTogglePerimeter:_,onClose:g,onFocus:S,onSetAccent:C}){const T=M.useRef(null),w=Sx(),m=wx(),b=Cx(),v=e.activeOperationId,[x,k]=M.useState(null),L=lc(),[R,N]=M.useState({width:0,height:0}),A=!e.activeTheaterId||e.addingTheater;M.useEffect(()=>{const q=T.current;if(!q||typeof ResizeObserver>"u")return;const Q=()=>N({width:q.clientWidth,height:q.clientHeight});Q();const re=new ResizeObserver(Q);return re.observe(q),()=>re.disconnect()},[]);const I=cB({viewport:w.viewport,disabled:A,onViewportChange:pg,onZoom:Ex,onCreate:q=>{if(k(null),e.activeTheaterId&&i){const Q=SB(t);if(!Q)return;const re={...vB(q),zIndex:aa()};c(Q.pluginId,Q.kind,re)}},consumePointerDown:x!==null,onConsumePointerDown:()=>{k(null)},onClick:_B}),K=(q,Q)=>{const re=x?.canvasPoint;k(null),re&&p(q,Q,re)},F=()=>{k(null),h()},G=q=>{if(q.target instanceof Element&&q.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;q.preventDefault();const Q=T.current?.getBoundingClientRect();if(!Q)return;const re={x:q.clientX-Q.left,y:q.clientY-Q.top};k({anchor:re,canvasPoint:nc(re,w.viewport)})},B=new Set(b);M.useEffect(()=>{e.activeOperationId&&B.has(e.activeOperationId)&&fr(null)},[b,e.activeOperationId]);const Y=Object.fromEntries(Object.entries(w.operations).filter(([q])=>!B.has(q))),W=(e.operations??[]).filter(q=>q.theaterId===e.activeTheaterId),z=W,V=W.length>0,X=L.operationKinds,P=m!==null&&W.some(q=>q.id===m&&!B.has(q.id))?m:null,D=P?1:w.viewport.zoom,U=yB(w.operations)+1;return u.jsxs("main",{className:`operations-canvas ${I.spaceActive?"is-panning":""} ${I.shiftActive?"is-creating":""} ${P?"is-panel-maximized":""} ${o?"":"is-perimeter-anim-off"}`,onPointerDown:I.onPointerDown,onPointerMove:I.onPointerMove,onPointerUp:I.onPointerUp,onPointerCancel:I.onPointerCancel,onWheel:I.onWheel,onContextMenu:G,ref:T,children:[u.jsx(qI,{viewport:w.viewport,backgroundAnimationEnabled:s}),u.jsx("div",{className:"operations-canvas-world",style:{transform:P?"none":`translate(${Math.round(w.viewport.x)}px, ${Math.round(w.viewport.y)}px) scale(${w.viewport.zoom})`},children:z.map(q=>{const Q=w.operations[q.id]??q.geometry??Zp(q),re=P===q.id,ie=re?bB(R,U):Q;return wB(q,{active:v===q.id,geometry:ie,operationKindRegistry:X,status:e.operationStatus[q.id],theme:e.activeTheme,viewportZoom:D,minimized:B.has(q.id),maximized:re,accentKey:w.operationAccent[q.id]??xB(q),onActivate:()=>{fr(q.id),re||gg(q.id,w.operations[q.id]??q.geometry??Zp(q))},onClose:()=>{e.activeOperationId===q.id&&fr(null),P===q.id&&mo(),g(q.id)},onMinimize:()=>{e.activeOperationId===q.id&&fr(null),xA(q.id)},onMaximize:()=>{re?mo():(fr(q.id),$l(q.id))},onRename:Z=>{kB(q.id,Z)},onSetAccent:Z=>{C(q.id,Z)},onGeometryChange:Z=>{re||gg(q.id,Z)},onGeometryCommit:Z=>{re||EB(q.id,go().operations[q.id]??Z)}})})}),V?null:u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[u.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),u.jsx("p",{children:e.activeTheaterId?dB:"Add a Theater from the top bar to start operations."})]}),I.rubberBand?u.jsx(iB,{rect:I.rubberBand,viewport:w.viewport}):null,x?u.jsx(eh,{anchor:x.anchor,viewportBounds:mB(T.current),placement:"cursor",catalog:t,canLaunch:i,radarEnabled:s,perimeterEnabled:o,renderKindIcon:f,onLaunchKind:K,onResetView:F,onToggleRadar:d,onTogglePerimeter:_,onClose:()=>k(null)},`${x.anchor.x}:${x.anchor.y}`):null,u.jsx(HI,{operations:Y,pluginOperations:Object.fromEntries(W.filter(q=>!B.has(q.id)).map(q=>[q.id,{theaterId:q.theaterId,geometry:w.operations[q.id]??q.geometry??Zp(q)}])),viewport:w.viewport,canvasSize:R,onJump:q=>pg({x:R.width/2-q.x*w.viewport.zoom,y:R.height/2-q.y*w.viewport.zoom,zoom:w.viewport.zoom})})]})}function mB(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function _B(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}fr(null)}function vB(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Zp(e){return e.geometry??{x:0,y:0,width:fB,height:pB,zIndex:0}}function bB(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function yB(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function SB(e){const t=e.flatMap(i=>i.kinds.filter(s=>s.disabled!==!0).map(s=>({pluginId:i.id,kind:s})));return t.find(({kind:i})=>i.type==="shell")??t[0]??null}function xB(e){return typeof e.accent=="string"?e.accent:null}function wB(e,t){const i=t.operationKindRegistry.find(f=>f.pluginId===e.pluginId&&f.type===e.type),s=t.geometry;if(!i?.render)return null;const o=Ph(()=>{fi(null).then(pi).catch(()=>{})});return u.jsx(XI,{operation:e,active:t.active,geometry:s,zoom:t.viewportZoom,subtitle:i.subtitle?.(e),status:t.status,minimized:t.minimized,maximized:t.maximized,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,children:u.jsx(gm,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(CB,{active:t.active,capabilities:o,descriptor:i,geometry:s,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function CB({active:e,capabilities:t,descriptor:i,geometry:s,operation:o,theme:f,viewportZoom:p,onActivate:c,onClose:h,onGeometryChange:d}){return i.render?i.render({operationId:o.id,theaterId:o.theaterId,pluginId:o.pluginId,type:o.type,operation:o,geometry:s,active:e,zoom:p,theme:f,api:t.api,lifecycle:t.lifecycle,terminal:t.terminal,notifications:t.notifications,operations:t.operations,preferences:t.preferences,settings:t.settings,status:t.status,onActivate:c,onClose:h,onGeometryChange:d}):null}async function EB(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}async function kB(e,t){await Bx(e,t),await fi(null).then(pi)}const im="fleet-console.rail.activePanelId";function TB(){try{return localStorage.getItem(im)}catch{return null}}function _2(e){try{e===null?localStorage.removeItem(im):localStorage.setItem(im,e)}catch{}}const rm=new Set;let Fr={activeRailPanelId:TB(),panelExtraWidth:0};function u_(){for(const e of rm)e()}function v2(e){return rm.add(e),()=>{rm.delete(e)}}function b2(){return Fr}function AB(e){const t=Fr.activeRailPanelId===e?null:e;Fr={activeRailPanelId:t,panelExtraWidth:0},_2(t),u_()}function RB(){Fr.activeRailPanelId!==null&&(Fr={activeRailPanelId:null,panelExtraWidth:0},_2(null),u_())}function LB(e,t){if(e!==Fr.activeRailPanelId)return;const i=t===null||!Number.isFinite(t)?0:t,s=Math.max(0,Math.round(i)),o=typeof window<"u"?Math.min(s,Math.max(0,window.innerWidth-548)):s;o!==Fr.panelExtraWidth&&(Fr={...Fr,panelExtraWidth:o},u_())}function y2(){return M.useSyncExternalStore(v2,b2).activeRailPanelId}function MB(){return M.useSyncExternalStore(v2,b2).panelExtraWidth}function S2(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(i=>i.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function x2(e,t){const i=new Set(t.map(s=>s.id));return e.filter(s=>i.has(s.operationId))}function w2(e,t){const i=[],s=[];for(const o of e)t.has(o.operationId)?s.push(o):i.push(o);return{hidden:i,visible:s}}function sm(e){const t=new Map;for(const i of[...e].sort((s,o)=>o.lastRaisedSeq-s.lastRaisedSeq)){const s=i.theaterId??"__unknown__",o=t.get(s)??{theaterId:i.theaterId,theaterLabel:i.theaterLabel,notifications:[]};o.notifications.push(i),t.set(s,o)}return[...t.values()].sort((i,s)=>{const o=i.notifications[0]?.lastRaisedSeq??0;return(s.notifications[0]?.lastRaisedSeq??0)-o})}function C2(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const NB={ended:"Stood down","input-waiting":"Awaiting orders"},OB={id:"alerts",title:"Alerts",icon:()=>u.jsx(jB,{}),render:()=>u.jsx(DB,{})};function DB(){const e=Gr(),t=jh(),[i,s]=M.useState(!1),o=M.useMemo(()=>x2(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),f=S2(e),p=w2(o,f).hidden,c=C2(p,e.notificationPreferences),h=sm(c),d=sm(p),_=am(h,"input-waiting"),g=am(h,"ended"),S=h.length===0,C=M.useCallback(T=>{Xl(T.operationId),t("/operations")},[t]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[_>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:_}):null,g>0?u.jsx("span",{className:"notification-tally is-ended",children:g}):null,S?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${i?" is-active":""}`,onClick:()=>s(T=>!T),"aria-expanded":i,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(zB,{})})]}),i?u.jsx(IB,{groups:d}):null,S?u.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):u.jsx("div",{className:"notification-dock-deck",children:h.map(T=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:T.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:T.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:T.notifications.map(w=>u.jsxs("li",{className:`notification-row is-${w.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:w.operationLabel}),u.jsx("span",{className:"notification-row-state",children:NB[w.kind]})]}),u.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>C(w),"aria-label":`Open ${T.theaterLabel} ${w.operationLabel}`,children:"Open"})]},w.operationId))})]},T.theaterId??"__unknown__"))})]})}function jB(){const e=Gr(),i=y2()==="alerts",s=M.useMemo(()=>x2(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=S2(e),f=w2(s,o).hidden,p=C2(f,e.notificationPreferences),c=sm(p),h=c.reduce((w,m)=>w+m.notifications.length,0),d=am(c,"input-waiting"),_=M.useMemo(()=>p.reduce((w,m)=>Math.max(w,m.lastRaisedSeq),0),[p]),g=M.useRef(_),[S,C]=M.useState(0);M.useEffect(()=>{_>g.current&&!i&&C(w=>w+1),g.current=_},[_,i]);const T=h===0?"muted":d>0?"awaiting":"ended";return u.jsxs("span",{className:`alerts-icon is-${T}`,"aria-hidden":"true",children:[u.jsx(PB,{}),h>0?u.jsx("span",{className:"alerts-icon-badge",children:h}):null,S>0?u.jsx("span",{className:"alerts-icon-pulse","aria-hidden":"true"},S):null]})}function IB({groups:e}){const t=Gr(),i=BB(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:s=>W3(s.currentTarget.checked)}),u.jsx("span",{children:"Mute all"})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:s=>G3(s.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),i.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,i.map(s=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:s.theaterId?t.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&q3(s.theaterId)}}),u.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function BB(e,t,i){const s=new Map;for(const o of e)o.theaterId&&s.set(o.theaterId,o);for(const o of Object.keys(t))s.has(o)||s.set(o,{theaterId:o,theaterLabel:i.find(f=>f.id===o)?.label??o,notifications:[]});return[...s.values()]}function am(e,t){let i=0;for(const s of e)for(const o of s.notifications)o.kind===t&&(i+=1);return i}function PB(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[u.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"}),u.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function zB(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.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"}),u.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"})]})}async function HB(e,t){const s=new URLSearchParams().toString();return Eo(ha(e,`/search${s?`?${s}`:""}`))}async function $B(e,t,i){return Eo(ha(e,`/entry/${encodeURIComponent(t)}`))}async function E2(e,t="pending"){return Eo(ha(e,`/drydock?status=${encodeURIComponent(t)}`))}async function UB(e,t){return Eo(ha(e,`/drydock/${encodeURIComponent(t)}`))}async function FB(e,t,i,s){const o={action:i};return s!==void 0&&(o.reason=s),qB(ha(e,`/drydock/${encodeURIComponent(t)}/decision`),o)}async function WB(e){return Eo(ha(e,"/conflicts"))}async function GB(e,t){return Eo(ha(e,`/conflicts/${encodeURIComponent(t)}`))}function ha(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function Eo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await k2(e,t));return t.json()}async function qB(e,t){const i=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(await k2(e,i));return i.json()}async function k2(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const om=new Set,Lh={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function zl(){return Lh}function T2(e){return om.add(e),()=>om.delete(e)}function RS(e){th({currentWorkspaceId:e})}async function Mh(){th({loading:!0,error:null});try{const e=Lh.currentWorkspaceId,[t,i]=await Promise.all([HB(e),E2(e,"pending").catch(()=>null)]);th({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){th({loading:!1,error:KB(e)})}}function th(e){Object.assign(Lh,e);for(const t of om)t(Lh)}function KB(e){return e instanceof Error?e.message:String(e)}const VB=120;function nr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function YB(e,t){if(!t)return nr(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?nr(e):nr(e.slice(0,i))+`<mark>${nr(e.slice(i,i+t.length))}</mark>`+nr(e.slice(i+t.length))}function XB(e){return`<span class="codex-nav-tag">${nr(e)}</span>`}function ZB(e,t,i){const s=t?e.tags.some(c=>c.toLowerCase().includes(t.toLowerCase())):!1,o=e.tags.slice(0,3).map(XB).join(""),f=nr(e.status??"current"),p=nr(e.updated??"");return`<button
215
+ class="codex-nav-entry${i?" is-current":""}"
216
+ data-entry-id="${nr(e.id)}"
217
+ type="button"
218
+ ${i?'aria-current="page"':""}
219
+ title="${nr(e.title)}"
220
+ >
221
+ <span class="t">${YB(e.title,s?"":t)}</span>
222
+ ${o?`<span class="tg">${o}</span>`:""}
223
+ <span class="meta">${f} · ${p}</span>
224
+ </button>`}function JB(e,t){if(!t)return e;const i=t.toLowerCase();return e.filter(s=>s.title.toLowerCase().includes(i)||s.tags.some(o=>o.toLowerCase().includes(i)))}function QB(e,t){let i="",s=null,o=null;e.innerHTML=`
225
+ <div class="codex-navigator">
226
+ <div class="codex-nav-search">
227
+ <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>
228
+ <input
229
+ class="codex-nav-search-input"
230
+ type="search"
231
+ placeholder="Search entries"
232
+ autocomplete="off"
233
+ spellcheck="false"
234
+ aria-label="Search Codex entries"
235
+ />
236
+ </div>
237
+ <div class="codex-nav-quick-row">
238
+ <button class="codex-nav-quick" data-action="drydock" type="button">
239
+ ⚓ Drydock <span class="badge" id="codex-nav-drydock-badge">0</span>
240
+ </button>
241
+ <button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
242
+ </div>
243
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
244
+ <div class="codex-navigator-scroll">
245
+ <div class="codex-nav-list" id="codex-nav-list"></div>
246
+ </div>
247
+ </div>
248
+ `;const f=e.querySelector(".codex-nav-search-input"),p=e.querySelector("#codex-nav-list"),c=e.querySelector("#codex-nav-eyebrow"),h=e.querySelector("#codex-nav-drydock-badge");function d(C){const T=JB(C.index,i);if(c.textContent=`Entries · ${T.length}`,h.textContent=String(C.pendingPatchCount),h.hidden=C.pendingPatchCount===0,C.loading&&C.index.length===0){p.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(C.error){p.innerHTML=`<div class="codex-nav-error" role="alert">${nr(C.error)}</div>`;return}if(T.length===0){p.innerHTML=`<div class="codex-nav-empty">${i?"No entries match.":"No entries."}</div>`;return}p.innerHTML=T.map(w=>ZB(w,i,w.id===s)).join("")}function _(C){const T=C.target;if(!(T instanceof Element))return;const w=T.closest("[data-entry-id]");if(w?.dataset.entryId){s=w.dataset.entryId,d(zl()),t.onRequest({kind:"entry",id:s});return}const m=T.closest("[data-action]");if(m?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(m?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function g(){o!==null&&clearTimeout(o),o=setTimeout(()=>{i=f.value,d(zl())},VB)}e.addEventListener("click",_),f.addEventListener("input",g);const S=T2(C=>d(C));return d(zl()),{destroy(){S(),e.removeEventListener("click",_),f.removeEventListener("input",g),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(C){i="",s=null,f&&(f.value=""),d(zl())}}}function e9(e,t){t.initialTheaterId&&RS(t.initialTheaterId);const i=QB(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),s=T2(()=>{});Mh();const o=i.destroy.bind(i);return{destroy(){s(),o()},setTheater(f){RS(f),Mh(),i.setTheater(f)}}}function Ot(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yo(e){return Ot(e).replace(/"/g,"&quot;")}function t9(e){const t=e.tags.map(s=>`<span class="chip chip-tag">${Ot(s)}</span>`).join(""),i=i9(e);return`
249
+ <div class="meta-chips">
250
+ ${t}
251
+ ${i}
252
+ <span class="chip">Updated ${Ot(n9(e.updated))}</span>
253
+ </div>
254
+ `}function A2(e){return e.map(t=>`<span class="chip chip-muted">${Ot(t)}</span>`).join("")}function n9(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function i9(e){const t=r9(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${yo(t.title)}">${Ot(t.label)}</span>`:""}function r9(e,t=new Date){const i=e.status,s=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return i==="deprecated"||i==="superseded"?{label:i,tone:"deprecated",title:s?`${i} · stale`:i}:s?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:i==="current"||i==="draft"?{label:i,tone:"neutral",title:i}:null}const s9="active";function LS(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${yo(t.id)}" data-toc-id="${yo(t.id)}">${Ot(t.text)}</a>`).join("")}function MS(e,t,i){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const s=[...i.querySelectorAll("[data-toc-id]")],o=new Set(t.map(d=>d.id)),f=[...e.querySelectorAll("h2[id], h3[id]")].filter(d=>o.has(d.id));if(s.length===0||f.length===0)return()=>{};const p=e.closest(".codex-reading-sheet-read"),c=new Set,h=new IntersectionObserver(d=>{for(const g of d){const S=g.target instanceof HTMLElement?g.target.id:"";S&&(g.isIntersecting?c.add(S):c.delete(S))}const _=a9(f,c)??o9(f,p)??f[0]?.id??null;NS(s,_)},{root:p,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const d of f)h.observe(d);return NS(s,f[0]?.id??null),()=>h.disconnect()}function a9(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function o9(e,t){const i=t?t.getBoundingClientRect().top:0;let s=null;for(const o of e)if(o.getBoundingClientRect().top-i<=80)s=o.id;else break;return s}function NS(e,t){for(const i of e){const s=!!(t&&i.dataset.tocId===t);i.classList.toggle(s9,s),s?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function OS(e){return`/entry/${encodeURIComponent(e)}`}const R2={create_wiki:"+",update_wiki:"↻"},L2={create_wiki:"Create",update_wiki:"Update"};function l9(e,t){let i=!1,s=null,o=t,f="idle",p=null,c=null,h=null;MC(e);function d(b){const v=b.target;if(!(v instanceof Element))return;const x=v.closest("[data-patch-id]");if(x){b.preventDefault();const R=x.dataset.patchId||void 0;o.onPatchOpen?.(R);return}const k=v.closest("[data-entry-id]");if(k?.dataset.entryId){b.preventDefault(),o.onRelatedClick(k.dataset.entryId);return}const L=v.closest("[data-drydock-action]");if(L){b.preventDefault(),_(L.dataset.drydockAction);return}}function _(b){if(b){if(b==="back"){o.onPatchOpen?.(void 0);return}if(b==="approve"){f="approving",p=null,S();return}if(b==="approve-confirm"){g("approve",void 0);return}if(b==="reject"){f="rejecting",p=null,S();return}if(b==="reject-submit"){const v=e.querySelector("#queue-reject-reason")?.value.trim();if(!v){p="Rejection reason is required.",S();return}g("reject",v);return}if(b==="cancel"){f="idle",p=null,S();return}}}async function g(b,v){if(h){f="submitting",p=null,S();try{await FB(o.theaterId,h,b,v),o.onDecided?.()}catch(x){f=b==="approve"?"approving":"rejecting",p=x instanceof Error?x.message:String(x),S()}}}function S(){const b=e.querySelector("[data-decision-bar-wrap]");b&&(b.innerHTML=M2(f,p))}e.addEventListener("click",d);function C(){s?.(),s=null}async function T(b){if(!i){Jp(e,t.tocContainer),C();try{const v=await $B(o.theaterId,b);if(i)return;const{index:x}=zl(),{html:k,toc:L}=xh(v.body,{omitDuplicateTitle:v.frontmatter.title,resolveWikiLink:N=>OS(N)});e.innerHTML=`
255
+ <article class="document">
256
+ <header class="document-header">
257
+ ${c9(v.frontmatter.title)}
258
+ <h1>${Ot(v.frontmatter.title)}</h1>
259
+ ${t9(v.frontmatter)}
260
+ </header>
261
+ <div class="markdown-body" id="codex-reader-body">
262
+ ${k}
263
+ </div>
264
+ ${u9(v.frontmatter.id,v.frontmatter.tags,x)}
265
+ </article>
266
+ `,t.tocContainer.innerHTML=LS(L);const R=e.querySelector("article");R&&L.length>0&&(s=MS(R,L,t.tocContainer))}catch(v){i||Qp(e,t.tocContainer,v)}}}async function w(b){if(!i){Jp(e,t.tocContainer),C(),c=null,h=null,f="idle",p=null;try{if(b){const v=await UB(o.theaterId,b);if(i)return;c=v.meta,h=b;const{html:x,toc:k}=xh(v.wikiEntry.body,{omitDuplicateTitle:v.wikiEntry.title,resolveWikiLink:R=>OS(R)});e.innerHTML=f9(v,x),t.tocContainer.innerHTML=LS(k);const L=e.querySelector("article");L&&k.length>0&&(s=MS(L,k,t.tocContainer))}else{const v=await E2(o.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=h9(v.items,"Drydock — Pending Patches")}}catch(v){i||Qp(e,t.tocContainer,v)}}}async function m(b){if(!i){Jp(e,t.tocContainer),C();try{if(b){const v=await GB(o.theaterId,b);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=m9(v)}else{const v=await WB(o.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=_9(v)}}catch(v){i||Qp(e,t.tocContainer,v)}}}return t.kind==="entry"&&t.initialEntryId?T(t.initialEntryId):t.kind==="drydock"?w(t.subId):t.kind==="conflicts"&&m(t.subId),{destroy(){i=!0,e.removeEventListener("click",d),C()},async setEntry(b){await T(b)},async navigateSub(b){t.kind==="drydock"?await w(b):t.kind==="conflicts"&&await m(b)},refreshCallbacks(b){o={...o,...b}}}}function Jp(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Qp(e,t,i){const s=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${Ot(s)}</div>`,t.innerHTML=""}function c9(e){return`
267
+ <nav class="breadcrumb" aria-label="Entry location">
268
+ <ol>
269
+ <li><span>Codex</span></li>
270
+ <li><span aria-current="page">${Ot(e)}</span></li>
271
+ </ol>
272
+ </nav>
273
+ `}function u9(e,t,i){const s=new Set(t),o=i.filter(f=>f.id!==e).map(f=>({entry:f,matchingTags:f.tags.filter(p=>s.has(p))})).filter(f=>f.matchingTags.length>0).sort((f,p)=>p.matchingTags.length-f.matchingTags.length||f.entry.title.localeCompare(p.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return o.length===0?"":`
274
+ <section class="related-list">
275
+ <h2>Related entries</h2>
276
+ <div class="related-items">
277
+ ${o.map(f=>`<button class="related-card" type="button" data-entry-id="${yo(f.entry.id)}">
278
+ <strong>${Ot(f.entry.title)}</strong>
279
+ <span>${A2(f.matchingTags)}</span>
280
+ </button>`).join("")}
281
+ </div>
282
+ </section>
283
+ `}function h9(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
284
+ <article class="document">
285
+ <header class="document-header">
286
+ <nav class="breadcrumb" aria-label="Entry location">
287
+ <ol>
288
+ <li><span>Codex</span></li>
289
+ <li><span aria-current="page">Drydock</span></li>
290
+ </ol>
291
+ </nav>
292
+ <h1>${Ot(t)}</h1>
293
+ </header>
294
+ <div class="queue-row-list">
295
+ ${e.map(d9).join("")}
296
+ </div>
297
+ </article>
298
+ `}function d9(e){const t=e.op??"create_wiki",i=R2[t]??"?",s=L2[t]??"Patch",o=e.target??e.id,p=[v9(e.meta.createdAt)].filter(Boolean);return`
299
+ <button class="queue-row" type="button" data-patch-id="${yo(e.id)}" aria-label="${yo(s+": "+o)}">
300
+ <span class="queue-row-badge" aria-hidden="true">
301
+ <span class="op-badge">${i}</span>
302
+ </span>
303
+ <span class="queue-row-body">
304
+ <span class="queue-row-target">${Ot(o)}</span>
305
+ ${e.summary?`<span class="queue-row-summary">${Ot(e.summary)}</span>`:""}
306
+ ${p.length>0?`<span class="queue-row-meta">${p.map(Ot).join(" · ")}</span>`:""}
307
+ </span>
308
+ </button>
309
+ `}function f9(e,t){const{patch:i,meta:s,wikiEntry:o,targetExists:f}=e,p=i.frontmatter.op,c=R2[p]??"?",h=L2[p]??"Patch",d=f?"기존 문서 대체":"신규 문서 생성",_=s.status==="pending";return`
310
+ <article class="document">
311
+ <header class="document-header">
312
+ <nav class="breadcrumb" aria-label="Entry location">
313
+ <ol>
314
+ <li><span>Codex</span></li>
315
+ <li><span>Drydock</span></li>
316
+ <li><span aria-current="page">${Ot(h)}</span></li>
317
+ </ol>
318
+ </nav>
319
+ <button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
320
+ <h1><span class="op-badge">${c}</span> ${Ot(o.title)}</h1>
321
+ <p class="eyebrow">${Ot(i.frontmatter.target)} · v${o.version} · ${Ot(d)}</p>
322
+ ${p9(i.frontmatter.proposer,o.tags)}
323
+ </header>
324
+ <div class="markdown-body" id="codex-reader-body">
325
+ ${t}
326
+ </div>
327
+ <div class="queue-decision-section" data-decision-bar-wrap>
328
+ ${_?M2("idle",null):g9(s)}
329
+ </div>
330
+ </article>
331
+ `}function p9(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${Ot(e)}</span>`),t.length>0&&i.push(A2(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function M2(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
332
+ <p class="queue-decision-confirm">Apply this patch to the wiki?</p>
333
+ <div class="queue-action-buttons">
334
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
335
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
336
+ </div>
337
+ ${t?`<p class="queue-action-error">${Ot(t)}</p>`:""}
338
+ `:e==="rejecting"?`
339
+ <div class="queue-reject-form">
340
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
341
+ <div class="queue-action-buttons">
342
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
343
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
344
+ </div>
345
+ ${t?`<p class="queue-action-error">${Ot(t)}</p>`:""}
346
+ </div>
347
+ `:`
348
+ <div class="queue-action-buttons">
349
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
350
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
351
+ </div>
352
+ `}function g9(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",s=t?"queue-decision-decided--approve":"queue-decision-decided--reject",o=e.reason?` · ${Ot(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${i}${o}</p>`}function m9(e){return`
353
+ <article class="document">
354
+ <header class="document-header">
355
+ <nav class="breadcrumb" aria-label="Entry location">
356
+ <ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
357
+ </nav>
358
+ <h1>${Ot(e.id)}</h1>
359
+ <p class="eyebrow">Conflict · ${Ot(e.meta?.status??"open")}</p>
360
+ </header>
361
+ <div class="markdown-body">
362
+ ${e.current?`<h2>Current</h2><pre><code>${Ot(e.current)}</code></pre>`:""}
363
+ ${e.proposed?`<h2>Proposed</h2><pre><code>${Ot(e.proposed)}</code></pre>`:""}
364
+ </div>
365
+ </article>
366
+ `}function _9(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
367
+ <article class="document">
368
+ <header class="document-header">
369
+ <h1>Conflicts</h1>
370
+ </header>
371
+ <div class="markdown-body">
372
+ <ul class="queue-list">
373
+ ${e.map(t=>`<li class="queue-item">
374
+ <strong>${Ot(t.title||t.id)}</strong>
375
+ <span class="eyebrow">${Ot(t.status)}</span>
376
+ </li>`).join("")}
377
+ </ul>
378
+ </div>
379
+ </article>
380
+ `}function v9(e){try{const i=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(i<1)return"< 1h ago";if(i<24)return`${Math.floor(i)}h ago`;const s=i/24;return s<7?`${Math.floor(s)}d ago`:s<30?`${Math.floor(s/7)}w ago`:`${Math.floor(s/30)}mo ago`}catch{return""}}let Qs=null,ic=null,N2=null,Ts=null,ea=null,Es=null,nh=null,eg=null,ih,lm=0;function DS(e){N2=e}function b9(e,t){const i=x9();i.parentElement!==e&&e.appendChild(i),ic||(ic=e9(i,{initialTheaterId:t,onRequest:s=>N2?.(s)}))}function y9(e){ic?.setTheater(e)}function O2(e,t,i){const s=w9(),o=C9(),f=s.parentElement,p=i.kind==="entry"&&nh==="entry"&&i.initialEntryId===eg;f&&f!==e&&(lm=f.scrollTop),s.parentElement!==e&&e.appendChild(s),o.parentElement!==t&&t.appendChild(o),!Es||nh!==i.kind?(Es?.destroy(),Es=l9(s,{...i,tocContainer:o}),nh=i.kind,ih=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==eg?Es.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==ih&&(ih=i.subId,Es.navigateSub(i.subId)),eg=i.kind==="entry"?i.initialEntryId??null:null,Es.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const c=p?lm:0;requestAnimationFrame(()=>{e.scrollTop=c})}function S9(){const e=Ts?.parentElement;e&&(lm=e.scrollTop)}function D2(){Es?.destroy(),Es=null,nh=null,ih=void 0,Ts?.parentElement&&Ts.parentElement.removeChild(Ts),ea?.parentElement&&ea.parentElement.removeChild(ea)}function jS(){D2(),ic?.destroy(),ic=null,Qs?.parentElement&&Qs.parentElement.removeChild(Qs)}function x9(){return Qs||(Qs=document.createElement("div"),Qs.className="codex-host"),Qs}function w9(){return Ts||(Ts=document.createElement("div"),Ts.className="codex-reader-host"),Ts}function C9(){return ea||(ea=document.createElement("div"),ea.className="codex-toc-host"),ea}const E9={id:"codex",title:"Codex",icon:()=>u.jsx(A9,{}),render:()=>u.jsx(k9,{})};function k9(){const e=Gr(),t=M.useRef(null),i=M.useRef(null),s=M.useRef(null),o=e.codexReader,f=o!==null,p=e.codexReaderExpanded,c=e.theaters.find(S=>S.id===e.activeTheaterId)??null,h=c?.id??null,d=!!c?.hasWiki,_=e.theaters.length>0,g=o?`${o.kind}:${o.kind==="entry"?o.entryId:o.kind==="drydock"?o.patchId??"":o.id??""}`:null;return M.useEffect(()=>{if(!d){jS();return}return()=>{jS()}},[d]),M.useEffect(()=>{if(!d||!h)return;const S=t.current;if(S)return b9(S,h),DS(C=>{C.kind==="entry"?$r({kind:"entry",entryId:C.id}):C.kind==="drydock"?$r({kind:"drydock",patchId:C.patchId}):C.kind==="conflicts"&&$r({kind:"conflicts",id:C.id})}),()=>{DS(null)}},[d,h,f]),M.useEffect(()=>{d&&h&&y9(h)},[h,d]),M.useEffect(()=>{if(!d||!h||!f||p||!i.current||!s.current||!o)return;const S=o.kind,C=S==="drydock"?o.patchId:S==="conflicts"?o.id:void 0;O2(i.current,s.current,{initialEntryId:S==="entry"?o.entryId:"",kind:S,subId:C,theaterId:h,onRelatedClick:T=>$r({kind:"entry",entryId:T}),onClose:()=>yb(),onPatchOpen:T=>$r({kind:"drydock",patchId:T}),onDecided:()=>{Mh(),$r({kind:"drydock",patchId:void 0})}})},[d,h,f,p,g]),M.useEffect(()=>{f||D2()},[f]),d?f?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:Ku,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:yb,children:"✕"})]}),u.jsx("div",{ref:i,className:"codex-doc-scroll"}),u.jsx("div",{ref:s,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:t,className:"codex-nav-pane"})]}):u.jsx("div",{ref:t,className:"codex-rail-host"}):u.jsx(T9,{activeTheater:c,hasTheaters:_})}function T9({activeTheater:e,hasTheaters:t}){return t?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:e?.label??"This Theater"}),u.jsx("p",{children:"This Theater does not have Fleet Wiki data mounted."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}function A9(){return u.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:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),u.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),u.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}const R9=[OB,E9];function L9(e="right"){const{railPanels:t}=lc();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const M9=360;function N9(e){const{codexReader:t}=Gr();return e==="codex"&&t!==null?M9:0}const j2=240,O9=312,I2="fleet-console.rail.panelWidth";function D9(){try{const e=localStorage.getItem(I2);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=j2)return t}}catch{}return O9}function j9({theaterId:e,api:t}){const i=y2(),s=L9(),o=R9,p=[...o,...s].find(b=>b.id===i)??null,c=p!==null,h=N9(i)+(p?.preferredExtraWidth??0)+MB(),d=M.useRef(h);d.current=h;const[_,g]=M.useState(D9),S=M.useRef(_),[C,T]=M.useState(!1),w=M.useCallback(b=>{b.preventDefault();const v=b.clientX,x=S.current;T(!0);const k=R=>{const N=v-R.clientX,A=window.innerWidth-148-d.current,I=Math.max(j2,Math.min(A,x+N));S.current=I,g(I)},L=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",L),T(!1);try{localStorage.setItem(I2,String(S.current))}catch{}};document.addEventListener("pointermove",k),document.addEventListener("pointerup",L)},[]),m=M.useMemo(()=>({theaterId:e,api:t,requestExtraWidth:b=>{i!==null&&LB(i,b)}}),[e,t,i]);return u.jsxs("div",{className:`right-rail${c?" is-open":""}${C?" is-dragging":""}`,role:"complementary","aria-label":"Activity Rail",children:[u.jsxs("div",{className:"right-rail-panel-slot",style:c?{width:_+h}:void 0,children:[c&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:w,"aria-hidden":"true"}),p&&u.jsx(I9,{activePanel:p,activeId:i,ctx:m})]}),u.jsxs("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:[u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[o.map(b=>u.jsx(IS,{panel:b,isActive:i===b.id},b.id)),o.length>0&&s.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,s.map(b=>u.jsx(IS,{panel:b,isActive:i===b.id},b.id))]}),u.jsx("div",{className:"right-rail-route-spacer","aria-hidden":"true"}),u.jsx("div",{className:"right-rail-divider right-rail-route-divider",role:"separator","aria-hidden":"true"}),u.jsxs("div",{className:"right-rail-route-nav","aria-label":"Console routes",children:[u.jsx(BS,{to:"/carrier-settings",label:"Carriers",icon:u.jsx(B9,{})}),u.jsx(BS,{to:"/settings",label:"Settings",icon:u.jsx(P9,{})})]})]})]})}const I9=M.memo(function({activePanel:t,activeId:i,ctx:s}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:RB,children:"✕"})]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:t.render(s)})]})});function IS({panel:e,isActive:t}){const i=M.useCallback(()=>AB(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon;return u.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:i,children:s})}function BS({to:e,label:t,icon:i}){return u.jsx(uh,{to:e,className:({isActive:s})=>`right-rail-route-link${s?" is-active":""}`,"aria-label":t,title:t,children:i})}function B9(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),u.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function P9(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}const PS=8,z9=260;function zS(e){const{anchor:t,onClose:i}=e,[s,o]=M.useState(void 0);return M.useLayoutEffect(()=>{const f=Math.max(8,Math.min(t.left,window.innerWidth-208)),p=t.bottom+PS,c=p+z9>window.innerHeight;o(c?{position:"fixed",left:f,top:"auto",bottom:Math.round(window.innerHeight-t.top+PS)}:{position:"fixed",left:f,top:Math.round(p)})},[t]),M.useEffect(()=>{const f=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",f),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",f),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]),pr.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:s,onPointerDown:f=>f.stopPropagation(),children:e.kind==="chip"?u.jsx(H9,{...e}):u.jsx($9,{...e})}):null}),document.body)}function H9({operation:e,groups:t,accentKey:i,actions:s,onClose:o}){const[f,p]=M.useState(!1),[c,h]=M.useState(`Group ${t.length+1}`),d=M.useRef(!1),_=M.useRef(null);M.useEffect(()=>{f&&_.current?.select()},[f]);const g=()=>{const S=c.trim();S&&(s.onCreateGroup(S),o())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(S=>{const C=bo(S.color),T=e.groupId===S.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${T?" is-selected":""}`,role:"menuitemradio","aria-checked":T,onClick:()=>{s.onSetGroupId(T?null:S.id),o()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:C?{background:C}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:S.name}),T?u.jsx(U9,{}):null]},S.id)}),f?u.jsx("input",{ref:_,className:"group-context-menu-new-input",type:"text",value:c,onChange:S=>h(S.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:S=>{S.key==="Enter"&&!d.current&&(S.preventDefault(),g()),S.key==="Escape"&&(S.preventDefault(),p(!1))},onBlur:()=>p(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>p(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>{s.onSetAccent(null),o()},children:[u.jsx("span",{}),"None"]}),u.jsx("div",{className:"group-context-menu-swatches",children:qh.map(S=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":S.label,"aria-pressed":i===S.key,onClick:()=>{s.onSetAccent(S.key),o()},children:u.jsx("span",{style:{background:S.color}})},S.key))})]})}function $9({group:e,actions:t,onClose:i}){const[s,o]=M.useState(e.name),[f,p]=M.useState(!1),c=M.useRef(!1),h=()=>{const d=s.trim();if(!d||d===e.name){i();return}t.onRename(d),i()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx("div",{className:"group-context-menu-swatches",children:qh.map(d=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":d.label,"aria-pressed":e.color===d.key,onClick:()=>{t.onSetColor(d.key),i()},children:u.jsx("span",{style:{background:d.color}})},d.key))}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:s,onChange:d=>o(d.target.value),onCompositionStart:()=>{c.current=!0},onCompositionEnd:()=>{c.current=!1},onKeyDown:d=>{d.key==="Enter"&&!c.current&&(d.preventDefault(),h()),d.key==="Escape"&&(d.preventDefault(),i())},onBlur:h,"aria-label":"Group name"}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${f?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!f){p(!0);return}t.onUngroupAll(),i()},"aria-label":f?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:f?"Confirm ungroup all?":"Ungroup all"})]})}function U9(){return u.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:u.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function F9(e,t,i,s){if(!i)return{groupId:null,index:0};for(const f of t){const p=f.groupId??"__ungrouped__",c=i.querySelector(`[data-drop-zone-group-id="${p}"]`);if(!c)continue;const h=c.getBoundingClientRect();if(e<h.top||e>h.bottom)continue;const d=c.querySelector(`[data-group-section-id="${p}"]`);if(!d||e<d.getBoundingClientRect().top)return{groupId:f.groupId,index:0};const _=Array.from(d.querySelectorAll("[data-side-bar-chip-id]"));for(const g of _){const S=g.dataset.sideBarChipId;if(!S||S===s)continue;const C=g.getBoundingClientRect();if(e<=C.top+C.height/2)return{groupId:f.groupId,index:Math.max(0,f.entryIds.indexOf(S))}}return{groupId:f.groupId,index:f.entryIds.length}}const o=t[t.length-1];return{groupId:o?.groupId??null,index:o?.entryIds.length??0}}function W9(e,t,i,s){if(!i)return 0;const o=Array.from(i.querySelectorAll("[data-drop-zone-group-id]"));for(const f of o){const p=f.dataset.dropZoneGroupId;if(!p||p==="__ungrouped__"||p===s)continue;const c=t.indexOf(p);if(c===-1)continue;const h=f.getBoundingClientRect();if(e<=h.top+h.height/2)return c}return t.length}function G9(e,t,i,s){const o=e.filter(_=>_!==t),f=new Set(s),p=o.filter(_=>f.has(_)),c=Math.max(0,Math.min(i,p.length));if(p.length===0)return[...o,t];if(c<p.length){const _=o.indexOf(p[c]),g=[...o];return g.splice(_,0,t),g}const h=o.indexOf(p[p.length-1]),d=[...o];return d.splice(h+1,0,t),d}function q9(e,t,i,s){const o=new Set(s),f=e.filter(g=>o.has(g)),p=f.indexOf(t),c=f.filter(g=>g!==t),h=i>p?i-1:i,d=Math.max(0,Math.min(h,c.length));c.splice(d,0,t);let _=0;return e.map(g=>o.has(g)?c[_++]??g:g)}function K9(e,t,i){if(i.length!==t.length)return[...e];const s=new Set(t);let o=0;return e.map(f=>s.has(f)?i[o++]??f:f)}function V9(e,t,i){const s=e.indexOf(t);if(s===-1)return[...e];const o=e.filter(c=>c!==t),f=i>s?i-1:i,p=Math.max(0,Math.min(f,o.length));return o.splice(p,0,t),o}function Y9(e,t,i){if(e.indexOf(t)===-1)return[...e];const o=e.filter(p=>p!==t),f=Math.max(0,Math.min(i,o.length));return o.splice(f,0,t),o}function B2({entry:e,index:t,isCloseArmed:i,accentValue:s,dragging:o,dragOffsetY:f,dropTarget:p,preview:c=!1,onArmClose:h,onDisarmClose:d,onClose:_,onFocus:g,onKeyboardMove:S,onPointerDragStart:C,onOpenAccent:T,onRename:w}){const m=M.useRef(!1),{operation:b,active:v,minimized:x,notificationCount:k}=e,L=X9(b),R=m2({currentTitle:L,onCommit:Y=>w(b.id,Y),onBegin:d}),N=["side-bar-chip",v?"side-bar-chip--active":"",x?"side-bar-chip--minimized":"",o?"side-bar-chip--dragging":"",p?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),A=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),I={"--i":t,...s?{"--chip-accent":s}:{},...o?{"--drag-dy":`${Math.round(f)}px`}:{}},K=()=>{if(d(),m.current){m.current=!1;return}g(b.id)},F=Y=>{Y.stopPropagation()},G=Y=>{if(Y.stopPropagation(),!i){h(b.id);return}d(),_(b.id)},B=Y=>{Y.preventDefault(),d(),T(b.id,Y.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":b.id,className:N,role:"button",tabIndex:0,"aria-label":v?`${L} (focused)`:`Focus operation ${L}`,"aria-current":v?"true":void 0,title:c?"Click to open in its Theater":v?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:I,onClick:K,onContextMenu:c?void 0:B,onFocus:()=>{i||d()},onPointerDown:Y=>C(Y,b.id),onPointerUp:()=>{o&&(m.current=!0)},onKeyDown:Y=>{if(Y.target===Y.currentTarget){if(!c&&Y.altKey&&Y.shiftKey&&(Y.key==="ArrowUp"||Y.key==="ArrowDown")){Y.preventDefault(),S(b.id,Y.key==="ArrowUp"?-1:1);return}(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),K())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(J9,{})})}),R.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:R.inputRef,value:R.draftTitle,"aria-label":`Rename operation ${L}`,onChange:Y=>R.setDraftTitle(Y.target.value),onKeyDown:R.handleKeyDown,onBlur:R.handleBlur,onPointerDown:Y=>Y.stopPropagation(),onClick:Y=>Y.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:c?void 0:R.begin,children:L}),k>0?u.jsx("span",{className:"side-bar-chip-count",children:k}):null,c?null:u.jsx("button",{type:"button",className:A,onPointerDown:F,onClick:G,"aria-label":i?`Confirm close operation ${L}`:`Close operation ${L}`,title:i?"Confirm close":"Close operation",children:i?"Close?":u.jsx(Z9,{})})]})}function X9(e){return e.title}function Z9(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.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 J9(){return u.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function Q9({group:e,count:t,collapsed:i,tier:s,dragging:o,dropTarget:f,dragOffsetY:p,onToggle:c,onContextMenu:h,onPointerDragStart:d}){const _=M.useRef(!1),g=bo(e.color),S=["side-bar-group-header",s==="rail"?"side-bar-group-header--rail":"",o?"side-bar-group-header--dragging":"",f?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),C={...g?{"--grp-color":g}:{},...o?{"--drag-dy":`${Math.round(p)}px`}:{}},T=v=>{v.preventDefault(),h(e.id,v.currentTarget.getBoundingClientRect())},w=v=>{v.target instanceof Element&&v.target.closest("button")||d(v,e.id)},m=()=>{o&&(_.current=!0)},b=()=>{if(_.current){_.current=!1;return}c(e.id)};return s==="rail"?u.jsx("div",{className:S,"data-tier":"rail",style:C,onClick:b,onContextMenu:T,onPointerDown:w,onPointerUp:m,role:"button",tabIndex:0,"aria-label":`Group ${e.name}`,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b())},children:u.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"})}):u.jsxs("div",{className:S,style:C,onContextMenu:T,onPointerDown:w,onPointerUp:m,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>c(e.id),"aria-expanded":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:u.jsx(eP,{collapsed:i})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function eP({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const P2="fleet-console.operations.side-width",z2="fleet-console.operations.side-collapsed",H2="fleet-console.operations.theater-collapsed",Nh=56,tP=180,HS=tP;function nP(){return typeof window<"u"?window.innerWidth-480:800}function iP(){try{if(typeof window>"u")return HS;const e=localStorage.getItem(P2);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=Nh)return t}}catch{}return HS}function rP(){try{return typeof window>"u"?!1:localStorage.getItem(z2)==="1"}catch{}return!1}let rc={width:iP(),collapsed:rP()};const cm=new Set;let rh=aP();const um=new Set;function $2(){for(const e of cm)e()}function $S(){return rc}function sP(e){return cm.add(e),()=>{cm.delete(e)}}function aP(){try{if(typeof window>"u")return[];const e=localStorage.getItem(H2);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{}return[]}function oP(){for(const e of um)e()}function US(){return rh}function lP(e){return um.add(e),()=>{um.delete(e)}}function cP(){return M.useSyncExternalStore(sP,$S,$S)}function uP(){return M.useSyncExternalStore(lP,US,US)}function FS(e){const t=Math.max(Nh,Math.min(nP(),e));rc={...rc,width:t};try{typeof window<"u"&&localStorage.setItem(P2,String(t))}catch{}$2()}function hP(e){rc={...rc,collapsed:e};try{typeof window<"u"&&localStorage.setItem(z2,e?"1":"0")}catch{}$2()}function dP(e,t){const i=new Set(rh);t?i.add(e):i.delete(e);const s=Array.from(i);if(s.join("\0")!==rh.join("\0")){rh=s;try{typeof window<"u"&&localStorage.setItem(H2,JSON.stringify(s))}catch{}oP()}}function fP(e){return e<120?"rail":e<240?"list":"detail"}function U2(e,t){const i=e.find(o=>o.id===t.pluginId)?.kinds.filter(o=>o.type===t.type)??[],s=t.payload.launchKindId;if(typeof s=="string"){const o=i.find(f=>f.id===s);if(o)return o}return i.length===1?i[0]:null}const pP=1500,gP=6,WS=34,GS=18,mP=4,_P=36;function vP({theaters:e,activeTheaterId:t,operations:i,groups:s,minimized:o,activeOperationId:f,operationNotifications:p,catalog:c,canLaunch:h,addingTheater:d,theaterError:_,radarEnabled:g,perimeterEnabled:S,renderKindIcon:C,onLaunchKind:T,onResetView:w,onToggleRadar:m,onTogglePerimeter:b,onClose:v,onFocus:x,onSetAccent:k,onRename:L,onSetGroupId:R,onCreateGroup:N,onSetGroupColor:A,onRenameGroup:I,onReorderGroups:K,onUngroupAll:F,onSelectTheater:G,onAddTheater:B,onCancelAddTheater:Y,onForgetTheater:W}){const z=M.useRef(null),V=M.useRef(null),X=cP(),{width:j,collapsed:P}=X,D=P?"rail":fP(j),U=Sx(),q=M.useRef(null),[Q,re]=M.useState(null),[ie,Z]=M.useState(null),H=M.useRef(null),oe=M.useRef([]),fe=M.useRef([]),Se=M.useRef([]),ye=M.useRef([]),De=M.useRef(R),Fe=M.useRef(K),[Be,Ke]=M.useState(null),[ke,dt]=M.useState(null),[Pt,Ct]=M.useState(null),[Gn,qn]=M.useState(!1),[Zt,ht]=M.useState(!1),Jt=SA(),zt=uP(),Kt=i.filter(de=>de.theaterId===t),nn=s.filter(de=>de.theaterId===t),ni=new Set(o),xn=new Set(Jt),Qt=Nm(Kt,U.operationOrder).map(de=>{const je=U2(c,de),vt=je?C(de.pluginId,je):null;return{operation:de,active:f===de.id,minimized:ni.has(de.id),notificationCount:p[de.id]?1:0,icon:vt}}),lt=F2(Qt,nn,U.operationOrder),hn=lt.flatMap(de=>de.groupId?[de.groupId]:[]),Ht=lt.flatMap(de=>xn.has(de.groupId??"")?[]:de.entries),$t=Qt.map(de=>de.operation.id),Et=M.useCallback(()=>{q.current!==null&&(window.clearTimeout(q.current),q.current=null)},[]),mi=M.useCallback(()=>{Et(),re(null)},[Et]),Yi=M.useCallback(de=>{Et(),re(de),q.current=window.setTimeout(()=>{q.current=null,re(null)},pP)},[Et]);M.useEffect(()=>Et,[Et]),M.useEffect(()=>{Q!==null&&(Qt.some(de=>de.operation.id===Q)||mi())},[Q,Qt,mi]);const Hn=Be?.kind==="chip"?Qt.find(de=>de.operation.id===Be.operationId)?.operation??null:null,Ln=Be?.kind==="group"?s.find(de=>de.id===Be.groupId)??null:null,$n=Be?.kind==="theater"?e.find(de=>de.id===Be.theaterId)??null:null,Xi=(de,je)=>{const vt=Ht.findIndex(en=>en.operation.id===de);if(vt===-1)return;const nt=Math.max(0,Math.min(Ht.length-1,vt+je));if(nt===vt)return;const Ae=Ht.map(en=>en.operation.id),bt=Y9(Ae,de,nt);ap(K9($t,Ae,bt))},rn=lt.map(de=>({groupId:de.groupId,entryIds:de.entries.map(je=>je.operation.id)}));M.useEffect(()=>{oe.current=Qt,fe.current=$t,Se.current=rn,ye.current=hn,De.current=R,Fe.current=K});const ee=de=>{H.current=de,Z(de)},pe=ie?.pointerId??null;M.useEffect(()=>{if(pe===null)return;const de=nt=>{if(nt.pointerId!==pe)return;const Ae=H.current;if(!Ae)return;if(nt.buttons===0){ee(null);return}const bt=Math.hypot(nt.clientX-Ae.startX,nt.clientY-Ae.startY);if(!Ae.dragging&&bt<gP)return;if(Ae.dragging&&nt.preventDefault(),xP(nt.clientY,V.current),Ae.kind==="chip"){const wn=F9(nt.clientY,Se.current,V.current,Ae.sourceId);ee({...Ae,currentY:nt.clientY,dragging:!0,dropIndex:wn.index,dropGroupId:wn.groupId});return}const en=W9(nt.clientY,ye.current,V.current,Ae.sourceGroupId);ee({...Ae,currentY:nt.clientY,dragging:!0,dropIndex:en})},je=nt=>{if(nt.pointerId!==pe)return;const Ae=H.current;if(ee(null),!Ae?.dragging)return;if(Ae.kind==="group"){const wt=V9(ye.current,Ae.sourceGroupId,Ae.dropIndex);if(wt.join("\0")===ye.current.join("\0"))return;Fe.current(wt);return}const{sourceId:bt,sourceGroupId:en,dropIndex:wn,dropGroupId:Re}=Ae,J=Se.current,me=fe.current;if(Re!==en){const Dt=J.find(be=>be.groupId===Re)?.entryIds??[];ap(G9(me,bt,wn,Dt)),De.current(bt,Re);return}const Qe=J.find(wt=>wt.groupId===en)?.entryIds??[],$e=Qe.indexOf(bt);if($e===-1||wn===$e)return;const yt=q9(me,bt,wn,Qe);ap(yt)},vt=nt=>{nt.pointerId===pe&&ee(null)};return window.addEventListener("pointermove",de),window.addEventListener("pointerup",je),window.addEventListener("pointercancel",vt),()=>{window.removeEventListener("pointermove",de),window.removeEventListener("pointerup",je),window.removeEventListener("pointercancel",vt)}},[pe]);const xe=(de,je)=>{if(de.button!==0||de.target instanceof Element&&de.target.closest("button"))return;Ke(null),mi();const nt=Qt.find(Ae=>Ae.operation.id===je)?.operation.groupId??null;ee({kind:"chip",sourceId:je,sourceGroupId:nt,pointerId:de.pointerId,startX:de.clientX,startY:de.clientY,currentY:de.clientY,dragging:!1,dropIndex:$t.indexOf(je),dropGroupId:nt})},Pe=(de,je)=>{de.button===0&&(de.target instanceof Element&&de.target.closest("button")||hn.includes(je)&&(Ke(null),mi(),ee({kind:"group",sourceGroupId:je,pointerId:de.pointerId,startX:de.clientX,startY:de.clientY,currentY:de.clientY,dragging:!1,dropIndex:hn.indexOf(je)})))},xt=M.useCallback(de=>{de.preventDefault();const je=de.clientX,vt=X.width;ht(!0);const nt=bt=>{const en=bt.clientX-je;FS(vt+en)},Ae=()=>{ht(!1),document.removeEventListener("pointermove",nt),document.removeEventListener("pointerup",Ae),document.removeEventListener("pointercancel",Ae)};document.addEventListener("pointermove",nt),document.addEventListener("pointerup",Ae),document.addEventListener("pointercancel",Ae)},[X.width]),ft=()=>{hP(!P),P||FS(Nh)},Te=()=>{dt(null),Ct(null),Ke(null),qn(!0)},Ce=()=>{qn(!1),Y()},ze=de=>{qn(!1),B(de)},It=de=>{de.defaultPrevented||(de.preventDefault(),Ct(null),Ke(null),dt({anchor:{x:de.clientX,y:de.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},et=de=>{if(Pt){Ct(null);return}dt(null);const je=de.currentTarget.getBoundingClientRect(),vt=z.current?.getBoundingClientRect().right??je.right;Ct({anchor:{x:Math.max(je.right+8,vt+_P),y:je.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},dn=M.useCallback(()=>{const de=Be?.kind==="theater"?Be.returnFocus:null;Ke(null),de?.focus()},[Be]),Mi=(de,je)=>{de.stopPropagation(),je!==t&&G(je),Ct(null),Ke(null);const vt=de.currentTarget.getBoundingClientRect();dt({anchor:{x:vt.right+8,y:vt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Ni=de=>{dP(de,!zt.includes(de))},Mn=P?Nh:j;return Qt.length===0&&D==="rail"?u.jsxs("aside",{className:"operations-side-bar",ref:z,"data-tier":D,"data-resizing":Zt?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${Mn}px`},onContextMenu:It,children:[u.jsx("header",{className:"operations-side-bar-header",children:u.jsx("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Te,disabled:d,"aria-label":"Add Theater",title:d?"Adding Theater":"Add Theater",children:u.jsx(sh,{})})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:xt,onDoubleClick:ft,"aria-hidden":"true"}),ke?pr.createPortal(u.jsx(eh,{anchor:ke.anchor,viewportBounds:ke.viewportBounds,placement:"cursor",mode:"launch",catalog:c,canLaunch:h,renderKindIcon:C,onLaunchKind:(de,je)=>{dt(null),T(de,je)},onResetView:w,onClose:()=>dt(null)},`${ke.anchor.x}:${ke.anchor.y}`),document.body):null,u.jsx(wg,{open:Gn,onCancel:Ce,onConfirm:ze})]}):u.jsxs("aside",{className:"operations-side-bar",ref:z,"data-tier":D,"data-resizing":Zt?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${Mn}px`},onContextMenu:It,children:[u.jsxs("header",{className:"operations-side-bar-header",children:[D!=="rail"?u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Te,disabled:d,"aria-label":"Add Theater",title:d?"Adding Theater":"Add Theater",children:[u.jsx(sh,{}),u.jsx("span",{children:"Theater"})]}):u.jsx("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Te,disabled:d,"aria-label":"Add Theater",title:d?"Adding Theater":"Add Theater",children:u.jsx(sh,{})}),D!=="rail"?u.jsx("button",{type:"button",className:"side-bar-settings-btn",onClick:et,"aria-expanded":Pt!==null,"aria-label":"Map and display controls",title:"Map and display controls",children:u.jsx(EP,{})}):null]}),D!=="rail"&&_?u.jsx("p",{className:"side-bar-theater-error",children:_}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:V,"aria-label":"Operations",children:e.map(de=>{const je=de.id===t,vt=i.filter(Ae=>Ae.theaterId===de.id).length,nt=zt.includes(de.id);if(D==="rail"&&!je)return null;if(!je){const Ae=bP({theaterId:de.id,operations:i,operationOrder:U.operationOrder,minimizedSet:ni,activeOperationId:null,operationNotifications:p,catalog:c,renderKindIcon:C});return u.jsx(yP,{theater:de,entries:nt?[]:Ae,groups:s.filter(bt=>bt.theaterId===de.id),operationCount:vt,collapsed:nt,tier:D,onSelectTheater:G,onFocus:x,onToggleCollapsed:Ni,onOpenActions:(bt,en)=>{dt(null),Ct(null),Ke({kind:"theater",theaterId:de.id,anchor:bt,returnFocus:en})},onOpenLaunch:Mi,onContextMenu:bt=>{dt(null),Ct(null),Ke({kind:"theater",theaterId:de.id,anchor:bt})}},de.id)}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":de.id,children:[D!=="rail"?u.jsx(W2,{theater:de,operationCount:vt,active:!0,collapsed:nt,tier:D,onSelectTheater:G,onToggleCollapsed:Ni,onOpenActions:(Ae,bt)=>{dt(null),Ct(null),Ke({kind:"theater",theaterId:de.id,anchor:Ae,returnFocus:bt})},onOpenLaunch:Mi,onContextMenu:Ae=>{dt(null),Ct(null),Ke({kind:"theater",theaterId:de.id,anchor:Ae})}}):null,D==="rail"||!nt?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${de.label} operations`,children:lt.map(Ae=>{const bt=Ae.groupId!==null&&xn.has(Ae.groupId),en=Ae.group?bo(Ae.group.color):null,wn=en?{"--grp-color":en}:void 0,Re=Ae.groupId?hn.indexOf(Ae.groupId):-1,J=ie?.kind==="group"&&ie.sourceGroupId===Ae.groupId&&ie.dragging,me=ie?.kind==="group"&&ie.dragging&&Ae.groupId!==null&&ie.sourceGroupId!==Ae.groupId&&ie.dropIndex===Re,Ee=ie?.kind==="group"&&ie.dragging&&Ae.groupId!==null&&ie.sourceGroupId!==Ae.groupId&&Re===hn.length-1&&ie.dropIndex===hn.length,Qe=[Ae.groupId?"side-bar-group-section":"side-bar-ungrouped-section",me?"side-bar-group-section--drop-before":"",Ee?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":Ae.groupId??"__ungrouped__",className:Qe,style:wn,children:[Ae.group?u.jsx(Q9,{group:Ae.group,count:Ae.entries.length,collapsed:bt,tier:D,dragging:J,dragOffsetY:J?ie.currentY-ie.startY:0,dropTarget:me,onToggle:yA,onContextMenu:($e,yt)=>Ke({kind:"group",groupId:$e,anchor:yt}),onPointerDragStart:Pe}):Ae.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:D!=="rail"?u.jsx("span",{children:"Ungrouped"}):null}):null,bt?null:u.jsx("ol",{className:["side-bar-group-chips",ie?.kind==="chip"&&ie.dragging&&ie.dropGroupId===Ae.groupId&&ie.dropGroupId!==ie.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ae.groupId??"__ungrouped__","aria-label":Ae.group?Ae.group.name:"Ungrouped",children:Ae.entries.map($e=>{const yt=Qt.indexOf($e),wt=Ae.entries.indexOf($e),Dt=U.operationAccent[$e.operation.id]??CS($e.operation),be=Dt?bo(Dt):null;return u.jsx(B2,{entry:$e,index:yt,isCloseArmed:Q===$e.operation.id,accentValue:be,dragging:ie?.kind==="chip"&&ie.sourceId===$e.operation.id&&ie.dragging,dragOffsetY:ie?.kind==="chip"&&ie.sourceId===$e.operation.id&&ie.dragging?ie.currentY-ie.startY:0,dropTarget:ie?.kind==="chip"&&ie.dragging===!0&&ie.dropGroupId===Ae.groupId&&ie.dropGroupId===ie.sourceGroupId&&ie.dropIndex===wt&&ie.sourceId!==$e.operation.id,onArmClose:Yi,onDisarmClose:mi,onClose:v,onFocus:x,onKeyboardMove:Xi,onPointerDragStart:xe,onOpenAccent:(Me,Ie)=>Ke({kind:"chip",operationId:Me,anchor:Ie}),onRename:L},$e.operation.id)})})]},Ae.groupId??"__ungrouped__")})}):null]},de.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:xt,onDoubleClick:ft,"aria-hidden":"true"}),ke?pr.createPortal(u.jsx(eh,{anchor:ke.anchor,viewportBounds:ke.viewportBounds,placement:"cursor",mode:"launch",catalog:c,canLaunch:h,renderKindIcon:C,onLaunchKind:(de,je)=>{dt(null),T(de,je)},onResetView:w,onClose:()=>dt(null)},`${ke.anchor.x}:${ke.anchor.y}`),document.body):null,Pt?pr.createPortal(u.jsx(eh,{anchor:Pt.anchor,viewportBounds:Pt.viewportBounds,placement:"cursor",mode:"controls",catalog:c,canLaunch:h,radarEnabled:g,perimeterEnabled:S,renderKindIcon:C,onLaunchKind:T,onResetView:()=>{Ct(null),w()},onToggleRadar:m,onTogglePerimeter:b,onClose:()=>Ct(null)},`settings:${Pt.anchor.x}:${Pt.anchor.y}`),document.body):null,Be?.kind==="chip"&&Hn?u.jsx(zS,{kind:"chip",operation:Hn,groups:s.filter(de=>de.theaterId===Hn.theaterId),accentKey:U.operationAccent[Hn.id]??CS(Hn),anchor:Be.anchor,actions:{onSetAccent:de=>k(Hn.id,de),onSetGroupId:de=>R(Hn.id,de),onCreateGroup:de=>N(Hn.theaterId,de,Hn.id)},onClose:()=>Ke(null)}):Be?.kind==="group"&&Ln?u.jsx(zS,{kind:"group-header",group:Ln,anchor:Be.anchor,actions:{onSetColor:de=>A(Ln.id,de),onRename:de=>I(Ln.id,de),onUngroupAll:()=>F(Ln.id)},onClose:()=>Ke(null)}):Be?.kind==="theater"&&$n?u.jsx(SP,{theater:$n,groupCount:s.filter(de=>de.theaterId===$n.id).length,anchor:Be.anchor,onCreateGroup:de=>{N($n.id,de),dn()},onForgetTheater:()=>{W($n.id),dn()},onClose:dn}):null,u.jsx(wg,{open:Gn,onCancel:Ce,onConfirm:ze})]})}function F2(e,t,i){const s=[...t].sort((c,h)=>c.order-h.order||c.createdAt-h.createdAt),o=s.map(c=>({groupId:c.id,group:c,entries:[]})),f={groupId:null,group:null,entries:[]},p=new Map(s.map(c=>[c.id,c]));for(const c of e){const h=c.operation.groupId??null;h!==null&&p.has(h)?o.find(_=>_.groupId===h)?.entries.push(c):f.entries.push(c)}return[...o,f]}function bP({theaterId:e,operations:t,operationOrder:i,minimizedSet:s,activeOperationId:o,operationNotifications:f,catalog:p,renderKindIcon:c}){return Nm(t.filter(h=>h.theaterId===e),i).map(h=>{const d=U2(p,h),_=d?c(h.pluginId,d):null;return{operation:h,active:o===h.id,minimized:s.has(h.id),notificationCount:f[h.id]?1:0,icon:_}})}function W2({theater:e,operationCount:t,active:i,collapsed:s,tier:o,onSelectTheater:f,onToggleCollapsed:p,onOpenActions:c,onOpenLaunch:h,onContextMenu:d}){const _=S=>{S.preventDefault(),d(S.currentTarget.getBoundingClientRect())},g=S=>{S.target===S.currentTarget&&(S.key!=="Enter"&&S.key!==" "||(S.preventDefault(),f(e.id)))};return u.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${i?" is-active":""}`,onClick:()=>f(e.id),onKeyDown:g,onContextMenu:_,"aria-current":i?"true":void 0,"aria-expanded":!s,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:u.jsx(sh,{})}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx("span",{className:"side-bar-theater-count",children:t}),o!=="rail"?u.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":s?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!s,title:s?"Expand":"Collapse",onClick:S=>{S.stopPropagation(),p(e.id)},children:u.jsx(wP,{collapsed:s})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:S=>{S.stopPropagation(),c(S.currentTarget.getBoundingClientRect(),S.currentTarget)},children:u.jsx(CP,{})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:S=>h(S,e.id),children:u.jsx(G2,{})})]}):null]})}function yP({theater:e,entries:t,groups:i,operationCount:s,collapsed:o,tier:f,onSelectTheater:p,onFocus:c,onToggleCollapsed:h,onOpenActions:d,onOpenLaunch:_,onContextMenu:g}){const S=F2(t,i);let C=mP,T=0;const w=[];for(const m of S){if(m.entries.length===0)continue;const b=m.entries.slice(0,Math.max(0,C));T+=m.entries.length-b.length,C-=b.length,b.length>0&&w.push({...m,entries:b})}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--peek","data-theater-id":e.id,children:[u.jsx(W2,{theater:e,operationCount:s,active:!1,collapsed:o,tier:f,onSelectTheater:p,onToggleCollapsed:h,onOpenActions:d,onOpenLaunch:_,onContextMenu:g}),w.length>0?u.jsxs("ol",{className:"side-bar-peek-chips","aria-label":`${e.label} preview operations`,children:[w.map(m=>{const b=m.group?bo(m.group.color):null;return u.jsxs("li",{className:m.groupId?"side-bar-group-section side-bar-group-section--peek":"side-bar-ungrouped-section",style:b?{"--grp-color":b}:void 0,children:[m.group?u.jsxs("div",{className:"side-bar-peek-group-label","aria-label":`Group ${m.group.name}`,children:[u.jsx("span",{children:m.group.name}),u.jsx("span",{className:"side-bar-peek-group-count",children:m.entries.length})]}):null,u.jsx("ol",{className:"side-bar-group-chips","aria-label":m.group?m.group.name:"Ungrouped",children:m.entries.map((v,x)=>u.jsx(B2,{entry:v,index:x,isCloseArmed:!1,accentValue:null,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onFocus:c,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},v.operation.id))})]},m.groupId??"__ungrouped__")}),T>0?u.jsxs("li",{className:"side-bar-peek-more",children:["+",T," more"]}):null]}):null]})}function SP({theater:e,groupCount:t,anchor:i,onCreateGroup:s,onForgetTheater:o,onClose:f}){const[p,c]=M.useState(!1),[h,d]=M.useState(`Group ${t+1}`),_=M.useRef(!1),g=M.useRef(null),S=M.useRef(null),[C,T]=M.useState(i.bottom+6);M.useLayoutEffect(()=>{const m=S.current?.getBoundingClientRect().height??0,b=window.innerHeight-m-8;T(Math.max(8,Math.min(i.bottom+6,b)))},[i,p]),M.useEffect(()=>{p&&g.current?.select()},[p]),M.useEffect(()=>{const m=b=>{b.key==="Escape"&&(b.preventDefault(),f())};return window.addEventListener("keydown",m),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("keydown",m),window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[f]);const w=()=>{const m=h.trim();m&&s(m)};return pr.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:f,children:u.jsxs("div",{ref:S,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:i.left,top:C},onPointerDown:m=>m.stopPropagation(),children:[p?u.jsx("input",{ref:g,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:h,onChange:m=>d(m.target.value),onCompositionStart:()=>{_.current=!0},onCompositionEnd:()=>{_.current=!1},onKeyDown:m=>{m.key==="Enter"&&!_.current&&(m.preventDefault(),w()),m.key==="Escape"&&(m.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>c(!0),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(G2,{})}),u.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),u.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:o,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(kP,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function xP(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+WS?t.scrollTop-=GS:e>i.bottom-WS&&(t.scrollTop+=GS)}function wP({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?u.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):u.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function CP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function G2(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function EP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"2.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 1.4v1.4M8 13.2v1.4M1.4 8h1.4M13.2 8h1.4M3.3 3.3l1 1M11.7 11.7l1 1M11.7 3.3l-1 1M3.3 11.7l-1 1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function sh(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"3.2",r:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M8 4.7v8.1M4.3 8.2H11.7M3.4 9.1A4.7 4.7 0 0 0 12.6 9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function kP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.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"})]})}const TP='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function AP(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=Gr(),s=M.useRef(null),o=M.useRef(null),f=M.useRef(null),p=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,c=e!==null&&t,h=M.useCallback(()=>{S9(),U3()},[]);return M.useEffect(()=>{if(!c)return;const d=e;document.body.setAttribute("data-codex-reading","true");const _=document.querySelector(".operations-canvas"),g=document.querySelector(".operations-side-bar");_?.setAttribute("inert",""),g?.setAttribute("inert","");const S=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),h();return}C.key==="Tab"&&RP(s.current,C)};return window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0),document.body.removeAttribute("data-codex-reading"),_?.removeAttribute("inert"),g?.removeAttribute("inert");const C=d?.kind==="entry"?d.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(C?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${C}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[c]),M.useEffect(()=>{if(!c||!o.current||!f.current||!e)return;const d=e.kind,_=d==="drydock"?e.patchId:d==="conflicts"?e.id:void 0;O2(o.current,f.current,{initialEntryId:d==="entry"?e.entryId:"",kind:d,subId:_,theaterId:i,onRelatedClick:g=>{$r({kind:"entry",entryId:g}),Ku()},onClose:h,onPatchOpen:g=>{$r({kind:"drydock",patchId:g}),Ku()},onDecided:()=>{Mh(),$r({kind:"drydock",patchId:void 0}),Ku()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[c,p]),c?pr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:h,"aria-hidden":"true"}),u.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:h,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:o,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:f,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function RP(e,t){if(!e)return;const i=[...e.querySelectorAll(TP)].filter(f=>!f.closest("[inert]"));if(i.length===0)return;const s=i[0],o=i[i.length-1];t.shiftKey?document.activeElement===s&&(t.preventDefault(),o.focus()):document.activeElement===o&&(t.preventDefault(),s.focus())}const LP=Ph().api,hm=560,dm=360,tg=new Set;function MP({state:e}){const t=M.useRef(null),i=wx(),s=Cx(),o=vA(),f=bA(),p=lc(),[c,h]=M.useState([]),d=M.useMemo(()=>NP(e).map(W=>W.id),[e.operations,e.activeTheaterId]),_=M.useRef(e);_.current=e,M.useEffect(()=>{kA(e.activeTheaterId)},[e.activeTheaterId]),M.useEffect(()=>{if(!e.activeTheaterId){h([]);return}XS().then(h).catch(()=>{})},[e.activeTheaterId]),M.useEffect(()=>{const W={current:i},z=V=>{if(!V.altKey||V.metaKey||V.ctrlKey||V.shiftKey||V.key!=="ArrowLeft"&&V.key!=="ArrowRight")return;const X=document.activeElement;if(X instanceof HTMLElement&&X.matches("input, textarea, [contenteditable='true']")&&!X.closest(".xterm"))return;const j=_.current,P=go(),D=z3(j.operations.filter(Q=>Q.theaterId===j.activeTheaterId),j.groups.filter(Q=>Q.theaterId===j.activeTheaterId),P.operationOrder,P.collapsedGroups).map(Q=>Q.id);if(D.length===0)return;V.preventDefault(),V.stopImmediatePropagation();const U=W.current??_.current.activeOperationId,q=P3(D,U,V.key==="ArrowRight"?1:-1);if(q){if(W.current){fr(q),$l(q);return}Xl(q)}};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[i]),M.useEffect(()=>{for(const W of d)CA(W);e.operationsHydrated&&EA(d)},[d,e.operationsHydrated]),M.useEffect(()=>{const W=e.pendingOperationFocus;if(W===null)return;if(fg()!==null){$l(W),vb();return}mo();const z=qS(t.current);z&&cb(W,z),vb()},[e.pendingOperationFocus]);const g=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(W=>W.theaterId===e.activeTheaterId);const S=M.useCallback((W,z)=>p.plugins.find(X=>X.id===W)?.renderLaunchIcon?.(z)??null,[p.plugins]),C=M.useCallback((W,z,V)=>{if(!_.current.activeTheaterId)return;const X={...KS(V),zIndex:aa()};ng(W,z,X,_.current.activeTheaterId,p.plugins)},[p.plugins]),T=M.useCallback((W,z)=>{if(!_.current.activeTheaterId)return;const V=DP(t.current),X={...KS(V),zIndex:aa()};ng(W,z,X,_.current.activeTheaterId,p.plugins)},[p.plugins]),w=M.useCallback((W,z,V)=>{_.current.activeTheaterId&&ng(W,z,V,_.current.activeTheaterId,p.plugins)},[p.plugins]),m=M.useCallback(()=>{Ex({x:0,y:0,zoom:1})},[]),b=M.useCallback(()=>{TA()},[]),v=M.useCallback(()=>{AA()},[]),x=M.useCallback(W=>{const z=_.current.operations.find(D=>D.id===W);if(!z)return;if(z.theaterId!==_.current.activeTheaterId){Xl(W);return}const V=fg();if(V!==null&&V!==W){fr(W),$l(W);return}const X=go(),j=X.operations[W]??z.geometry??OP(z);X.operations[W]||gg(W,j),wA(W),fr(W);const P=qS(t.current);P&&cb(W,P)},[]),k=M.useCallback((W,z)=>{qu(W,{accent:z}).then(()=>fi(null)).then(pi).catch(()=>{})},[]),L=M.useCallback((W,z)=>{Bx(W,z).then(()=>fi(null)).then(pi).catch(()=>{})},[]),R=M.useCallback((W,z)=>{qu(W,{groupId:z}).then(()=>fi(null)).then(pi).catch(()=>{})},[]),N=M.useCallback((W,z,V)=>{u3({theaterId:W,name:z,color:"blue"}).then(X=>V?qu(V,{groupId:X.id}).then(()=>{}):void 0).then(()=>Promise.all([fi(null).then(pi),Xs().then(Zs)])).catch(()=>{})},[]),A=M.useCallback((W,z)=>{z&&op(W,{color:z}).then(()=>Xs()).then(Zs).catch(()=>{})},[]),I=M.useCallback((W,z)=>{op(W,{name:z}).then(()=>Xs()).then(Zs).catch(()=>{})},[]),K=M.useCallback(W=>{const z=new Map(_.current.groups.map(X=>[X.id,X])),V=W.flatMap((X,j)=>{const P=z.get(X);return!P||P.order===j?[]:[op(X,{order:j})]});V.length!==0&&Promise.allSettled(V).then(()=>Xs()).then(Zs).catch(()=>{})},[]),F=M.useCallback(W=>{h3(W).then(()=>Promise.all([fi(null).then(pi),Xs().then(Zs)])).catch(()=>{})},[]),G=M.useCallback(W=>{if(tg.has(W))return;tg.add(W);const z=_.current.operations.find(X=>X.id===W)?.pluginId,V=(z?p.plugins.find(X=>X.id===z):null)??null;jP(W,V).finally(()=>tg.delete(W))},[p.plugins]),B=M.useCallback(async W=>{Xx();try{const z=await Ix(W),V=await jx(z);Zx(V)}catch(z){Sg(z instanceof Error?z.message:String(z))}},[]),Y=M.useCallback(async W=>{const z=()=>Promise.all([fi(null).then(pi),Xs().then(Zs)]).then(()=>{}).catch(()=>{});try{await c3(W),xb(W),await z()}catch(V){if(V instanceof ut&&V.status===404){xb(W),await z();return}Sg(V instanceof Error?V.message:String(V))}},[]);return u.jsxs("div",{className:"console-body is-canvas",ref:t,children:[u.jsx(vP,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:s,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:c,canLaunch:g,addingTheater:e.addingTheater,theaterError:e.theaterError,radarEnabled:o,perimeterEnabled:f,renderKindIcon:S,onLaunchKind:T,onResetView:m,onToggleRadar:b,onTogglePerimeter:v,onClose:G,onFocus:x,onSetAccent:k,onRename:L,onSetGroupId:R,onCreateGroup:N,onSetGroupColor:A,onRenameGroup:I,onReorderGroups:K,onUngroupAll:F,onSelectTheater:D3,onAddTheater:B,onCancelAddTheater:B3,onForgetTheater:Y}),u.jsx(gB,{state:e,catalog:c,canLaunch:g,radarEnabled:o,perimeterEnabled:f,renderKindIcon:S,onLaunchKind:C,onLaunchAtGeometry:w,onResetView:m,onToggleRadar:b,onTogglePerimeter:v,onClose:G,onFocus:x,onSetAccent:k}),u.jsx(j9,{theaterId:e.activeTheaterId,api:LP}),u.jsx(AP,{})]})}function NP(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(xg)}function qS(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function OP(e){return e.geometry??{x:0,y:0,width:hm,height:dm,zIndex:0}}function DP(e){const t=go(),i=e?.clientWidth??800,s=e?.clientHeight??600;return nc({x:i/2,y:s/2},t.viewport)}function KS(e){return{x:e.x-hm/2,y:e.y-dm/2,width:hm,height:dm}}async function ng(e,t,i,s,o){const f=o.find(g=>g.id===e),c=Ph(()=>{fi(null).then(pi).catch(()=>{})});let h=null;if(f?.launch?h=(await f.launch({theaterId:s,kind:t,geometry:i,operations:c.operations})).id:h=(await c.operations.create({theaterId:s,type:t.type,pluginId:e,title:t.title,geometry:i})).id,await fi(null).then(pi).catch(()=>{}),!h)return;const d=_A()===s,_=yg().operations.some(g=>g.id===h);d&&_&&fg()!==null?(fr(h),$l(h)):Xl(h)}async function jP(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await fi(null).then(pi).catch(()=>{})}const IP=6e3;function BP(){const e=Gr(),t=Vi(),i=lc(),s=t.pathname,f=xx()&&s.startsWith("/operations"),p=s.startsWith("/operations");return M.useEffect(()=>{const c=Ph(()=>{fi().then(pi).catch(()=>{})}),h=i.plugins.map(d=>d.install?.(c)).filter(d=>typeof d=="function");return()=>{for(const d of h)d()}},[i.plugins]),M.useEffect(()=>{A3(p)},[p]),M.useEffect(()=>{const c=new AbortController;s3(c.signal).then(_=>{N3(_),Sb()}).catch(_=>{c.signal.aborted||(tt({theaterError:_ instanceof Error?_.message:String(_)}),Sb())}),fi(null,c.signal).then(pi).catch(()=>{}),Xs(null,c.signal).then(Zs).catch(()=>{}),qx(),Dx({signal:c.signal}).then(Kx).catch(_=>{c.signal.aborted||Vx(_ instanceof Error?_.message:String(_))});const h=()=>{a3(e.activeTheaterId,c.signal).then(R3).catch(()=>{})};h();const d=window.setTimeout(h,IP);return()=>{window.clearTimeout(d),c.abort()}},[]),M.useEffect(()=>{const c=h=>{(h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="k"&&(h.preventDefault(),h.stopImmediatePropagation(),H3())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[]),u.jsxs("div",{className:`console-shell ${f?"is-map-fullscreen":""}`,children:[u.jsxs(OT,{children:[u.jsx(Za,{path:"/",element:u.jsx(rb,{to:"/operations",replace:!0})}),u.jsx(Za,{path:"/operations",element:u.jsx(MP,{state:e})}),u.jsx(Za,{path:"/carrier-settings",element:u.jsx(Pj,{})}),u.jsx(Za,{path:"/settings",element:u.jsx(vI,{})}),u.jsx(Za,{path:"*",element:u.jsx(rb,{to:"/operations",replace:!0})})]}),u.jsx(mR,{state:e}),u.jsx(qR,{state:e}),u.jsx(fR,{state:e}),u.jsx(TR,{state:e}),u.jsx(WR,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}const PP=3e4;let Uu=1e3,Fu=null;function q2(){Fu!==null&&clearTimeout(Fu);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const s=JSON.parse(i.data);zP(s.operation)&&O3(s.operation)}catch{}}),e.onopen=()=>{Uu=1e3},e.onerror=()=>{e.close(),Fu=setTimeout(()=>{Fu=null,Uu=Math.min(Uu*2,PP),fi().then(pi).catch(()=>{}).finally(q2)},Uu)}}function zP(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}globalThis.__fleetConsoleRuntime__={react:ah,"react/jsx-runtime":J5,"@fleet-console/sdk/plugin/browser":vk,"@fleet-console/sdk/settings/browser":Ek,"@fleet-console/sdk/operations/browser":ak,"@fleet-console/sdk/notifications/browser":Tk,"@fleet-console/sdk/react/browser":Rk};try{const e=await h2();Gx(e.theme)}catch{}const HP=await hj();q2();const VS=document.querySelector("#app");VS&&jk.createRoot(VS).render(u.jsx(M.StrictMode,{children:u.jsx(iA,{basename:"/console",children:u.jsx(uj,{value:HP,children:u.jsx(BP,{})})})}));export{jD as _,$P as a,fm as g,Nt as k,Wl as p};