@dotobokuri/fleet-console 1.18.0 → 1.19.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.
- package/AGENTS.md +6 -5
- package/dist/cli.d.ts +13 -12
- package/dist/cli.mjs +143 -175
- package/dist/client/assets/SymbolsNerdFontMono-Regular-CoUzE12l.woff2 +0 -0
- package/dist/client/assets/{_baseUniq-DFEDX4NY.js → _baseUniq-C4_iQlZS.js} +1 -1
- package/dist/client/assets/{arc-CGwMrR6o.js → arc-BBAWxYi5.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-BqLyvIOK.js → architectureDiagram-Q4EWVU46-_oQqhexV.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-DoiPMLdv.js → blockDiagram-DXYQGD6D-3xT9VFiD.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-DfGxDkah.js → c4Diagram-AHTNJAMY-S-IMcMW2.js} +1 -1
- package/dist/client/assets/channel-5tV1napa.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-3zXv74oY.js → chunk-4BX2VUAB-tS9Ys0P9.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-MkXUmjUE.js → chunk-4TB4RGXK-YZgAG7SW.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-mhkgqlI_.js → chunk-55IACEB6-m-CtqHoO.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-B0_ZDihs.js → chunk-EDXVE4YY-yoymxaEV.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-BQAuE4pL.js → chunk-FMBD7UC4-REUkrQAG.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-CY8Eyj9X.js → chunk-OYMX7WX6-DzMuL105.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CaZoMwKH.js → chunk-QZHKN3VN-DXFFll8-.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-DV1YOEUH.js → chunk-YZCP3GAM-CmY7W-gg.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-WDM904ap.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-WDM904ap.js +1 -0
- package/dist/client/assets/clone-BJg9p0cC.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Cy3v0C_N.js → cose-bilkent-S5V4N54A-BupE-a40.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-CGJ6x_VR.js → dagre-KV5264BT-Jn67LxMS.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-MyyXeHKQ.js → diagram-5BDNPKRD-BAeFEORH.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-D52Q2132.js → diagram-G4DWMVQ6-CnZrDABY.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DCypusCr.js → diagram-MMDJMWI5-DefG-kXU.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-c5UBqE9-.js → diagram-TYMM5635-BPkXKB-Q.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-BlF0Lxy7.js → erDiagram-SMLLAGMA-Bi4jlild.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-lo8xyzfx.js → flowDiagram-DWJPFMVM-BoZyLO7h.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-BXVZMpon.js → ganttDiagram-T4ZO3ILL-LgzSNjrh.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-DB1A6uYk.js → gitGraphDiagram-UUTBAWPF-B4fH-hPT.js} +1 -1
- package/dist/client/assets/{graph-Ck2AX1p2.js → graph-D3ZAYMLG.js} +1 -1
- package/dist/client/assets/{index-Cf9MmpwN.css → index-DctP_CJP.css} +1 -1
- package/dist/client/assets/index-vgEn_EkG.js +404 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-NEVE42fw.js → infoDiagram-42DDH7IO-pENdunXd.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-MbFr_8pL.js → ishikawaDiagram-UXIWVN3A-WakLHKte.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-Sq2ja3q8.js → journeyDiagram-VCZTEJTY-CrqXKtzk.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-C63qPhtK.js → kanban-definition-6JOO6SKY-DdSC9eJ-.js} +1 -1
- package/dist/client/assets/{layout-CFEuVj4N.js → layout-BI1Oko_a.js} +1 -1
- package/dist/client/assets/{linear-B626G8Op.js → linear-KUjZtfMe.js} +1 -1
- package/dist/client/assets/{mermaid.core-BT7SVKBR.js → mermaid.core-DNlIf4_3.js} +4 -4
- package/dist/client/assets/{min-MbEOApMw.js → min-DCAecveI.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-DMpht5Mg.js → mindmap-definition-QFDTVHPH-BSCyQA-4.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B4XS0haZ.js → pieDiagram-DEJITSTG-C_1I63z5.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-CReo5Ajb.js → quadrantDiagram-34T5L4WZ-CtqeYPcA.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-A50aqG-K.js → requirementDiagram-MS252O5E-Cpakdg-s.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-471VOdlW.js → sankeyDiagram-XADWPNL6-CK_eMH3e.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-BAvOyUC-.js → sequenceDiagram-FGHM5R23-D2YygHqF.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-gCtZrvR-.js → stateDiagram-FHFEXIEX-DEDhnbhU.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-ji50PgJQ.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-CTHf-uxq.js → timeline-definition-GMOUNBTQ-Brgny70W.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-5gvXi0dO.js → vennDiagram-DHZGUBPP-B1I5E8Hy.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-XR-qQTWZ.js → wardley-RL74JXVD-P0VCYfKI.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-EwPsMHdt.js → wardleyDiagram-NUSXRM2D-DhYC5Sus.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-CePwuUb7.js → xychartDiagram-5P7HB3ND-ByJX99rJ.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/diff/routes.mjs +207 -34
- package/dist/fleet-plugins/file-explorer/routes.mjs +1 -1
- package/dist/fleet-plugins/skills/routes.mjs +101 -83
- package/dist/fleet-plugins/terminal/routes.mjs +556 -325
- package/package.json +1 -1
- package/dist/client/assets/channel-DlT8zCVq.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-B-UN9f9r.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-B-UN9f9r.js +0 -1
- package/dist/client/assets/clone-CDPRFCO0.js +0 -1
- package/dist/client/assets/index-DWgndVkX.js +0 -404
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-Bdb0YU66.js +0 -1
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
function qS(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 um(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function NP(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 Kf={exports:{}},gl={};var P1;function G5(){if(P1)return gl;P1=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 gl.Fragment=t,gl.jsx=i,gl.jsxs=i,gl}var z1;function q5(){return z1||(z1=1,Kf.exports=G5()),Kf.exports}var u=q5();const K5=um(u),V5=qS({__proto__:null,default:K5},[u]);var Vf={exports:{}},We={};var H1;function Y5(){if(H1)return We;H1=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"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=x&&D[x]||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,F,J){this.props=D,this.context=F,this.refs=m,this.updater=J||T}b.prototype.isReactComponent={},b.prototype.setState=function(D,F){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,F,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function _(){}_.prototype=b.prototype;function S(D,F,J){this.props=D,this.context=F,this.refs=m,this.updater=J||T}var k=S.prototype=new _;k.constructor=S,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 B(D,F,J){var ne=J.ref;return{$$typeof:e,type:D,key:F,ref:ne!==void 0?ne:null,props:J}}function V(D,F){return B(D.type,F,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function W(D){var F={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return F[J]})}var I=/\/+/g;function X(D,F){return typeof D=="object"&&D!==null&&D.key!=null?W(""+D.key):F.toString(36)}function Y(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(F){D.status==="pending"&&(D.status="fulfilled",D.value=F)},function(F){D.status==="pending"&&(D.status="rejected",D.reason=F)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function P(D,F,J,ne,Z){var re=typeof D;(re==="undefined"||re==="boolean")&&(D=null);var q=!1;if(D===null)q=!0;else switch(re){case"bigint":case"string":case"number":q=!0;break;case"object":switch(D.$$typeof){case e:case t:q=!0;break;case v:return q=D._init,P(q(D._payload),F,J,ne,Z)}}if(q)return Z=Z(D),q=ne===""?"."+X(D,0):ne,L(Z)?(J="",q!=null&&(J=q.replace(I,"$&/")+"/"),P(Z,F,J,"",function(de){return de})):Z!=null&&(U(Z)&&(Z=V(Z,J+(Z.key==null||D&&D.key===Z.key?"":(""+Z.key).replace(I,"$&/")+"/")+q)),F.push(Z)),1;q=0;var H=ne===""?".":ne+":";if(L(D))for(var se=0;se<D.length;se++)ne=D[se],re=H+X(ne,se),q+=P(ne,F,J,re,Z);else if(se=C(D),typeof se=="function")for(D=se.call(D),se=0;!(ne=D.next()).done;)ne=ne.value,re=H+X(ne,se++),q+=P(ne,F,J,re,Z);else if(re==="object"){if(typeof D.then=="function")return P(Y(D),F,J,ne,Z);throw F=String(D),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return q}function G(D,F,J){if(D==null)return D;var ne=[],Z=0;return P(D,ne,"","",function(re){return F.call(J,re,Z++)}),ne}function K(D){if(D._status===-1){var F=D._result;F=F(),F.then(function(J){(D._status===0||D._status===-1)&&(D._status=1,D._result=J)},function(J){(D._status===0||D._status===-1)&&(D._status=2,D._result=J)}),D._status===-1&&(D._status=0,D._result=F)}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 F=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(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},z={map:G,forEach:function(D,F,J){G(D,function(){F.apply(this,arguments)},J)},count:function(D){var F=0;return G(D,function(){F++}),F},toArray:function(D){return G(D,function(F){return F})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return We.Activity=g,We.Children=z,We.Component=b,We.Fragment=i,We.Profiler=o,We.PureComponent=S,We.StrictMode=s,We.Suspense=h,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,We.__COMPILER_RUNTIME={__proto__:null,c:function(D){return N.H.useMemoCache(D)}},We.cache=function(D){return function(){return D.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(D,F,J){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var ne=w({},D.props),Z=D.key;if(F!=null)for(re in F.key!==void 0&&(Z=""+F.key),F)!A.call(F,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&F.ref===void 0||(ne[re]=F[re]);var re=arguments.length-2;if(re===1)ne.children=J;else if(1<re){for(var q=Array(re),H=0;H<re;H++)q[H]=arguments[H+2];ne.children=q}return B(D.type,Z,ne)},We.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},We.createElement=function(D,F,J){var ne,Z={},re=null;if(F!=null)for(ne in F.key!==void 0&&(re=""+F.key),F)A.call(F,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(Z[ne]=F[ne]);var q=arguments.length-2;if(q===1)Z.children=J;else if(1<q){for(var H=Array(q),se=0;se<q;se++)H[se]=arguments[se+2];Z.children=H}if(D&&D.defaultProps)for(ne in q=D.defaultProps,q)Z[ne]===void 0&&(Z[ne]=q[ne]);return B(D,re,Z)},We.createRef=function(){return{current:null}},We.forwardRef=function(D){return{$$typeof:c,render:D}},We.isValidElement=U,We.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:K}},We.memo=function(D,F){return{$$typeof:d,type:D,compare:F===void 0?null:F}},We.startTransition=function(D){var F=N.T,J={};N.T=J;try{var ne=D(),Z=N.S;Z!==null&&Z(J,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(R,j)}catch(re){j(re)}finally{F!==null&&J.types!==null&&(F.types=J.types),N.T=F}},We.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},We.use=function(D){return N.H.use(D)},We.useActionState=function(D,F,J){return N.H.useActionState(D,F,J)},We.useCallback=function(D,F){return N.H.useCallback(D,F)},We.useContext=function(D){return N.H.useContext(D)},We.useDebugValue=function(){},We.useDeferredValue=function(D,F){return N.H.useDeferredValue(D,F)},We.useEffect=function(D,F){return N.H.useEffect(D,F)},We.useEffectEvent=function(D){return N.H.useEffectEvent(D)},We.useId=function(){return N.H.useId()},We.useImperativeHandle=function(D,F,J){return N.H.useImperativeHandle(D,F,J)},We.useInsertionEffect=function(D,F){return N.H.useInsertionEffect(D,F)},We.useLayoutEffect=function(D,F){return N.H.useLayoutEffect(D,F)},We.useMemo=function(D,F){return N.H.useMemo(D,F)},We.useOptimistic=function(D,F){return N.H.useOptimistic(D,F)},We.useReducer=function(D,F,J){return N.H.useReducer(D,F,J)},We.useRef=function(D){return N.H.useRef(D)},We.useState=function(D){return N.H.useState(D)},We.useSyncExternalStore=function(D,F,J){return N.H.useSyncExternalStore(D,F,J)},We.useTransition=function(){return N.H.useTransition()},We.version="19.2.7",We}var $1;function hm(){return $1||($1=1,Vf.exports=Y5()),Vf.exports}var M=hm();const X5=um(M),rh=qS({__proto__:null,default:X5},[M]),Z5="fc-operation-body";let qn=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function KS(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new qn(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(Q5).filter(s=>s!==null):[]}function sh(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)||VS(t))throw new qn(500,"Invalid operation response");return t}function VS(e){return tg(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function J5({children:e,className:t}){return u.jsx("div",{className:tk(Z5,t),children:e})}function Q5(e){if(!YS(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(ek).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function ek(e){return!YS(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 YS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tg(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>tg(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||tg(s,t))}function tk(...e){return e.filter(t=>!!t).join(" ")}const nk=Object.freeze(Object.defineProperty({__proto__:null,ApiError:qn,OperationBody:J5,assertOperationNode:sh,fetchOperationCatalog:KS,hasForbiddenBrowserPayloadKey:VS},Symbol.toStringTag,{value:"Module"}));function ik(e){return e}function rk(e){return e}function XS(e=()=>{}){const t=new Set;return{api:{fetch:(i,s,o)=>fetch(Yf(i,s),o).then(uk),subscribe:(i,s,o)=>{const f=new EventSource(Yf(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(Yf(i,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:o}),signal:f});if(!p.ok)throw new qn(p.status,`Terminal ticket request failed: ${p.status}`);const c=await p.json();if(typeof c.ticket!="string"||typeof c.ttlMs!="number")throw new qn(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 qn(s.status,`Operation create failed: ${s.status}`);const o=await s.json();return sh(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 qn(o.status,`Operation rename failed: ${o.status}`);const f=await o.json();return sh(f.operation)},remove:async i=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!s.ok)throw new qn(s.status,`Operation remove failed: ${s.status}`)}},preferences:{read:(i,s)=>dk(i,s),write:(i,s)=>fk(i,s)},settings:{read:async i=>{const s=await fetch(U1(i));if(!s.ok)throw new qn(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(U1(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new qn(o.status,`Plugin settings write failed: ${o.status}`)}},status:{set:()=>{},clear:()=>{}}}}function ZS(e,t){return M.useSyncExternalStore(e,t,t)}function sk(){const[e,t]=M.useState([]),i=M.useCallback(async()=>{const s=await fetch("/api/v1/operations");if(!s.ok)throw new qn(s.status,`Operations request failed: ${s.status}`);const o=await s.json();t(Array.isArray(o.operations)?o.operations.map(sh):[])},[]);return M.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function ak(e,t){return M.useMemo(()=>({fetch:(i,s)=>e.fetch(t,i,s),subscribe:(i,s)=>e.subscribe(t,i,s)}),[e,t])}function ok(e,t){return M.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function lk(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 ck(e,t){return M.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function uk(e){if(!e.ok)throw new qn(e.status,`Plugin request failed: ${e.status}`);return e}function Yf(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new qn(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new qn(400,"Invalid plugin path");return`/plugins/${e}${i}`}const hk=/^[a-z0-9][a-z0-9._-]*$/;function U1(e){if(!hk.test(e))throw new qn(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function dk(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 fk(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const pk=Object.freeze(Object.defineProperty({__proto__:null,React:rh,createClientCapabilities:XS,defineOperationKind:rk,definePlugin:ik,useOperationStatus:ck,useOperations:sk,usePluginApi:ak,usePluginSettings:ok,usePluginStorage:lk,useStoreSnapshot:ZS},Symbol.toStringTag,{value:"Module"}));function gk(e){return e}function mk({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 _k({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 vk({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 bk({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 yk({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 Sk=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:mk,SettingsField:yk,SettingsRow:_k,SettingsSelect:bk,SettingsToggle:vk,defineSettingsSection:gk},Symbol.toStringTag,{value:"Module"}));function xk(e){return e}const wk=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:xk},Symbol.toStringTag,{value:"Module"})),Ck=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class dm 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??Ck:this.props.children}}const Ek=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:dm,React:rh,default:rh},Symbol.toStringTag,{value:"Module"}));var Xf={exports:{}},ml={},Zf={exports:{}},Jf={};var F1;function kk(){return F1||(F1=1,(function(e){function t(P,G){var K=P.length;P.push(G);e:for(;0<K;){var j=K-1>>>1,z=P[j];if(0<o(z,G))P[j]=G,P[K]=z,K=j;else break e}}function i(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var G=P[0],K=P.pop();if(K!==G){P[0]=K;e:for(var j=0,z=P.length,D=z>>>1;j<D;){var F=2*(j+1)-1,J=P[F],ne=F+1,Z=P[ne];if(0>o(J,K))ne<z&&0>o(Z,J)?(P[j]=Z,P[ne]=K,j=ne):(P[j]=J,P[F]=K,j=F);else if(ne<z&&0>o(Z,K))P[j]=Z,P[ne]=K,j=ne;else break e}}return G}function o(P,G){var K=P.sortIndex-G.sortIndex;return K!==0?K:P.id-G.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=[],v=1,g=null,x=3,C=!1,T=!1,w=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var G=i(d);G!==null;){if(G.callback===null)s(d);else if(G.startTime<=P)s(d),G.sortIndex=G.expirationTime,t(h,G);else break;G=i(d)}}function L(P){if(w=!1,k(P),!T)if(i(h)!==null)T=!0,R||(R=!0,W());else{var G=i(d);G!==null&&Y(L,G.startTime-P)}}var R=!1,N=-1,A=5,B=-1;function V(){return m?!0:!(e.unstable_now()-B<A)}function U(){if(m=!1,R){var P=e.unstable_now();B=P;var G=!0;try{e:{T=!1,w&&(w=!1,_(N),N=-1),C=!0;var K=x;try{t:{for(k(P),g=i(h);g!==null&&!(g.expirationTime>P&&V());){var j=g.callback;if(typeof j=="function"){g.callback=null,x=g.priorityLevel;var z=j(g.expirationTime<=P);if(P=e.unstable_now(),typeof z=="function"){g.callback=z,k(P),G=!0;break t}g===i(h)&&s(h),k(P)}else s(h);g=i(h)}if(g!==null)G=!0;else{var D=i(d);D!==null&&Y(L,D.startTime-P),G=!1}}break e}finally{g=null,x=K,C=!1}G=void 0}}finally{G?W():R=!1}}}var W;if(typeof S=="function")W=function(){S(U)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,X=I.port2;I.port1.onmessage=U,W=function(){X.postMessage(null)}}else W=function(){b(U,0)};function Y(P,G){N=b(function(){P(e.unstable_now())},G)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(P){switch(x){case 1:case 2:case 3:var G=3;break;default:G=x}var K=x;x=G;try{return P()}finally{x=K}},e.unstable_requestPaint=function(){m=!0},e.unstable_runWithPriority=function(P,G){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var K=x;x=P;try{return G()}finally{x=K}},e.unstable_scheduleCallback=function(P,G,K){var j=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?j+K:j):K=j,P){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=K+z,P={id:v++,callback:G,priorityLevel:P,startTime:K,expirationTime:z,sortIndex:-1},K>j?(P.sortIndex=K,t(d,P),i(h)===null&&P===i(d)&&(w?(_(N),N=-1):w=!0,Y(L,K-j))):(P.sortIndex=z,t(h,P),T||C||(T=!0,R||(R=!0,W()))),P},e.unstable_shouldYield=V,e.unstable_wrapCallback=function(P){var G=x;return function(){var K=x;x=G;try{return P.apply(this,arguments)}finally{x=K}}}})(Jf)),Jf}var W1;function Tk(){return W1||(W1=1,Zf.exports=kk()),Zf.exports}var Qf={exports:{}},Hn={};var G1;function Ak(){if(G1)return Hn;G1=1;var e=hm();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)d+="&args[]="+encodeURIComponent(arguments[v])}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,v){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:v}}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 Hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Hn.createPortal=function(h,d){var v=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,v)},Hn.flushSync=function(h){var d=p.T,v=s.p;try{if(p.T=null,s.p=2,h)return h()}finally{p.T=d,s.p=v,s.d.f()}},Hn.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))},Hn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Hn.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var v=d.as,g=c(v,d.crossOrigin),x=typeof d.integrity=="string"?d.integrity:void 0,C=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;v==="style"?s.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:C}):v==="script"&&s.d.X(h,{crossOrigin:g,integrity:x,fetchPriority:C,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Hn.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var v=c(d.as,d.crossOrigin);s.d.M(h,{crossOrigin:v,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)},Hn.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var v=d.as,g=c(v,d.crossOrigin);s.d.L(h,v,{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})}},Hn.preloadModule=function(h,d){if(typeof h=="string")if(d){var v=c(d.as,d.crossOrigin);s.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:v,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else s.d.m(h)},Hn.requestFormReset=function(h){s.d.r(h)},Hn.unstable_batchedUpdates=function(h,d){return h(d)},Hn.useFormState=function(h,d,v){return p.H.useFormState(h,d,v)},Hn.useFormStatus=function(){return p.H.useHostTransitionStatus()},Hn.version="19.2.7",Hn}var q1;function JS(){if(q1)return Qf.exports;q1=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(),Qf.exports=Ak(),Qf.exports}var K1;function Rk(){if(K1)return ml;K1=1;var e=Tk(),t=hm(),i=JS();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 v(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=v(n),r!==null)return r;n=n.sibling}return null}var g=Object.assign,x=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"),_=Symbol.for("react.consumer"),S=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"),B=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function W(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var I=Symbol.for("react.client.reference");function X(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===I?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 B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case S:return n.displayName||"Context";case _: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:X(n.type)||"Memo";case A:r=n._payload,n=n._init;try{return X(n(r))}catch{}}return null}var Y=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},j=[],z=-1;function D(n){return{current:n}}function F(n){0>z||(n.current=j[z],j[z]=null,z--)}function J(n,r){z++,j[z]=n.current,n.current=r}var ne=D(null),Z=D(null),re=D(null),q=D(null);function H(n,r){switch(J(re,r),J(Z,n),J(ne,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?o1(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=o1(r),n=l1(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}F(ne),J(ne,n)}function se(){F(ne),F(Z),F(re)}function de(n){n.memoizedState!==null&&J(q,n);var r=ne.current,a=l1(r,n.type);r!==a&&(J(Z,n),J(ne,a))}function xe(n){Z.current===n&&(F(ne),F(Z)),q.current===n&&(F(q),hl._currentValue=K)}var ye,Me;function Oe(n){if(ye===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);ye=r&&r[1]||"",Me=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+ye+n+Me}var Fe=!1;function ht(n,r){if(!n||Fe)return"";Fe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(r){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(he){var ue=he}Reflect.construct(n,[],me)}else{try{me.call()}catch(he){ue=he}n.call(me.prototype)}}else{try{throw Error()}catch(he){ue=he}(me=n())&&typeof me.catch=="function"&&me.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 fe=`
|
|
6
|
+
`+te[l].replace(" at new "," at ");return n.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",n.displayName)),fe}while(1<=l&&0<=y);break}}}finally{Fe=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Oe(a):""}function Ae(n,r){switch(n.tag){case 26:case 27:case 5:return Oe(n.type);case 16:return Oe("Lazy");case 13:return n.child!==r&&r!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return ht(n.type,!1);case 11:return ht(n.type.render,!1);case 1:return ht(n.type,!0);case 31:return Oe("Activity");default:return""}}function Rt(n){try{var r="",a=null;do r+=Ae(n,a),a=n,n=n.return;while(n);return r}catch(l){return`
|
|
7
|
+
Error generating stack: `+l.message+`
|
|
8
|
+
`+l.stack}}var Xt=Object.prototype.hasOwnProperty,vn=e.unstable_scheduleCallback,on=e.unstable_cancelCallback,kn=e.unstable_shouldYield,Zt=e.unstable_requestPaint,ct=e.unstable_now,Lt=e.unstable_getCurrentPriorityLevel,Ct=e.unstable_ImmediatePriority,Ft=e.unstable_UserBlockingPriority,Kt=e.unstable_NormalPriority,Jn=e.unstable_LowPriority,bn=e.unstable_IdlePriority,Pn=e.log,dt=e.unstable_setDisableYieldValue,Tn=null,ve=null;function $e(n){if(typeof Pn=="function"&&dt(n),ve&&typeof ve.setStrictMode=="function")try{ve.setStrictMode(Tn,n)}catch{}}var Je=Math.clz32?Math.clz32:ln,_t=Math.log,Ve=Math.LN2;function ln(n){return n>>>=0,n===0?32:31-(_t(n)/Ve|0)|0}var Dt=256,An=262144,Un=4194304;function jt(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=jt(l):(O&=$,O!==0?y=jt(O):a||(a=$&~n,a!==0&&(y=jt(a))))):($=l&~E,$!==0?y=jt($):O!==0?y=jt(O):a||(a=l&~n,a!==0&&(y=jt(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 Se(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 je(){var n=Un;return Un<<=1,(Un&62914560)===0&&(Un=4194304),n}function bt(n){for(var r=[],a=0;31>a;a++)r.push(n);return r}function ut(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ke(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 fe=31-Je(a),me=1<<fe;$[fe]=0,te[fe]=-1;var ue=ce[fe];if(ue!==null)for(ce[fe]=null,fe=0;fe<ue.length;fe++){var he=ue[fe];he!==null&&(he.lane&=-536870913)}a&=~me}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-Je(r);n.entangledLanes|=r,n.entanglements[l]=n.entanglements[l]|1073741824|a&261930}function Pe(n,r){var a=n.entangledLanes|=r;for(n=n.entanglements;a;){var l=31-Je(a),y=1<<l;y&r|n[l]&r&&(n[l]|=r),a&=~y}}function Vt(n,r){var a=r&-r;return a=(a&42)!==0?1:nt(a),(a&(n.suspendedLanes|r))!==0?0:a}function nt(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 Rn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function dr(){var n=G.p;return n!==0?n:(n=window.event,n===void 0?32:M1(n.type))}function fr(n,r){var a=G.p;try{return G.p=n,r()}finally{G.p=a}}var Qn=Math.random().toString(36).slice(2),It="__reactFiber$"+Qn,Nt="__reactProps$"+Qn,Fi="__reactContainer$"+Qn,Fr="__reactEvents$"+Qn,ca="__reactListeners$"+Qn,pr="__reactHandles$"+Qn,Rs="__reactResources$"+Qn,er="__reactMarker$"+Qn;function De(n){delete n[It],delete n[Nt],delete n[Fr],delete n[ca],delete n[pr]}function Q(n){var r=n[It];if(r)return r;for(var a=n.parentNode;a;){if(r=a[Fi]||a[It]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(n=g1(n);n!==null;){if(a=n[It])return a;n=g1(n)}return r}n=a,a=n.parentNode}return null}function _e(n){if(n=n[It]||n[Fi]){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 at(n){var r=n[Rs];return r||(r=n[Rs]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Qe(n){n[er]=!0}var Bt=new Set,Jt={};function Qt(n,r){be(n,r),be(n+"Capture",r)}function be(n,r){for(Jt[n]=r,n=0;n<r.length;n++)Bt.add(r[n])}var Ne=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={},ft={};function Wt(n){return Xt.call(ft,n)?!0:Xt.call(Ie,n)?!1:Ne.test(n)?ft[n]=!0:(Ie[n]=!0,!1)}function zn(n,r,a){if(Wt(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 hi(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 ei(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 Ot(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function di(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function lc(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 ua(n){if(!n._valueTracker){var r=di(n)?"checked":"value";n._valueTracker=lc(n,r,""+n[r])}}function Co(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var a=r.getValue(),l="";return n&&(l=di(n)?n.checked?"true":"false":n.value),n=l,n!==a?(r.setValue(n),!0):!1}function ha(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 Gh=/[\n"\\]/g;function ti(n){return n.replace(Gh,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Eo(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=""+Ot(r)):n.value!==""+Ot(r)&&(n.value=""+Ot(r)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),r!=null?da(n,O,Ot(r)):a!=null?da(n,O,Ot(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=""+Ot($):n.removeAttribute("name")}function Ls(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)){ua(n);return}a=a!=null?""+Ot(a):"",r=r!=null?""+Ot(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),ua(n)}function da(n,r,a){r==="number"&&ha(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function Ln(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=""+Ot(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 cc(n,r,a){if(r!=null&&(r=""+Ot(r),r!==n.value&&(n.value=r),a==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=a!=null?""+Ot(a):""}function fa(n,r,a,l){if(r==null){if(l!=null){if(a!=null)throw Error(s(92));if(Y(l)){if(1<l.length)throw Error(s(93));l=l[0]}a=l}a==null&&(a=""),r=a}a=Ot(r),n.defaultValue=a,l=n.textContent,l===a&&l!==""&&l!==null&&(n.value=l),ua(n)}function Ue(n,r){if(r){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=r;return}}n.textContent=r}var uc=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 hn(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||uc.has(r)?r==="float"?n.cssFloat=a:n[r]=(""+a).trim():n[r]=a+"px"}function yt(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&&hn(n,y,l)}else for(var E in r)r.hasOwnProperty(E)&&hn(n,E,r[E])}function Wr(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 gr=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"]]),ko=/^[\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 Gr(n){return ko.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function we(){}var Re=null;function Ge(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var it=null,Yt=null;function Ti(n){var r=_e(n);if(r&&(n=r.stateNode)){var a=n[Nt]||null;e:switch(n=r.stateNode,r.type){case"input":if(Eo(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="'+ti(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var l=a[r];if(l!==n&&l.form===n.form){var y=l[Nt]||null;if(!y)throw Error(s(90));Eo(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&&Co(l)}break e;case"textarea":cc(n,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&Ln(n,!!a.multiple,r,!1)}}}var To=!1;function hc(n,r,a){if(To)return n(r,a);To=!0;try{var l=n(r);return l}finally{if(To=!1,(it!==null||Yt!==null)&&(Jc(),it&&(r=it,n=Yt,Yt=it=null,Ti(r),n)))for(r=0;r<n.length;r++)Ti(n[r])}}function Ao(n,r){var a=n.stateNode;if(a===null)return null;var l=a[Nt]||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 mr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qh=!1;if(mr)try{var Ro={};Object.defineProperty(Ro,"passive",{get:function(){qh=!0}}),window.addEventListener("test",Ro,Ro),window.removeEventListener("test",Ro,Ro)}catch{qh=!1}var qr=null,Kh=null,dc=null;function l_(){if(dc)return dc;var n,r=Kh,a=r.length,l,y="value"in qr?qr.value:qr.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 dc=y.slice(n,1<l?1-l:void 0)}function fc(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 pc(){return!0}function c_(){return!1}function ni(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)?pc:c_,this.isPropagationStopped=c_,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=pc)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=pc)},persist:function(){},isPersistent:pc}),r}var Ms={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gc=ni(Ms),Lo=g({},Ms,{view:0,detail:0}),F2=ni(Lo),Vh,Yh,Mo,mc=g({},Lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zh,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!==Mo&&(Mo&&n.type==="mousemove"?(Vh=n.screenX-Mo.screenX,Yh=n.screenY-Mo.screenY):Yh=Vh=0,Mo=n),Vh)},movementY:function(n){return"movementY"in n?n.movementY:Yh}}),u_=ni(mc),W2=g({},mc,{dataTransfer:0}),G2=ni(W2),q2=g({},Lo,{relatedTarget:0}),Xh=ni(q2),K2=g({},Ms,{animationName:0,elapsedTime:0,pseudoElement:0}),V2=ni(K2),Y2=g({},Ms,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),X2=ni(Y2),Z2=g({},Ms,{data:0}),h_=ni(Z2),J2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q2={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"},eE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function tE(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=eE[n])?!!r[n]:!1}function Zh(){return tE}var nE=g({},Lo,{key:function(n){if(n.key){var r=J2[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=fc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Q2[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zh,charCode:function(n){return n.type==="keypress"?fc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?fc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),iE=ni(nE),rE=g({},mc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),d_=ni(rE),sE=g({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zh}),aE=ni(sE),oE=g({},Ms,{propertyName:0,elapsedTime:0,pseudoElement:0}),lE=ni(oE),cE=g({},mc,{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}),uE=ni(cE),hE=g({},Ms,{newState:0,oldState:0}),dE=ni(hE),fE=[9,13,27,32],Jh=mr&&"CompositionEvent"in window,No=null;mr&&"documentMode"in document&&(No=document.documentMode);var pE=mr&&"TextEvent"in window&&!No,f_=mr&&(!Jh||No&&8<No&&11>=No),p_=" ",g_=!1;function m_(n,r){switch(n){case"keyup":return fE.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function __(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var pa=!1;function gE(n,r){switch(n){case"compositionend":return __(r);case"keypress":return r.which!==32?null:(g_=!0,p_);case"textInput":return n=r.data,n===p_&&g_?null:n;default:return null}}function mE(n,r){if(pa)return n==="compositionend"||!Jh&&m_(n,r)?(n=l_(),dc=Kh=qr=null,pa=!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 f_&&r.locale!=="ko"?null:r.data;default:return null}}var _E={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 v_(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!_E[n.type]:r==="textarea"}function b_(n,r,a,l){it?Yt?Yt.push(l):Yt=[l]:it=l,r=su(r,"onChange"),0<r.length&&(a=new gc("onChange","change",null,a,l),n.push({event:a,listeners:r}))}var Oo=null,Do=null;function vE(n){t1(n,0)}function _c(n){var r=Ee(n);if(Co(r))return n}function y_(n,r){if(n==="change")return r}var S_=!1;if(mr){var Qh;if(mr){var ed="oninput"in document;if(!ed){var x_=document.createElement("div");x_.setAttribute("oninput","return;"),ed=typeof x_.oninput=="function"}Qh=ed}else Qh=!1;S_=Qh&&(!document.documentMode||9<document.documentMode)}function w_(){Oo&&(Oo.detachEvent("onpropertychange",C_),Do=Oo=null)}function C_(n){if(n.propertyName==="value"&&_c(Do)){var r=[];b_(r,Do,n,Ge(n)),hc(vE,r)}}function bE(n,r,a){n==="focusin"?(w_(),Oo=r,Do=a,Oo.attachEvent("onpropertychange",C_)):n==="focusout"&&w_()}function yE(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return _c(Do)}function SE(n,r){if(n==="click")return _c(r)}function xE(n,r){if(n==="input"||n==="change")return _c(r)}function wE(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var fi=typeof Object.is=="function"?Object.is:wE;function jo(n,r){if(fi(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(!Xt.call(r,y)||!fi(n[y],r[y]))return!1}return!0}function E_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function k_(n,r){var a=E_(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=E_(a)}}function T_(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?T_(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function A_(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=ha(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=ha(n.document)}return r}function td(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 CE=mr&&"documentMode"in document&&11>=document.documentMode,ga=null,nd=null,Io=null,id=!1;function R_(n,r,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;id||ga==null||ga!==ha(l)||(l=ga,"selectionStart"in l&&td(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}),Io&&jo(Io,l)||(Io=l,l=su(nd,"onSelect"),0<l.length&&(r=new gc("onSelect","select",null,r,a),n.push({event:r,listeners:l}),r.target=ga)))}function Ns(n,r){var a={};return a[n.toLowerCase()]=r.toLowerCase(),a["Webkit"+n]="webkit"+r,a["Moz"+n]="moz"+r,a}var ma={animationend:Ns("Animation","AnimationEnd"),animationiteration:Ns("Animation","AnimationIteration"),animationstart:Ns("Animation","AnimationStart"),transitionrun:Ns("Transition","TransitionRun"),transitionstart:Ns("Transition","TransitionStart"),transitioncancel:Ns("Transition","TransitionCancel"),transitionend:Ns("Transition","TransitionEnd")},rd={},L_={};mr&&(L_=document.createElement("div").style,"AnimationEvent"in window||(delete ma.animationend.animation,delete ma.animationiteration.animation,delete ma.animationstart.animation),"TransitionEvent"in window||delete ma.transitionend.transition);function Os(n){if(rd[n])return rd[n];if(!ma[n])return n;var r=ma[n],a;for(a in r)if(r.hasOwnProperty(a)&&a in L_)return rd[n]=r[a];return n}var M_=Os("animationend"),N_=Os("animationiteration"),O_=Os("animationstart"),EE=Os("transitionrun"),kE=Os("transitionstart"),TE=Os("transitioncancel"),D_=Os("transitionend"),j_=new Map,sd="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(" ");sd.push("scrollEnd");function Wi(n,r){j_.set(n,r),Qt(r,[n])}var vc=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)},Ai=[],_a=0,ad=0;function bc(){for(var n=_a,r=ad=_a=0;r<n;){var a=Ai[r];Ai[r++]=null;var l=Ai[r];Ai[r++]=null;var y=Ai[r];Ai[r++]=null;var E=Ai[r];if(Ai[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&&I_(a,y,E)}}function yc(n,r,a,l){Ai[_a++]=n,Ai[_a++]=r,Ai[_a++]=a,Ai[_a++]=l,ad|=l,n.lanes|=l,n=n.alternate,n!==null&&(n.lanes|=l)}function od(n,r,a,l){return yc(n,r,a,l),Sc(n)}function Ds(n,r){return yc(n,null,null,r),Sc(n)}function I_(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-Je(a),n=E.hiddenUpdates,l=n[y],l===null?n[y]=[r]:l.push(r),r.lane=a|536870912),E):null}function Sc(n){if(50<rl)throw rl=0,_f=null,Error(s(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var va={};function AE(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 pi(n,r,a,l){return new AE(n,r,a,l)}function ld(n){return n=n.prototype,!(!n||!n.isReactComponent)}function _r(n,r){var a=n.alternate;return a===null?(a=pi(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 B_(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 xc(n,r,a,l,y,E){var O=0;if(l=n,typeof n=="function")ld(n)&&(O=1);else if(typeof n=="string")O=O5(n,a,ne.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=pi(31,a,r,y),n.elementType=B,n.lanes=E,n;case w:return js(a.children,y,E,r);case m:O=8,y|=24;break;case b:return n=pi(12,a,r,y|2),n.elementType=b,n.lanes=E,n;case L:return n=pi(13,a,r,y),n.elementType=L,n.lanes=E,n;case R:return n=pi(19,a,r,y),n.elementType=R,n.lanes=E,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case S:O=10;break e;case _: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=pi(O,a,r,y),r.elementType=n,r.type=l,r.lanes=E,r}function js(n,r,a,l){return n=pi(7,n,l,r),n.lanes=a,n}function cd(n,r,a){return n=pi(6,n,null,r),n.lanes=a,n}function P_(n){var r=pi(18,null,null,0);return r.stateNode=n,r}function ud(n,r,a){return r=pi(4,n.children!==null?n.children:[],n.key,r),r.lanes=a,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var z_=new WeakMap;function Ri(n,r){if(typeof n=="object"&&n!==null){var a=z_.get(n);return a!==void 0?a:(r={value:n,source:r,stack:Rt(r)},z_.set(n,r),r)}return{value:n,source:r,stack:Rt(r)}}var ba=[],ya=0,wc=null,Bo=0,Li=[],Mi=0,Kr=null,tr=1,nr="";function vr(n,r){ba[ya++]=Bo,ba[ya++]=wc,wc=n,Bo=r}function H_(n,r,a){Li[Mi++]=tr,Li[Mi++]=nr,Li[Mi++]=Kr,Kr=n;var l=tr;n=nr;var y=32-Je(l)-1;l&=~(1<<y),a+=1;var E=32-Je(r)+y;if(30<E){var O=y-y%5;E=(l&(1<<O)-1).toString(32),l>>=O,y-=O,tr=1<<32-Je(r)+y|a<<y|l,nr=E+n}else tr=1<<E|a<<y|l,nr=n}function hd(n){n.return!==null&&(vr(n,1),H_(n,1,0))}function dd(n){for(;n===wc;)wc=ba[--ya],ba[ya]=null,Bo=ba[--ya],ba[ya]=null;for(;n===Kr;)Kr=Li[--Mi],Li[Mi]=null,nr=Li[--Mi],Li[Mi]=null,tr=Li[--Mi],Li[Mi]=null}function $_(n,r){Li[Mi++]=tr,Li[Mi++]=nr,Li[Mi++]=Kr,tr=r.id,nr=r.overflow,Kr=n}var Mn=null,Pt=null,ot=!1,Vr=null,Ni=!1,fd=Error(s(519));function Yr(n){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Po(Ri(r,n)),fd}function U_(n){var r=n.stateNode,a=n.type,l=n.memoizedProps;switch(r[It]=n,r[Nt]=l,a){case"dialog":tt("cancel",r),tt("close",r);break;case"iframe":case"object":case"embed":tt("load",r);break;case"video":case"audio":for(a=0;a<al.length;a++)tt(al[a],r);break;case"source":tt("error",r);break;case"img":case"image":case"link":tt("error",r),tt("load",r);break;case"details":tt("toggle",r);break;case"input":tt("invalid",r),Ls(r,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":tt("invalid",r);break;case"textarea":tt("invalid",r),fa(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||s1(r.textContent,a)?(l.popover!=null&&(tt("beforetoggle",r),tt("toggle",r)),l.onScroll!=null&&tt("scroll",r),l.onScrollEnd!=null&&tt("scrollend",r),l.onClick!=null&&(r.onclick=we),r=!0):r=!1,r||Yr(n,!0)}function F_(n){for(Mn=n.return;Mn;)switch(Mn.tag){case 5:case 31:case 13:Ni=!1;return;case 27:case 3:Ni=!0;return;default:Mn=Mn.return}}function Sa(n){if(n!==Mn)return!1;if(!ot)return F_(n),ot=!0,!1;var r=n.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||Nf(n.type,n.memoizedProps)),a=!a),a&&Pt&&Yr(n),F_(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=p1(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Pt=p1(n)}else r===27?(r=Pt,cs(n.type)?(n=Bf,Bf=null,Pt=n):Pt=r):Pt=Mn?Di(n.stateNode.nextSibling):null;return!0}function Is(){Pt=Mn=null,ot=!1}function pd(){var n=Vr;return n!==null&&(ai===null?ai=n:ai.push.apply(ai,n),Vr=null),n}function Po(n){Vr===null?Vr=[n]:Vr.push(n)}var gd=D(null),Bs=null,br=null;function Xr(n,r,a){J(gd,r._currentValue),r._currentValue=a}function yr(n){n._currentValue=gd.current,F(gd)}function md(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 _d(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),md(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),md(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 xa(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;fi(y.pendingProps.value,O.value)||(n!==null?n.push($):n=[$])}}else if(y===q.current){if(O=y.alternate,O===null)throw Error(s(387));O.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(n!==null?n.push(hl):n=[hl])}y=y.return}n!==null&&_d(r,n,a,l),r.flags|=262144}function Cc(n){for(n=n.firstContext;n!==null;){if(!fi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Ps(n){Bs=n,br=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Nn(n){return W_(Bs,n)}function Ec(n,r){return Bs===null&&Ps(n),W_(n,r)}function W_(n,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},br===null){if(n===null)throw Error(s(308));br=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else br=br.next=r;return a}var RE=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()})}},LE=e.unstable_scheduleCallback,ME=e.unstable_NormalPriority,dn={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vd(){return{controller:new RE,data:new Map,refCount:0}}function zo(n){n.refCount--,n.refCount===0&&LE(ME,function(){n.controller.abort()})}var Ho=null,bd=0,wa=0,Ca=null;function NE(n,r){if(Ho===null){var a=Ho=[];bd=0,wa=wf(),Ca={status:"pending",value:void 0,then:function(l){a.push(l)}}}return bd++,r.then(G_,G_),r}function G_(){if(--bd===0&&Ho!==null){Ca!==null&&(Ca.status="fulfilled");var n=Ho;Ho=null,wa=0,Ca=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function OE(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 q_=P.S;P.S=function(n,r){R0=ct(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&NE(n,r),q_!==null&&q_(n,r)};var zs=D(null);function yd(){var n=zs.current;return n!==null?n:Mt.pooledCache}function kc(n,r){r===null?J(zs,zs.current):J(zs,r.pool)}function K_(){var n=yd();return n===null?null:{parent:dn._currentValue,pool:n}}var Ea=Error(s(460)),Sd=Error(s(474)),Tc=Error(s(542)),Ac={then:function(){}};function V_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Y_(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,Z_(n),n;default:if(typeof r.status=="string")r.then(we,we);else{if(n=Mt,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,Z_(n),n}throw $s=r,Ea}}function Hs(n){try{var r=n._init;return r(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?($s=a,Ea):a}}var $s=null;function X_(){if($s===null)throw Error(s(459));var n=$s;return $s=null,n}function Z_(n){if(n===Ea||n===Tc)throw Error(s(483))}var ka=null,$o=0;function Rc(n){var r=$o;return $o+=1,ka===null&&(ka=[]),Y_(ka,n,r)}function Uo(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function Lc(n,r){throw r.$$typeof===x?Error(s(525)):(n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function J_(n){function r(ae,ie){if(n){var le=ae.deletions;le===null?(ae.deletions=[ie],ae.flags|=16):le.push(ie)}}function a(ae,ie){if(!n)return null;for(;ie!==null;)r(ae,ie),ie=ie.sibling;return null}function l(ae){for(var ie=new Map;ae!==null;)ae.key!==null?ie.set(ae.key,ae):ie.set(ae.index,ae),ae=ae.sibling;return ie}function y(ae,ie){return ae=_r(ae,ie),ae.index=0,ae.sibling=null,ae}function E(ae,ie,le){return ae.index=le,n?(le=ae.alternate,le!==null?(le=le.index,le<ie?(ae.flags|=67108866,ie):le):(ae.flags|=67108866,ie)):(ae.flags|=1048576,ie)}function O(ae){return n&&ae.alternate===null&&(ae.flags|=67108866),ae}function $(ae,ie,le,ge){return ie===null||ie.tag!==6?(ie=cd(le,ae.mode,ge),ie.return=ae,ie):(ie=y(ie,le),ie.return=ae,ie)}function te(ae,ie,le,ge){var Be=le.type;return Be===w?fe(ae,ie,le.props.children,ge,le.key):ie!==null&&(ie.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&Hs(Be)===ie.type)?(ie=y(ie,le.props),Uo(ie,le),ie.return=ae,ie):(ie=xc(le.type,le.key,le.props,null,ae.mode,ge),Uo(ie,le),ie.return=ae,ie)}function ce(ae,ie,le,ge){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==le.containerInfo||ie.stateNode.implementation!==le.implementation?(ie=ud(le,ae.mode,ge),ie.return=ae,ie):(ie=y(ie,le.children||[]),ie.return=ae,ie)}function fe(ae,ie,le,ge,Be){return ie===null||ie.tag!==7?(ie=js(le,ae.mode,ge,Be),ie.return=ae,ie):(ie=y(ie,le),ie.return=ae,ie)}function me(ae,ie,le){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=cd(""+ie,ae.mode,le),ie.return=ae,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case C:return le=xc(ie.type,ie.key,ie.props,null,ae.mode,le),Uo(le,ie),le.return=ae,le;case T:return ie=ud(ie,ae.mode,le),ie.return=ae,ie;case A:return ie=Hs(ie),me(ae,ie,le)}if(Y(ie)||W(ie))return ie=js(ie,ae.mode,le,null),ie.return=ae,ie;if(typeof ie.then=="function")return me(ae,Rc(ie),le);if(ie.$$typeof===S)return me(ae,Ec(ae,ie),le);Lc(ae,ie)}return null}function ue(ae,ie,le,ge){var Be=ie!==null?ie.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return Be!==null?null:$(ae,ie,""+le,ge);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case C:return le.key===Be?te(ae,ie,le,ge):null;case T:return le.key===Be?ce(ae,ie,le,ge):null;case A:return le=Hs(le),ue(ae,ie,le,ge)}if(Y(le)||W(le))return Be!==null?null:fe(ae,ie,le,ge,null);if(typeof le.then=="function")return ue(ae,ie,Rc(le),ge);if(le.$$typeof===S)return ue(ae,ie,Ec(ae,le),ge);Lc(ae,le)}return null}function he(ae,ie,le,ge,Be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ae=ae.get(le)||null,$(ie,ae,""+ge,Be);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case C:return ae=ae.get(ge.key===null?le:ge.key)||null,te(ie,ae,ge,Be);case T:return ae=ae.get(ge.key===null?le:ge.key)||null,ce(ie,ae,ge,Be);case A:return ge=Hs(ge),he(ae,ie,le,ge,Be)}if(Y(ge)||W(ge))return ae=ae.get(le)||null,fe(ie,ae,ge,Be,null);if(typeof ge.then=="function")return he(ae,ie,le,Rc(ge),Be);if(ge.$$typeof===S)return he(ae,ie,le,Ec(ie,ge),Be);Lc(ie,ge)}return null}function Te(ae,ie,le,ge){for(var Be=null,pt=null,Le=ie,Ye=ie=0,st=null;Le!==null&&Ye<le.length;Ye++){Le.index>Ye?(st=Le,Le=null):st=Le.sibling;var gt=ue(ae,Le,le[Ye],ge);if(gt===null){Le===null&&(Le=st);break}n&&Le&>.alternate===null&&r(ae,Le),ie=E(gt,ie,Ye),pt===null?Be=gt:pt.sibling=gt,pt=gt,Le=st}if(Ye===le.length)return a(ae,Le),ot&&vr(ae,Ye),Be;if(Le===null){for(;Ye<le.length;Ye++)Le=me(ae,le[Ye],ge),Le!==null&&(ie=E(Le,ie,Ye),pt===null?Be=Le:pt.sibling=Le,pt=Le);return ot&&vr(ae,Ye),Be}for(Le=l(Le);Ye<le.length;Ye++)st=he(Le,ae,Ye,le[Ye],ge),st!==null&&(n&&st.alternate!==null&&Le.delete(st.key===null?Ye:st.key),ie=E(st,ie,Ye),pt===null?Be=st:pt.sibling=st,pt=st);return n&&Le.forEach(function(ps){return r(ae,ps)}),ot&&vr(ae,Ye),Be}function He(ae,ie,le,ge){if(le==null)throw Error(s(151));for(var Be=null,pt=null,Le=ie,Ye=ie=0,st=null,gt=le.next();Le!==null&&!gt.done;Ye++,gt=le.next()){Le.index>Ye?(st=Le,Le=null):st=Le.sibling;var ps=ue(ae,Le,gt.value,ge);if(ps===null){Le===null&&(Le=st);break}n&&Le&&ps.alternate===null&&r(ae,Le),ie=E(ps,ie,Ye),pt===null?Be=ps:pt.sibling=ps,pt=ps,Le=st}if(gt.done)return a(ae,Le),ot&&vr(ae,Ye),Be;if(Le===null){for(;!gt.done;Ye++,gt=le.next())gt=me(ae,gt.value,ge),gt!==null&&(ie=E(gt,ie,Ye),pt===null?Be=gt:pt.sibling=gt,pt=gt);return ot&&vr(ae,Ye),Be}for(Le=l(Le);!gt.done;Ye++,gt=le.next())gt=he(Le,ae,Ye,gt.value,ge),gt!==null&&(n&>.alternate!==null&&Le.delete(gt.key===null?Ye:gt.key),ie=E(gt,ie,Ye),pt===null?Be=gt:pt.sibling=gt,pt=gt);return n&&Le.forEach(function(W5){return r(ae,W5)}),ot&&vr(ae,Ye),Be}function Tt(ae,ie,le,ge){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 Be=le.key;ie!==null;){if(ie.key===Be){if(Be=le.type,Be===w){if(ie.tag===7){a(ae,ie.sibling),ge=y(ie,le.props.children),ge.return=ae,ae=ge;break e}}else if(ie.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===A&&Hs(Be)===ie.type){a(ae,ie.sibling),ge=y(ie,le.props),Uo(ge,le),ge.return=ae,ae=ge;break e}a(ae,ie);break}else r(ae,ie);ie=ie.sibling}le.type===w?(ge=js(le.props.children,ae.mode,ge,le.key),ge.return=ae,ae=ge):(ge=xc(le.type,le.key,le.props,null,ae.mode,ge),Uo(ge,le),ge.return=ae,ae=ge)}return O(ae);case T:e:{for(Be=le.key;ie!==null;){if(ie.key===Be)if(ie.tag===4&&ie.stateNode.containerInfo===le.containerInfo&&ie.stateNode.implementation===le.implementation){a(ae,ie.sibling),ge=y(ie,le.children||[]),ge.return=ae,ae=ge;break e}else{a(ae,ie);break}else r(ae,ie);ie=ie.sibling}ge=ud(le,ae.mode,ge),ge.return=ae,ae=ge}return O(ae);case A:return le=Hs(le),Tt(ae,ie,le,ge)}if(Y(le))return Te(ae,ie,le,ge);if(W(le)){if(Be=W(le),typeof Be!="function")throw Error(s(150));return le=Be.call(le),He(ae,ie,le,ge)}if(typeof le.then=="function")return Tt(ae,ie,Rc(le),ge);if(le.$$typeof===S)return Tt(ae,ie,Ec(ae,le),ge);Lc(ae,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,ie!==null&&ie.tag===6?(a(ae,ie.sibling),ge=y(ie,le),ge.return=ae,ae=ge):(a(ae,ie),ge=cd(le,ae.mode,ge),ge.return=ae,ae=ge),O(ae)):a(ae,ie)}return function(ae,ie,le,ge){try{$o=0;var Be=Tt(ae,ie,le,ge);return ka=null,Be}catch(Le){if(Le===Ea||Le===Tc)throw Le;var pt=pi(29,Le,null,ae.mode);return pt.lanes=ge,pt.return=ae,pt}}}var Us=J_(!0),Q_=J_(!1),Zr=!1;function xd(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wd(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 Jr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Qr(n,r,a){var l=n.updateQueue;if(l===null)return null;if(l=l.shared,(vt&2)!==0){var y=l.pending;return y===null?r.next=r:(r.next=y.next,y.next=r),l.pending=r,r=Sc(n),I_(n,null,a),r}return yc(n,l,r,a),Sc(n)}function Fo(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,Pe(n,a)}}function Cd(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 Ed=!1;function Wo(){if(Ed){var n=Ca;if(n!==null)throw n}}function Go(n,r,a,l){Ed=!1;var y=n.updateQueue;Zr=!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 fe=n.alternate;fe!==null&&(fe=fe.updateQueue,$=fe.lastBaseUpdate,$!==O&&($===null?fe.firstBaseUpdate=ce:$.next=ce,fe.lastBaseUpdate=te))}if(E!==null){var me=y.baseState;O=0,fe=ce=te=null,$=E;do{var ue=$.lane&-536870913,he=ue!==$.lane;if(he?(rt&ue)===ue:(l&ue)===ue){ue!==0&&ue===wa&&(Ed=!0),fe!==null&&(fe=fe.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Te=n,He=$;ue=r;var Tt=a;switch(He.tag){case 1:if(Te=He.payload,typeof Te=="function"){me=Te.call(Tt,me,ue);break e}me=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=He.payload,ue=typeof Te=="function"?Te.call(Tt,me,ue):Te,ue==null)break e;me=g({},me,ue);break e;case 2:Zr=!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},fe===null?(ce=fe=he,te=me):fe=fe.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);fe===null&&(te=me),y.baseState=te,y.firstBaseUpdate=ce,y.lastBaseUpdate=fe,E===null&&(y.shared.lanes=0),rs|=O,n.lanes=O,n.memoizedState=me}}function ev(n,r){if(typeof n!="function")throw Error(s(191,n));n.call(r)}function tv(n,r){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)ev(a[n],r)}var Ta=D(null),Mc=D(0);function nv(n,r){n=Rr,J(Mc,n),J(Ta,r),Rr=n|r.baseLanes}function kd(){J(Mc,Rr),J(Ta,Ta.current)}function Td(){Rr=Mc.current,F(Ta),F(Mc)}var gi=D(null),Oi=null;function es(n){var r=n.alternate;J(cn,cn.current&1),J(gi,n),Oi===null&&(r===null||Ta.current!==null||r.memoizedState!==null)&&(Oi=n)}function Ad(n){J(cn,cn.current),J(gi,n),Oi===null&&(Oi=n)}function iv(n){n.tag===22?(J(cn,cn.current),J(gi,n),Oi===null&&(Oi=n)):ts()}function ts(){J(cn,cn.current),J(gi,gi.current)}function mi(n){F(gi),Oi===n&&(Oi=null),F(cn)}var cn=D(0);function Nc(n){for(var r=n;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||jf(a)||If(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 Sr=0,qe=null,Et=null,fn=null,Oc=!1,Aa=!1,Fs=!1,Dc=0,qo=0,Ra=null,DE=0;function en(){throw Error(s(321))}function Rd(n,r){if(r===null)return!1;for(var a=0;a<r.length&&a<n.length;a++)if(!fi(n[a],r[a]))return!1;return!0}function Ld(n,r,a,l,y,E){return Sr=E,qe=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,P.H=n===null||n.memoizedState===null?Hv:Gd,Fs=!1,E=a(l,y),Fs=!1,Aa&&(E=sv(r,a,l,y)),rv(n),E}function rv(n){P.H=Yo;var r=Et!==null&&Et.next!==null;if(Sr=0,fn=Et=qe=null,Oc=!1,qo=0,Ra=null,r)throw Error(s(300));n===null||pn||(n=n.dependencies,n!==null&&Cc(n)&&(pn=!0))}function sv(n,r,a,l){qe=n;var y=0;do{if(Aa&&(Ra=null),qo=0,Aa=!1,25<=y)throw Error(s(301));if(y+=1,fn=Et=null,n.updateQueue!=null){var E=n.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}P.H=$v,E=r(a,l)}while(Aa);return E}function jE(){var n=P.H,r=n.useState()[0];return r=typeof r.then=="function"?Ko(r):r,n=n.useState()[0],(Et!==null?Et.memoizedState:null)!==n&&(qe.flags|=1024),r}function Md(){var n=Dc!==0;return Dc=0,n}function Nd(n,r,a){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~a}function Od(n){if(Oc){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Oc=!1}Sr=0,fn=Et=qe=null,Aa=!1,qo=Dc=0,Ra=null}function Fn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?qe.memoizedState=fn=n:fn=fn.next=n,fn}function un(){if(Et===null){var n=qe.alternate;n=n!==null?n.memoizedState:null}else n=Et.next;var r=fn===null?qe.memoizedState:fn.next;if(r!==null)fn=r,Et=n;else{if(n===null)throw qe.alternate===null?Error(s(467)):Error(s(310));Et=n,n={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},fn===null?qe.memoizedState=fn=n:fn=fn.next=n}return fn}function jc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ko(n){var r=qo;return qo+=1,Ra===null&&(Ra=[]),n=Y_(Ra,n,r),r=qe,(fn===null?r.memoizedState:fn.next)===null&&(r=r.alternate,P.H=r===null||r.memoizedState===null?Hv:Gd),n}function Ic(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ko(n);if(n.$$typeof===S)return Nn(n)}throw Error(s(438,String(n)))}function Dd(n){var r=null,a=qe.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var l=qe.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=jc(),qe.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]=V;return r.index++,a}function xr(n,r){return typeof r=="function"?r(n):r}function Bc(n){var r=un();return jd(r,Et,n)}function jd(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,fe=!1;do{var me=ce.lane&-536870913;if(me!==ce.lane?(rt&me)===me:(Sr&me)===me){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}),me===wa&&(fe=!0);else if((Sr&ue)===ue){ce=ce.next,ue===wa&&(fe=!0);continue}else me={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},te===null?($=te=me,O=E):te=te.next=me,qe.lanes|=ue,rs|=ue;me=ce.action,Fs&&a(E,me),E=ce.hasEagerState?ce.eagerState:a(E,me)}else ue={lane:me,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,qe.lanes|=me,rs|=me;ce=ce.next}while(ce!==null&&ce!==r);if(te===null?O=E:te.next=$,!fi(E,n.memoizedState)&&(pn=!0,fe&&(a=Ca,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 Id(n){var r=un(),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);fi(E,r.memoizedState)||(pn=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),a.lastRenderedState=E}return[E,l]}function av(n,r,a){var l=qe,y=un(),E=ot;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=r();var O=!fi((Et||y).memoizedState,a);if(O&&(y.memoizedState=a,pn=!0),y=y.queue,zd(cv.bind(null,l,y,n),[n]),y.getSnapshot!==r||O||fn!==null&&fn.memoizedState.tag&1){if(l.flags|=2048,La(9,{destroy:void 0},lv.bind(null,l,y,a,r),null),Mt===null)throw Error(s(349));E||(Sr&127)!==0||ov(l,r,a)}return a}function ov(n,r,a){n.flags|=16384,n={getSnapshot:r,value:a},r=qe.updateQueue,r===null?(r=jc(),qe.updateQueue=r,r.stores=[n]):(a=r.stores,a===null?r.stores=[n]:a.push(n))}function lv(n,r,a,l){r.value=a,r.getSnapshot=l,uv(r)&&hv(n)}function cv(n,r,a){return a(function(){uv(r)&&hv(n)})}function uv(n){var r=n.getSnapshot;n=n.value;try{var a=r();return!fi(n,a)}catch{return!0}}function hv(n){var r=Ds(n,2);r!==null&&oi(r,n,2)}function Bd(n){var r=Fn();if(typeof n=="function"){var a=n;if(n=a(),Fs){$e(!0);try{a()}finally{$e(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:n},r}function dv(n,r,a,l){return n.baseState=a,jd(n,Et,typeof l=="function"?l:xr)}function IE(n,r,a,l,y){if(Hc(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)}};P.T!==null?a(!0):E.isTransition=!1,l(E),a=r.pending,a===null?(E.next=r.pending=E,fv(r,E)):(E.next=a.next,r.pending=a.next=E)}}function fv(n,r){var a=r.action,l=r.payload,y=n.state;if(r.isTransition){var E=P.T,O={};P.T=O;try{var $=a(y,l),te=P.S;te!==null&&te(O,$),pv(n,r,$)}catch(ce){Pd(n,r,ce)}finally{E!==null&&O.types!==null&&(E.types=O.types),P.T=E}}else try{E=a(y,l),pv(n,r,E)}catch(ce){Pd(n,r,ce)}}function pv(n,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){gv(n,r,l)},function(l){return Pd(n,r,l)}):gv(n,r,a)}function gv(n,r,a){r.status="fulfilled",r.value=a,mv(r),n.state=a,r=n.pending,r!==null&&(a=r.next,a===r?n.pending=null:(a=a.next,r.next=a,fv(n,a)))}function Pd(n,r,a){var l=n.pending;if(n.pending=null,l!==null){l=l.next;do r.status="rejected",r.reason=a,mv(r),r=r.next;while(r!==l)}n.action=null}function mv(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function _v(n,r){return r}function vv(n,r){if(ot){var a=Mt.formState;if(a!==null){e:{var l=qe;if(ot){if(Pt){t:{for(var y=Pt,E=Ni;y.nodeType!==8;){if(!E){y=null;break t}if(y=Di(y.nextSibling),y===null){y=null;break t}}E=y.data,y=E==="F!"||E==="F"?y:null}if(y){Pt=Di(y.nextSibling),l=y.data==="F!";break e}}Yr(l)}l=!1}l&&(r=a[0])}}return a=Fn(),a.memoizedState=a.baseState=r,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_v,lastRenderedState:r},a.queue=l,a=Bv.bind(null,qe,l),l.dispatch=a,l=Bd(!1),E=Wd.bind(null,qe,!1,l.queue),l=Fn(),y={state:r,dispatch:null,action:n,pending:null},l.queue=y,a=IE.bind(null,qe,y,E,a),y.dispatch=a,l.memoizedState=n,[r,a,!1]}function bv(n){var r=un();return yv(r,Et,n)}function yv(n,r,a){if(r=jd(n,r,_v)[0],n=Bc(xr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var l=Ko(r)}catch(O){throw O===Ea?Tc:O}else l=r;r=un();var y=r.queue,E=y.dispatch;return a!==r.memoizedState&&(qe.flags|=2048,La(9,{destroy:void 0},BE.bind(null,y,a),null)),[l,E,n]}function BE(n,r){n.action=r}function Sv(n){var r=un(),a=Et;if(a!==null)return yv(r,a,n);un(),r=r.memoizedState,a=un();var l=a.queue.dispatch;return a.memoizedState=n,[r,l,!1]}function La(n,r,a,l){return n={tag:n,create:a,deps:l,inst:r,next:null},r=qe.updateQueue,r===null&&(r=jc(),qe.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 xv(){return un().memoizedState}function Pc(n,r,a,l){var y=Fn();qe.flags|=n,y.memoizedState=La(1|r,{destroy:void 0},a,l===void 0?null:l)}function zc(n,r,a,l){var y=un();l=l===void 0?null:l;var E=y.memoizedState.inst;Et!==null&&l!==null&&Rd(l,Et.memoizedState.deps)?y.memoizedState=La(r,E,a,l):(qe.flags|=n,y.memoizedState=La(1|r,E,a,l))}function wv(n,r){Pc(8390656,8,n,r)}function zd(n,r){zc(2048,8,n,r)}function PE(n){qe.flags|=4;var r=qe.updateQueue;if(r===null)r=jc(),qe.updateQueue=r,r.events=[n];else{var a=r.events;a===null?r.events=[n]:a.push(n)}}function Cv(n){var r=un().memoizedState;return PE({ref:r,nextImpl:n}),function(){if((vt&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function Ev(n,r){return zc(4,2,n,r)}function kv(n,r){return zc(4,4,n,r)}function Tv(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 Av(n,r,a){a=a!=null?a.concat([n]):null,zc(4,4,Tv.bind(null,r,n),a)}function Hd(){}function Rv(n,r){var a=un();r=r===void 0?null:r;var l=a.memoizedState;return r!==null&&Rd(r,l[1])?l[0]:(a.memoizedState=[n,r],n)}function Lv(n,r){var a=un();r=r===void 0?null:r;var l=a.memoizedState;if(r!==null&&Rd(r,l[1]))return l[0];if(l=n(),Fs){$e(!0);try{n()}finally{$e(!1)}}return a.memoizedState=[l,r],l}function $d(n,r,a){return a===void 0||(Sr&1073741824)!==0&&(rt&261930)===0?n.memoizedState=r:(n.memoizedState=a,n=M0(),qe.lanes|=n,rs|=n,a)}function Mv(n,r,a,l){return fi(a,r)?a:Ta.current!==null?(n=$d(n,a,l),fi(n,r)||(pn=!0),n):(Sr&42)===0||(Sr&1073741824)!==0&&(rt&261930)===0?(pn=!0,n.memoizedState=a):(n=M0(),qe.lanes|=n,rs|=n,r)}function Nv(n,r,a,l,y){var E=G.p;G.p=E!==0&&8>E?E:8;var O=P.T,$={};P.T=$,Wd(n,!1,r,a);try{var te=y(),ce=P.S;if(ce!==null&&ce($,te),te!==null&&typeof te=="object"&&typeof te.then=="function"){var fe=OE(te,l);Vo(n,r,fe,bi(n))}else Vo(n,r,l,bi(n))}catch(me){Vo(n,r,{then:function(){},status:"rejected",reason:me},bi())}finally{G.p=E,O!==null&&$.types!==null&&(O.types=$.types),P.T=O}}function zE(){}function Ud(n,r,a,l){if(n.tag!==5)throw Error(s(476));var y=Ov(n).queue;Nv(n,y,r,K,a===null?zE:function(){return Dv(n),a(l)})}function Ov(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:K},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:a},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Dv(n){var r=Ov(n);r.next===null&&(r=n.alternate.memoizedState),Vo(n,r.next.queue,{},bi())}function Fd(){return Nn(hl)}function jv(){return un().memoizedState}function Iv(){return un().memoizedState}function HE(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var a=bi();n=Jr(a);var l=Qr(r,n,a);l!==null&&(oi(l,r,a),Fo(l,r,a)),r={cache:vd()},n.payload=r;return}r=r.return}}function $E(n,r,a){var l=bi();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Hc(n)?Pv(r,a):(a=od(n,r,a,l),a!==null&&(oi(a,n,l),zv(a,r,l)))}function Bv(n,r,a){var l=bi();Vo(n,r,a,l)}function Vo(n,r,a,l){var y={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Hc(n))Pv(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=$,fi($,O))return yc(n,r,y,0),Mt===null&&bc(),!1}catch{}if(a=od(n,r,y,l),a!==null)return oi(a,n,l),zv(a,r,l),!0}return!1}function Wd(n,r,a,l){if(l={lane:2,revertLane:wf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hc(n)){if(r)throw Error(s(479))}else r=od(n,a,l,2),r!==null&&oi(r,n,2)}function Hc(n){var r=n.alternate;return n===qe||r!==null&&r===qe}function Pv(n,r){Aa=Oc=!0;var a=n.pending;a===null?r.next=r:(r.next=a.next,a.next=r),n.pending=r}function zv(n,r,a){if((a&4194048)!==0){var l=r.lanes;l&=n.pendingLanes,a|=l,r.lanes=a,Pe(n,a)}}var Yo={readContext:Nn,use:Ic,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useLayoutEffect:en,useInsertionEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useSyncExternalStore:en,useId:en,useHostTransitionStatus:en,useFormState:en,useActionState:en,useOptimistic:en,useMemoCache:en,useCacheRefresh:en};Yo.useEffectEvent=en;var Hv={readContext:Nn,use:Ic,useCallback:function(n,r){return Fn().memoizedState=[n,r===void 0?null:r],n},useContext:Nn,useEffect:wv,useImperativeHandle:function(n,r,a){a=a!=null?a.concat([n]):null,Pc(4194308,4,Tv.bind(null,r,n),a)},useLayoutEffect:function(n,r){return Pc(4194308,4,n,r)},useInsertionEffect:function(n,r){Pc(4,2,n,r)},useMemo:function(n,r){var a=Fn();r=r===void 0?null:r;var l=n();if(Fs){$e(!0);try{n()}finally{$e(!1)}}return a.memoizedState=[l,r],l},useReducer:function(n,r,a){var l=Fn();if(a!==void 0){var y=a(r);if(Fs){$e(!0);try{a(r)}finally{$e(!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=$E.bind(null,qe,n),[l.memoizedState,n]},useRef:function(n){var r=Fn();return n={current:n},r.memoizedState=n},useState:function(n){n=Bd(n);var r=n.queue,a=Bv.bind(null,qe,r);return r.dispatch=a,[n.memoizedState,a]},useDebugValue:Hd,useDeferredValue:function(n,r){var a=Fn();return $d(a,n,r)},useTransition:function(){var n=Bd(!1);return n=Nv.bind(null,qe,n.queue,!0,!1),Fn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,a){var l=qe,y=Fn();if(ot){if(a===void 0)throw Error(s(407));a=a()}else{if(a=r(),Mt===null)throw Error(s(349));(rt&127)!==0||ov(l,r,a)}y.memoizedState=a;var E={value:a,getSnapshot:r};return y.queue=E,wv(cv.bind(null,l,E,n),[n]),l.flags|=2048,La(9,{destroy:void 0},lv.bind(null,l,E,a,r),null),a},useId:function(){var n=Fn(),r=Mt.identifierPrefix;if(ot){var a=nr,l=tr;a=(l&~(1<<32-Je(l)-1)).toString(32)+a,r="_"+r+"R_"+a,a=Dc++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=DE++,r="_"+r+"r_"+a.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Fd,useFormState:vv,useActionState:vv,useOptimistic:function(n){var r=Fn();r.memoizedState=r.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Wd.bind(null,qe,!0,a),a.dispatch=r,[n,r]},useMemoCache:Dd,useCacheRefresh:function(){return Fn().memoizedState=HE.bind(null,qe)},useEffectEvent:function(n){var r=Fn(),a={impl:n};return r.memoizedState=a,function(){if((vt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Gd={readContext:Nn,use:Ic,useCallback:Rv,useContext:Nn,useEffect:zd,useImperativeHandle:Av,useInsertionEffect:Ev,useLayoutEffect:kv,useMemo:Lv,useReducer:Bc,useRef:xv,useState:function(){return Bc(xr)},useDebugValue:Hd,useDeferredValue:function(n,r){var a=un();return Mv(a,Et.memoizedState,n,r)},useTransition:function(){var n=Bc(xr)[0],r=un().memoizedState;return[typeof n=="boolean"?n:Ko(n),r]},useSyncExternalStore:av,useId:jv,useHostTransitionStatus:Fd,useFormState:bv,useActionState:bv,useOptimistic:function(n,r){var a=un();return dv(a,Et,n,r)},useMemoCache:Dd,useCacheRefresh:Iv};Gd.useEffectEvent=Cv;var $v={readContext:Nn,use:Ic,useCallback:Rv,useContext:Nn,useEffect:zd,useImperativeHandle:Av,useInsertionEffect:Ev,useLayoutEffect:kv,useMemo:Lv,useReducer:Id,useRef:xv,useState:function(){return Id(xr)},useDebugValue:Hd,useDeferredValue:function(n,r){var a=un();return Et===null?$d(a,n,r):Mv(a,Et.memoizedState,n,r)},useTransition:function(){var n=Id(xr)[0],r=un().memoizedState;return[typeof n=="boolean"?n:Ko(n),r]},useSyncExternalStore:av,useId:jv,useHostTransitionStatus:Fd,useFormState:Sv,useActionState:Sv,useOptimistic:function(n,r){var a=un();return Et!==null?dv(a,Et,n,r):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:Dd,useCacheRefresh:Iv};$v.useEffectEvent=Cv;function qd(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 Kd={enqueueSetState:function(n,r,a){n=n._reactInternals;var l=bi(),y=Jr(l);y.payload=r,a!=null&&(y.callback=a),r=Qr(n,y,l),r!==null&&(oi(r,n,l),Fo(r,n,l))},enqueueReplaceState:function(n,r,a){n=n._reactInternals;var l=bi(),y=Jr(l);y.tag=1,y.payload=r,a!=null&&(y.callback=a),r=Qr(n,y,l),r!==null&&(oi(r,n,l),Fo(r,n,l))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var a=bi(),l=Jr(a);l.tag=2,r!=null&&(l.callback=r),r=Qr(n,l,a),r!==null&&(oi(r,n,a),Fo(r,n,a))}};function Uv(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?!jo(a,l)||!jo(y,E):!0}function Fv(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&&Kd.enqueueReplaceState(r,r.state,null)}function Ws(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 Wv(n){vc(n)}function Gv(n){console.error(n)}function qv(n){vc(n)}function $c(n,r){try{var a=n.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(l){setTimeout(function(){throw l})}}function Kv(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 Vd(n,r,a){return a=Jr(a),a.tag=3,a.payload={element:null},a.callback=function(){$c(n,r)},a}function Vv(n){return n=Jr(n),n.tag=3,n}function Yv(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(){Kv(r,a,l)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){Kv(r,a,l),typeof y!="function"&&(ss===null?ss=new Set([this]):ss.add(this));var $=l.stack;this.componentDidCatch(l.value,{componentStack:$!==null?$:""})})}function UE(n,r,a,l,y){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(r=a.alternate,r!==null&&xa(r,a,y,!0),a=gi.current,a!==null){switch(a.tag){case 31:case 13:return Oi===null?Qc():a.alternate===null&&tn===0&&(tn=3),a.flags&=-257,a.flags|=65536,a.lanes=y,l===Ac?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([l]):r.add(l),yf(n,l,y)),!1;case 22:return a.flags|=65536,l===Ac?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)),yf(n,l,y)),!1}throw Error(s(435,a.tag))}return yf(n,l,y),Qc(),!1}if(ot)return r=gi.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=y,l!==fd&&(n=Error(s(422),{cause:l}),Po(Ri(n,a)))):(l!==fd&&(r=Error(s(423),{cause:l}),Po(Ri(r,a))),n=n.current.alternate,n.flags|=65536,y&=-y,n.lanes|=y,l=Ri(l,a),y=Vd(n.stateNode,l,y),Cd(n,y),tn!==4&&(tn=2)),!1;var E=Error(s(520),{cause:l});if(E=Ri(E,a),il===null?il=[E]:il.push(E),tn!==4&&(tn=2),r===null)return!0;l=Ri(l,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,n=y&-y,a.lanes|=n,n=Vd(a.stateNode,l,n),Cd(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"&&(ss===null||!ss.has(E))))return a.flags|=65536,y&=-y,a.lanes|=y,y=Vv(y),Yv(y,n,a,l),Cd(a,y),!1}a=a.return}while(a!==null);return!1}var Yd=Error(s(461)),pn=!1;function On(n,r,a,l){r.child=n===null?Q_(r,null,a,l):Us(r,n.child,a,l)}function Xv(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 Ps(r),l=Ld(n,r,a,O,E,y),$=Md(),n!==null&&!pn?(Nd(n,r,y),wr(n,r,y)):(ot&&$&&hd(r),r.flags|=1,On(n,r,l,y),r.child)}function Zv(n,r,a,l,y){if(n===null){var E=a.type;return typeof E=="function"&&!ld(E)&&E.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=E,Jv(n,r,E,l,y)):(n=xc(a.type,null,l,r,r.mode,y),n.ref=r.ref,n.return=r,r.child=n)}if(E=n.child,!rf(n,y)){var O=E.memoizedProps;if(a=a.compare,a=a!==null?a:jo,a(O,l)&&n.ref===r.ref)return wr(n,r,y)}return r.flags|=1,n=_r(E,l),n.ref=r.ref,n.return=r,r.child=n}function Jv(n,r,a,l,y){if(n!==null){var E=n.memoizedProps;if(jo(E,l)&&n.ref===r.ref)if(pn=!1,r.pendingProps=l=E,rf(n,y))(n.flags&131072)!==0&&(pn=!0);else return r.lanes=n.lanes,wr(n,r,y)}return Xd(n,r,a,l,y)}function Qv(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 e0(n,r,E,a,l)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&kc(r,E!==null?E.cachePool:null),E!==null?nv(r,E):kd(),iv(r);else return l=r.lanes=536870912,e0(n,r,E!==null?E.baseLanes|a:a,a,l)}else E!==null?(kc(r,E.cachePool),nv(r,E),ts(),r.memoizedState=null):(n!==null&&kc(r,null),kd(),ts());return On(n,r,y,a),r.child}function Xo(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function e0(n,r,a,l,y){var E=yd();return E=E===null?null:{parent:dn._currentValue,pool:E},r.memoizedState={baseLanes:a,cachePool:E},n!==null&&kc(r,null),kd(),iv(r),n!==null&&xa(n,r,l,!0),r.childLanes=y,null}function Uc(n,r){return r=Wc({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function t0(n,r,a){return Us(r,n.child,null,a),n=Uc(r,r.pendingProps),n.flags|=2,mi(r),r.memoizedState=null,n}function FE(n,r,a){var l=r.pendingProps,y=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ot){if(l.mode==="hidden")return n=Uc(r,l),r.lanes=536870912,Xo(null,n);if(Ad(r),(n=Pt)?(n=f1(n,Ni),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Kr!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=P_(n),a.return=r,r.child=a,Mn=r,Pt=null)):n=null,n===null)throw Yr(r);return r.lanes=536870912,null}return Uc(r,l)}var E=n.memoizedState;if(E!==null){var O=E.dehydrated;if(Ad(r),y)if(r.flags&256)r.flags&=-257,r=t0(n,r,a);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(s(558));else if(pn||xa(n,r,a,!1),y=(a&n.childLanes)!==0,pn||y){if(l=Mt,l!==null&&(O=Vt(l,a),O!==0&&O!==E.retryLane))throw E.retryLane=O,Ds(n,O),oi(l,n,O),Yd;Qc(),r=t0(n,r,a)}else n=E.treeContext,Pt=Di(O.nextSibling),Mn=r,ot=!0,Vr=null,Ni=!1,n!==null&&$_(r,n),r=Uc(r,l),r.flags|=4096;return r}return n=_r(n.child,{mode:l.mode,children:l.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Fc(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 Xd(n,r,a,l,y){return Ps(r),a=Ld(n,r,a,l,void 0,y),l=Md(),n!==null&&!pn?(Nd(n,r,y),wr(n,r,y)):(ot&&l&&hd(r),r.flags|=1,On(n,r,a,y),r.child)}function n0(n,r,a,l,y,E){return Ps(r),r.updateQueue=null,a=sv(r,l,a,y),rv(n),l=Md(),n!==null&&!pn?(Nd(n,r,E),wr(n,r,E)):(ot&&l&&hd(r),r.flags|=1,On(n,r,a,E),r.child)}function i0(n,r,a,l,y){if(Ps(r),r.stateNode===null){var E=va,O=a.contextType;typeof O=="object"&&O!==null&&(E=Nn(O)),E=new a(l,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Kd,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=l,E.state=r.memoizedState,E.refs={},xd(r),O=a.contextType,E.context=typeof O=="object"&&O!==null?Nn(O):va,E.state=r.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(qd(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&&Kd.enqueueReplaceState(E,E.state,null),Go(r,l,E,y),Wo(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),l=!0}else if(n===null){E=r.stateNode;var $=r.memoizedProps,te=Ws(a,$);E.props=te;var ce=E.context,fe=a.contextType;O=va,typeof fe=="object"&&fe!==null&&(O=Nn(fe));var me=a.getDerivedStateFromProps;fe=typeof me=="function"||typeof E.getSnapshotBeforeUpdate=="function",$=r.pendingProps!==$,fe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||($||ce!==O)&&Fv(r,E,l,O),Zr=!1;var ue=r.memoizedState;E.state=ue,Go(r,l,E,y),Wo(),ce=r.memoizedState,$||ue!==ce||Zr?(typeof me=="function"&&(qd(r,a,me,l),ce=r.memoizedState),(te=Zr||Uv(r,a,te,l,ue,ce,O))?(fe||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,wd(n,r),O=r.memoizedProps,fe=Ws(a,O),E.props=fe,me=r.pendingProps,ue=E.context,ce=a.contextType,te=va,typeof ce=="object"&&ce!==null&&(te=Nn(ce)),$=a.getDerivedStateFromProps,(ce=typeof $=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==me||ue!==te)&&Fv(r,E,l,te),Zr=!1,ue=r.memoizedState,E.state=ue,Go(r,l,E,y),Wo();var he=r.memoizedState;O!==me||ue!==he||Zr||n!==null&&n.dependencies!==null&&Cc(n.dependencies)?(typeof $=="function"&&(qd(r,a,$,l),he=r.memoizedState),(fe=Zr||Uv(r,a,fe,l,ue,he,te)||n!==null&&n.dependencies!==null&&Cc(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=fe):(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,Fc(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=Us(r,n.child,null,y),r.child=Us(r,null,a,y)):On(n,r,a,y),r.memoizedState=E.state,n=r.child):n=wr(n,r,y),n}function r0(n,r,a,l){return Is(),r.flags|=256,On(n,r,a,l),r.child}var Zd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Jd(n){return{baseLanes:n,cachePool:K_()}}function Qd(n,r,a){return n=n!==null?n.childLanes&~a:0,r&&(n|=vi),n}function s0(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:(cn.current&2)!==0),O&&(y=!0,r.flags&=-129),O=(r.flags&32)!==0,r.flags&=-33,n===null){if(ot){if(y?es(r):ts(),(n=Pt)?(n=f1(n,Ni),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Kr!==null?{id:tr,overflow:nr}:null,retryLane:536870912,hydrationErrors:null},a=P_(n),a.return=r,r.child=a,Mn=r,Pt=null)):n=null,n===null)throw Yr(r);return If(n)?r.lanes=32:r.lanes=536870912,null}var $=l.children;return l=l.fallback,y?(ts(),y=r.mode,$=Wc({mode:"hidden",children:$},y),l=js(l,y,a,null),$.return=r,l.return=r,$.sibling=l,r.child=$,l=r.child,l.memoizedState=Jd(a),l.childLanes=Qd(n,O,a),r.memoizedState=Zd,Xo(null,l)):(es(r),ef(r,$))}var te=n.memoizedState;if(te!==null&&($=te.dehydrated,$!==null)){if(E)r.flags&256?(es(r),r.flags&=-257,r=tf(n,r,a)):r.memoizedState!==null?(ts(),r.child=n.child,r.flags|=128,r=null):(ts(),$=l.fallback,y=r.mode,l=Wc({mode:"visible",children:l.children},y),$=js($,y,a,null),$.flags|=2,l.return=r,$.return=r,l.sibling=$,r.child=l,Us(r,n.child,null,a),l=r.child,l.memoizedState=Jd(a),l.childLanes=Qd(n,O,a),r.memoizedState=Zd,r=Xo(null,l));else if(es(r),If($)){if(O=$.nextSibling&&$.nextSibling.dataset,O)var ce=O.dgst;O=ce,l=Error(s(419)),l.stack="",l.digest=O,Po({value:l,source:null,stack:null}),r=tf(n,r,a)}else if(pn||xa(n,r,a,!1),O=(a&n.childLanes)!==0,pn||O){if(O=Mt,O!==null&&(l=Vt(O,a),l!==0&&l!==te.retryLane))throw te.retryLane=l,Ds(n,l),oi(O,n,l),Yd;jf($)||Qc(),r=tf(n,r,a)}else jf($)?(r.flags|=192,r.child=n.child,r=null):(n=te.treeContext,Pt=Di($.nextSibling),Mn=r,ot=!0,Vr=null,Ni=!1,n!==null&&$_(r,n),r=ef(r,l.children),r.flags|=4096);return r}return y?(ts(),$=l.fallback,y=r.mode,te=n.child,ce=te.sibling,l=_r(te,{mode:"hidden",children:l.children}),l.subtreeFlags=te.subtreeFlags&65011712,ce!==null?$=_r(ce,$):($=js($,y,a,null),$.flags|=2),$.return=r,l.return=r,l.sibling=$,r.child=l,Xo(null,l),l=r.child,$=n.child.memoizedState,$===null?$=Jd(a):(y=$.cachePool,y!==null?(te=dn._currentValue,y=y.parent!==te?{parent:te,pool:te}:y):y=K_(),$={baseLanes:$.baseLanes|a,cachePool:y}),l.memoizedState=$,l.childLanes=Qd(n,O,a),r.memoizedState=Zd,Xo(n.child,l)):(es(r),a=n.child,n=a.sibling,a=_r(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 ef(n,r){return r=Wc({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Wc(n,r){return n=pi(22,n,null,r),n.lanes=0,n}function tf(n,r,a){return Us(r,n.child,null,a),n=ef(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function a0(n,r,a){n.lanes|=r;var l=n.alternate;l!==null&&(l.lanes|=r),md(n.return,r,a)}function nf(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 o0(n,r,a){var l=r.pendingProps,y=l.revealOrder,E=l.tail;l=l.children;var O=cn.current,$=(O&2)!==0;if($?(O=O&1|2,r.flags|=128):O&=1,J(cn,O),On(n,r,l,a),l=ot?Bo:0,!$&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&a0(n,a,r);else if(n.tag===19)a0(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&&Nc(n)===null&&(y=a),a=a.sibling;a=y,a===null?(y=r.child,r.child=null):(y=a.sibling,a.sibling=null),nf(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&&Nc(n)===null){r.child=y;break}n=y.sibling,y.sibling=a,a=y,y=n}nf(r,!0,a,null,E,l);break;case"together":nf(r,!1,null,null,void 0,l);break;default:r.memoizedState=null}return r.child}function wr(n,r,a){if(n!==null&&(r.dependencies=n.dependencies),rs|=r.lanes,(a&r.childLanes)===0)if(n!==null){if(xa(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=_r(n,n.pendingProps),r.child=a,a.return=r;n.sibling!==null;)n=n.sibling,a=a.sibling=_r(n,n.pendingProps),a.return=r;a.sibling=null}return r.child}function rf(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Cc(n)))}function WE(n,r,a){switch(r.tag){case 3:H(r,r.stateNode.containerInfo),Xr(r,dn,n.memoizedState.cache),Is();break;case 27:case 5:de(r);break;case 4:H(r,r.stateNode.containerInfo);break;case 10:Xr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Ad(r),null;break;case 13:var l=r.memoizedState;if(l!==null)return l.dehydrated!==null?(es(r),r.flags|=128,null):(a&r.child.childLanes)!==0?s0(n,r,a):(es(r),n=wr(n,r,a),n!==null?n.sibling:null);es(r);break;case 19:var y=(n.flags&128)!==0;if(l=(a&r.childLanes)!==0,l||(xa(n,r,a,!1),l=(a&r.childLanes)!==0),y){if(l)return o0(n,r,a);r.flags|=128}if(y=r.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),J(cn,cn.current),l)break;return null;case 22:return r.lanes=0,Qv(n,r,a,r.pendingProps);case 24:Xr(r,dn,n.memoizedState.cache)}return wr(n,r,a)}function l0(n,r,a){if(n!==null)if(n.memoizedProps!==r.pendingProps)pn=!0;else{if(!rf(n,a)&&(r.flags&128)===0)return pn=!1,WE(n,r,a);pn=(n.flags&131072)!==0}else pn=!1,ot&&(r.flags&1048576)!==0&&H_(r,Bo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var l=r.pendingProps;if(n=Hs(r.elementType),r.type=n,typeof n=="function")ld(n)?(l=Ws(n,l),r.tag=1,r=i0(null,r,n,l,a)):(r.tag=0,r=Xd(null,r,n,l,a));else{if(n!=null){var y=n.$$typeof;if(y===k){r.tag=11,r=Xv(null,r,n,l,a);break e}else if(y===N){r.tag=14,r=Zv(null,r,n,l,a);break e}}throw r=X(n)||n,Error(s(306,r,""))}}return r;case 0:return Xd(n,r,r.type,r.pendingProps,a);case 1:return l=r.type,y=Ws(l,r.pendingProps),i0(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,wd(n,r),Go(r,l,null,a);var O=r.memoizedState;if(l=O.cache,Xr(r,dn,l),l!==E.cache&&_d(r,[dn],a,!0),Wo(),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=r0(n,r,l,a);break e}else if(l!==y){y=Ri(Error(s(424)),r),Po(y),r=r0(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,Pt=Di(n.firstChild),Mn=r,ot=!0,Vr=null,Ni=!0,a=Q_(r,null,l,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Is(),l===y){r=wr(n,r,a);break e}On(n,r,l,a)}r=r.child}return r;case 26:return Fc(n,r),n===null?(a=b1(r.type,null,r.pendingProps,null))?r.memoizedState=a:ot||(a=r.type,n=r.pendingProps,l=au(re.current).createElement(a),l[It]=r,l[Nt]=n,Dn(l,a,n),Qe(l),r.stateNode=l):r.memoizedState=b1(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return de(r),n===null&&ot&&(l=r.stateNode=m1(r.type,r.pendingProps,re.current),Mn=r,Ni=!0,y=Pt,cs(r.type)?(Bf=y,Pt=Di(l.firstChild)):Pt=y),On(n,r,r.pendingProps.children,a),Fc(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ot&&((y=l=Pt)&&(l=y5(l,r.type,r.pendingProps,Ni),l!==null?(r.stateNode=l,Mn=r,Pt=Di(l.firstChild),Ni=!1,y=!0):y=!1),y||Yr(r)),de(r),y=r.type,E=r.pendingProps,O=n!==null?n.memoizedProps:null,l=E.children,Nf(y,E)?l=null:O!==null&&Nf(y,O)&&(r.flags|=32),r.memoizedState!==null&&(y=Ld(n,r,jE,null,null,a),hl._currentValue=y),Fc(n,r),On(n,r,l,a),r.child;case 6:return n===null&&ot&&((n=a=Pt)&&(a=S5(a,r.pendingProps,Ni),a!==null?(r.stateNode=a,Mn=r,Pt=null,n=!0):n=!1),n||Yr(r)),null;case 13:return s0(n,r,a);case 4:return H(r,r.stateNode.containerInfo),l=r.pendingProps,n===null?r.child=Us(r,null,l,a):On(n,r,l,a),r.child;case 11:return Xv(n,r,r.type,r.pendingProps,a);case 7:return On(n,r,r.pendingProps,a),r.child;case 8:return On(n,r,r.pendingProps.children,a),r.child;case 12:return On(n,r,r.pendingProps.children,a),r.child;case 10:return l=r.pendingProps,Xr(r,r.type,l.value),On(n,r,l.children,a),r.child;case 9:return y=r.type._context,l=r.pendingProps.children,Ps(r),y=Nn(y),l=l(y),r.flags|=1,On(n,r,l,a),r.child;case 14:return Zv(n,r,r.type,r.pendingProps,a);case 15:return Jv(n,r,r.type,r.pendingProps,a);case 19:return o0(n,r,a);case 31:return FE(n,r,a);case 22:return Qv(n,r,a,r.pendingProps);case 24:return Ps(r),l=Nn(dn),n===null?(y=yd(),y===null&&(y=Mt,E=vd(),y.pooledCache=E,E.refCount++,E!==null&&(y.pooledCacheLanes|=a),y=E),r.memoizedState={parent:l,cache:y},xd(r),Xr(r,dn,y)):((n.lanes&a)!==0&&(wd(n,r),Go(r,null,null,a),Wo()),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),Xr(r,dn,l)):(l=E.cache,Xr(r,dn,l),l!==y.cache&&_d(r,[dn],a,!0))),On(n,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Cr(n){n.flags|=4}function sf(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(j0())n.flags|=8192;else throw $s=Ac,Sd}else n.flags&=-16777217}function c0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!C1(r))if(j0())n.flags|=8192;else throw $s=Ac,Sd}function Gc(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?je():536870912,n.lanes|=r,Da|=r)}function Zo(n,r){if(!ot)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 zt(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 GE(n,r,a){var l=r.pendingProps;switch(dd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(r),null;case 1:return zt(r),null;case 3:return a=r.stateNode,l=null,n!==null&&(l=n.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),yr(dn),se(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(Sa(r)?Cr(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,pd())),zt(r),null;case 26:var y=r.type,E=r.memoizedState;return n===null?(Cr(r),E!==null?(zt(r),c0(r,E)):(zt(r),sf(r,y,null,l,a))):E?E!==n.memoizedState?(Cr(r),zt(r),c0(r,E)):(zt(r),r.flags&=-16777217):(n=n.memoizedProps,n!==l&&Cr(r),zt(r),sf(r,y,n,l,a)),null;case 27:if(xe(r),a=re.current,y=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==l&&Cr(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return zt(r),null}n=ne.current,Sa(r)?U_(r):(n=m1(y,l,a),r.stateNode=n,Cr(r))}return zt(r),null;case 5:if(xe(r),y=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==l&&Cr(r);else{if(!l){if(r.stateNode===null)throw Error(s(166));return zt(r),null}if(E=ne.current,Sa(r))U_(r);else{var O=au(re.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[It]=r,E[Nt]=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(Dn(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&&Cr(r)}}return zt(r),sf(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,a),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==l&&Cr(r);else{if(typeof l!="string"&&r.stateNode===null)throw Error(s(166));if(n=re.current,Sa(r)){if(n=r.stateNode,a=r.memoizedProps,l=null,y=Mn,y!==null)switch(y.tag){case 27:case 5:l=y.memoizedProps}n[It]=r,n=!!(n.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||s1(n.nodeValue,a)),n||Yr(r,!0)}else n=au(n).createTextNode(l),n[It]=r,r.stateNode=n}return zt(r),null;case 31:if(a=r.memoizedState,n===null||n.memoizedState!==null){if(l=Sa(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[It]=r}else Is(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;zt(r),n=!1}else a=pd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return r.flags&256?(mi(r),r):(mi(r),null);if((r.flags&128)!==0)throw Error(s(558))}return zt(r),null;case 13:if(l=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(y=Sa(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[It]=r}else Is(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;zt(r),y=!1}else y=pd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=y),y=!0;if(!y)return r.flags&256?(mi(r),r):(mi(r),null)}return mi(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),Gc(r,r.updateQueue),zt(r),null);case 4:return se(),n===null&&Tf(r.stateNode.containerInfo),zt(r),null;case 10:return yr(r.type),zt(r),null;case 19:if(F(cn),l=r.memoizedState,l===null)return zt(r),null;if(y=(r.flags&128)!==0,E=l.rendering,E===null)if(y)Zo(l,!1);else{if(tn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(E=Nc(n),E!==null){for(r.flags|=128,Zo(l,!1),n=E.updateQueue,r.updateQueue=n,Gc(r,n),r.subtreeFlags=0,n=a,a=r.child;a!==null;)B_(a,n),a=a.sibling;return J(cn,cn.current&1|2),ot&&vr(r,l.treeForkCount),r.child}n=n.sibling}l.tail!==null&&ct()>Xc&&(r.flags|=128,y=!0,Zo(l,!1),r.lanes=4194304)}else{if(!y)if(n=Nc(E),n!==null){if(r.flags|=128,y=!0,n=n.updateQueue,r.updateQueue=n,Gc(r,n),Zo(l,!0),l.tail===null&&l.tailMode==="hidden"&&!E.alternate&&!ot)return zt(r),null}else 2*ct()-l.renderingStartTime>Xc&&a!==536870912&&(r.flags|=128,y=!0,Zo(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=ct(),n.sibling=null,a=cn.current,J(cn,y?a&1|2:a&1),ot&&vr(r,l.treeForkCount),n):(zt(r),null);case 22:case 23:return mi(r),Td(),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&&(zt(r),r.subtreeFlags&6&&(r.flags|=8192)):zt(r),a=r.updateQueue,a!==null&&Gc(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&&F(zs),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),yr(dn),zt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function qE(n,r){switch(dd(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return yr(dn),se(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return xe(r),null;case 31:if(r.memoizedState!==null){if(mi(r),r.alternate===null)throw Error(s(340));Is()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(mi(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Is()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return F(cn),null;case 4:return se(),null;case 10:return yr(r.type),null;case 22:case 23:return mi(r),Td(),n!==null&&F(zs),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return yr(dn),null;case 25:return null;default:return null}}function u0(n,r){switch(dd(r),r.tag){case 3:yr(dn),se();break;case 26:case 27:case 5:xe(r);break;case 4:se();break;case 31:r.memoizedState!==null&&mi(r);break;case 13:mi(r);break;case 19:F(cn);break;case 10:yr(r.type);break;case 22:case 23:mi(r),Td(),n!==null&&F(zs);break;case 24:yr(dn)}}function Jo(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($){xt(r,r.return,$)}}function ns(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(fe){xt(y,te,fe)}}}l=l.next}while(l!==E)}}catch(fe){xt(r,r.return,fe)}}function h0(n){var r=n.updateQueue;if(r!==null){var a=n.stateNode;try{tv(r,a)}catch(l){xt(n,n.return,l)}}}function d0(n,r,a){a.props=Ws(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(l){xt(n,r,l)}}function Qo(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){xt(n,r,y)}}function ir(n,r){var a=n.ref,l=n.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(y){xt(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){xt(n,r,y)}else a.current=null}function f0(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){xt(n,n.return,y)}}function af(n,r,a){try{var l=n.stateNode;p5(l,n.type,a,r),l[Nt]=r}catch(y){xt(n,n.return,y)}}function p0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&cs(n.type)||n.tag===4}function of(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||p0(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&&cs(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 lf(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&&cs(n.type)&&(a=n.stateNode,r=null),n=n.child,n!==null))for(lf(n,r,a),n=n.sibling;n!==null;)lf(n,r,a),n=n.sibling}function qc(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&&cs(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(qc(n,r,a),n=n.sibling;n!==null;)qc(n,r,a),n=n.sibling}function g0(n){var r=n.stateNode,a=n.memoizedProps;try{for(var l=n.type,y=r.attributes;y.length;)r.removeAttributeNode(y[0]);Dn(r,l,a),r[It]=n,r[Nt]=a}catch(E){xt(n,n.return,E)}}var Er=!1,gn=!1,cf=!1,m0=typeof WeakSet=="function"?WeakSet:Set,Sn=null;function KE(n,r){if(n=n.containerInfo,Lf=fu,n=A_(n),td(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,fe=0,me=n,ue=null;t:for(;;){for(var he;me!==a||y!==0&&me.nodeType!==3||($=O+y),me!==E||l!==0&&me.nodeType!==3||(te=O+l),me.nodeType===3&&(O+=me.nodeValue.length),(he=me.firstChild)!==null;)ue=me,me=he;for(;;){if(me===n)break t;if(ue===a&&++ce===y&&($=O),ue===E&&++fe===l&&(te=O),(he=me.nextSibling)!==null)break;me=ue,ue=me.parentNode}me=he}a=$===-1||te===-1?null:{start:$,end:te}}else a=null}a=a||{start:0,end:0}}else a=null;for(Mf={focusedElem:n,selectionRange:a},fu=!1,Sn=r;Sn!==null;)if(r=Sn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Sn=n;else for(;Sn!==null;){switch(r=Sn,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 Te=Ws(a.type,y);n=l.getSnapshotBeforeUpdate(Te,E),l.__reactInternalSnapshotBeforeUpdate=n}catch(He){xt(a,a.return,He)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,a=n.nodeType,a===9)Df(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Df(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,Sn=n;break}Sn=r.return}}function _0(n,r,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Tr(n,a),l&4&&Jo(5,a);break;case 1:if(Tr(n,a),l&4)if(n=a.stateNode,r===null)try{n.componentDidMount()}catch(O){xt(a,a.return,O)}else{var y=Ws(a.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(y,r,n.__reactInternalSnapshotBeforeUpdate)}catch(O){xt(a,a.return,O)}}l&64&&h0(a),l&512&&Qo(a,a.return);break;case 3:if(Tr(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{tv(n,r)}catch(O){xt(a,a.return,O)}}break;case 27:r===null&&l&4&&g0(a);case 26:case 5:Tr(n,a),r===null&&l&4&&f0(a),l&512&&Qo(a,a.return);break;case 12:Tr(n,a);break;case 31:Tr(n,a),l&4&&y0(n,a);break;case 13:Tr(n,a),l&4&&S0(n,a),l&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=n5.bind(null,a),x5(n,a))));break;case 22:if(l=a.memoizedState!==null||Er,!l){r=r!==null&&r.memoizedState!==null||gn,y=Er;var E=gn;Er=l,(gn=r)&&!E?Ar(n,a,(a.subtreeFlags&8772)!==0):Tr(n,a),Er=y,gn=E}break;case 30:break;default:Tr(n,a)}}function v0(n){var r=n.alternate;r!==null&&(n.alternate=null,v0(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&De(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 Gt=null,ii=!1;function kr(n,r,a){for(a=a.child;a!==null;)b0(n,r,a),a=a.sibling}function b0(n,r,a){if(ve&&typeof ve.onCommitFiberUnmount=="function")try{ve.onCommitFiberUnmount(Tn,a)}catch{}switch(a.tag){case 26:gn||ir(a,r),kr(n,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:gn||ir(a,r);var l=Gt,y=ii;cs(a.type)&&(Gt=a.stateNode,ii=!1),kr(n,r,a),ll(a.stateNode),Gt=l,ii=y;break;case 5:gn||ir(a,r);case 6:if(l=Gt,y=ii,Gt=null,kr(n,r,a),Gt=l,ii=y,Gt!==null)if(ii)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(a.stateNode)}catch(E){xt(a,r,E)}else try{Gt.removeChild(a.stateNode)}catch(E){xt(a,r,E)}break;case 18:Gt!==null&&(ii?(n=Gt,h1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),Ua(n)):h1(Gt,a.stateNode));break;case 4:l=Gt,y=ii,Gt=a.stateNode.containerInfo,ii=!0,kr(n,r,a),Gt=l,ii=y;break;case 0:case 11:case 14:case 15:ns(2,a,r),gn||ns(4,a,r),kr(n,r,a);break;case 1:gn||(ir(a,r),l=a.stateNode,typeof l.componentWillUnmount=="function"&&d0(a,r,l)),kr(n,r,a);break;case 21:kr(n,r,a);break;case 22:gn=(l=gn)||a.memoizedState!==null,kr(n,r,a),gn=l;break;default:kr(n,r,a)}}function y0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ua(n)}catch(a){xt(r,r.return,a)}}}function S0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ua(n)}catch(a){xt(r,r.return,a)}}function VE(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new m0),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new m0),r;default:throw Error(s(435,n.tag))}}function Kc(n,r){var a=VE(n);r.forEach(function(l){if(!a.has(l)){a.add(l);var y=i5.bind(null,n,l);l.then(y,y)}})}function ri(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(cs($.type)){Gt=$.stateNode,ii=!1;break e}break;case 5:Gt=$.stateNode,ii=!1;break e;case 3:case 4:Gt=$.stateNode.containerInfo,ii=!0;break e}$=$.return}if(Gt===null)throw Error(s(160));b0(E,O,y),Gt=null,ii=!1,E=y.alternate,E!==null&&(E.return=null),y.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)x0(r,n),r=r.sibling}var Gi=null;function x0(n,r){var a=n.alternate,l=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ri(r,n),si(n),l&4&&(ns(3,n,n.return),Jo(3,n),ns(5,n,n.return));break;case 1:ri(r,n),si(n),l&512&&(gn||a===null||ir(a,a.return)),l&64&&Er&&(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=Gi;if(ri(r,n),si(n),l&512&&(gn||a===null||ir(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[er]||E[It]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=y.createElement(l),y.head.insertBefore(E,y.querySelector("head > title"))),Dn(E,l,a),E[It]=n,Qe(E),l=E;break e;case"link":var O=x1("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),Dn(E,l,a),y.head.appendChild(E);break;case"meta":if(O=x1("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),Dn(E,l,a),y.head.appendChild(E);break;default:throw Error(s(468,l))}E[It]=n,Qe(E),l=E}n.stateNode=l}else w1(y,n.type,n.stateNode);else n.stateNode=S1(y,l,n.memoizedProps);else E!==l?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,l===null?w1(y,n.type,n.stateNode):S1(y,l,n.memoizedProps)):l===null&&n.stateNode!==null&&af(n,n.memoizedProps,a.memoizedProps)}break;case 27:ri(r,n),si(n),l&512&&(gn||a===null||ir(a,a.return)),a!==null&&l&4&&af(n,n.memoizedProps,a.memoizedProps);break;case 5:if(ri(r,n),si(n),l&512&&(gn||a===null||ir(a,a.return)),n.flags&32){y=n.stateNode;try{Ue(y,"")}catch(Te){xt(n,n.return,Te)}}l&4&&n.stateNode!=null&&(y=n.memoizedProps,af(n,y,a!==null?a.memoizedProps:y)),l&1024&&(cf=!0);break;case 6:if(ri(r,n),si(n),l&4){if(n.stateNode===null)throw Error(s(162));l=n.memoizedProps,a=n.stateNode;try{a.nodeValue=l}catch(Te){xt(n,n.return,Te)}}break;case 3:if(cu=null,y=Gi,Gi=ou(r.containerInfo),ri(r,n),Gi=y,si(n),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ua(r.containerInfo)}catch(Te){xt(n,n.return,Te)}cf&&(cf=!1,w0(n));break;case 4:l=Gi,Gi=ou(n.stateNode.containerInfo),ri(r,n),si(n),Gi=l;break;case 12:ri(r,n),si(n);break;case 31:ri(r,n),si(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Kc(n,l)));break;case 13:ri(r,n),si(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Yc=ct()),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Kc(n,l)));break;case 22:y=n.memoizedState!==null;var te=a!==null&&a.memoizedState!==null,ce=Er,fe=gn;if(Er=ce||y,gn=fe||te,ri(r,n),gn=fe,Er=ce,si(n),l&8192)e:for(r=n.stateNode,r._visibility=y?r._visibility&-2:r._visibility|1,y&&(a===null||te||Er||gn||Gs(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 me=te.memoizedProps.style,ue=me!=null&&me.hasOwnProperty("display")?me.display:null;$.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(Te){xt(te,te.return,Te)}}}else if(r.tag===6){if(a===null){te=r;try{te.stateNode.nodeValue=y?"":te.memoizedProps}catch(Te){xt(te,te.return,Te)}}}else if(r.tag===18){if(a===null){te=r;try{var he=te.stateNode;y?d1(he,!0):d1(te.stateNode,!1)}catch(Te){xt(te,te.return,Te)}}}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,Kc(n,a))));break;case 19:ri(r,n),si(n),l&4&&(l=n.updateQueue,l!==null&&(n.updateQueue=null,Kc(n,l)));break;case 30:break;case 21:break;default:ri(r,n),si(n)}}function si(n){var r=n.flags;if(r&2){try{for(var a,l=n.return;l!==null;){if(p0(l)){a=l;break}l=l.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var y=a.stateNode,E=of(n);qc(n,E,y);break;case 5:var O=a.stateNode;a.flags&32&&(Ue(O,""),a.flags&=-33);var $=of(n);qc(n,$,O);break;case 3:case 4:var te=a.stateNode.containerInfo,ce=of(n);lf(n,ce,te);break;default:throw Error(s(161))}}catch(fe){xt(n,n.return,fe)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function w0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;w0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function Tr(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)_0(n,r.alternate,r),r=r.sibling}function Gs(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:ns(4,r,r.return),Gs(r);break;case 1:ir(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&d0(r,r.return,a),Gs(r);break;case 27:ll(r.stateNode);case 26:case 5:ir(r,r.return),Gs(r);break;case 22:r.memoizedState===null&&Gs(r);break;case 30:Gs(r);break;default:Gs(r)}n=n.sibling}}function Ar(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:Ar(y,E,a),Jo(4,E);break;case 1:if(Ar(y,E,a),l=E,y=l.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ce){xt(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++)ev(te[y],$)}catch(ce){xt(l,l.return,ce)}}a&&O&64&&h0(E),Qo(E,E.return);break;case 27:g0(E);case 26:case 5:Ar(y,E,a),a&&l===null&&O&4&&f0(E),Qo(E,E.return);break;case 12:Ar(y,E,a);break;case 31:Ar(y,E,a),a&&O&4&&y0(y,E);break;case 13:Ar(y,E,a),a&&O&4&&S0(y,E);break;case 22:E.memoizedState===null&&Ar(y,E,a),Qo(E,E.return);break;case 30:break;default:Ar(y,E,a)}r=r.sibling}}function uf(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&&zo(a))}function hf(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&zo(n))}function qi(n,r,a,l){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)C0(n,r,a,l),r=r.sibling}function C0(n,r,a,l){var y=r.flags;switch(r.tag){case 0:case 11:case 15:qi(n,r,a,l),y&2048&&Jo(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&&zo(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){xt(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):el(n,r):E._visibility&2?qi(n,r,a,l):(E._visibility|=2,Ma(n,r,a,l,(r.subtreeFlags&10256)!==0||!1)),y&2048&&uf(O,r);break;case 24:qi(n,r,a,l),y&2048&&hf(r.alternate,r);break;default:qi(n,r,a,l)}}function Ma(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:Ma(E,O,$,te,y),Jo(8,O);break;case 23:break;case 22:var fe=O.stateNode;O.memoizedState!==null?fe._visibility&2?Ma(E,O,$,te,y):el(E,O):(fe._visibility|=2,Ma(E,O,$,te,y)),y&&ce&2048&&uf(O.alternate,O);break;case 24:Ma(E,O,$,te,y),y&&ce&2048&&hf(O.alternate,O);break;default:Ma(E,O,$,te,y)}r=r.sibling}}function el(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:el(a,l),y&2048&&uf(l.alternate,l);break;case 24:el(a,l),y&2048&&hf(l.alternate,l);break;default:el(a,l)}r=r.sibling}}var tl=8192;function Na(n,r,a){if(n.subtreeFlags&tl)for(n=n.child;n!==null;)E0(n,r,a),n=n.sibling}function E0(n,r,a){switch(n.tag){case 26:Na(n,r,a),n.flags&tl&&n.memoizedState!==null&&D5(a,Gi,n.memoizedState,n.memoizedProps);break;case 5:Na(n,r,a);break;case 3:case 4:var l=Gi;Gi=ou(n.stateNode.containerInfo),Na(n,r,a),Gi=l;break;case 22:n.memoizedState===null&&(l=n.alternate,l!==null&&l.memoizedState!==null?(l=tl,tl=16777216,Na(n,r,a),tl=l):Na(n,r,a));break;default:Na(n,r,a)}}function k0(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 nl(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];Sn=l,A0(l,n)}k0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)T0(n),n=n.sibling}function T0(n){switch(n.tag){case 0:case 11:case 15:nl(n),n.flags&2048&&ns(9,n,n.return);break;case 3:nl(n);break;case 12:nl(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,Vc(n)):nl(n);break;default:nl(n)}}function Vc(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];Sn=l,A0(l,n)}k0(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:ns(8,r,r.return),Vc(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Vc(r));break;default:Vc(r)}n=n.sibling}}function A0(n,r){for(;Sn!==null;){var a=Sn;switch(a.tag){case 0:case 11:case 15:ns(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:zo(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Sn=l;else e:for(a=n;Sn!==null;){l=Sn;var y=l.sibling,E=l.return;if(v0(l),l===a){Sn=null;break e}if(y!==null){y.return=E,Sn=y;break e}Sn=E}}}var YE={getCacheForType:function(n){var r=Nn(dn),a=r.data.get(n);return a===void 0&&(a=n(),r.data.set(n,a)),a},cacheSignal:function(){return Nn(dn).controller.signal}},XE=typeof WeakMap=="function"?WeakMap:Map,vt=0,Mt=null,et=null,rt=0,St=0,_i=null,is=!1,Oa=!1,df=!1,Rr=0,tn=0,rs=0,qs=0,ff=0,vi=0,Da=0,il=null,ai=null,pf=!1,Yc=0,R0=0,Xc=1/0,Zc=null,ss=null,yn=0,as=null,ja=null,Lr=0,gf=0,mf=null,L0=null,rl=0,_f=null;function bi(){return(vt&2)!==0&&rt!==0?rt&-rt:P.T!==null?wf():dr()}function M0(){if(vi===0)if((rt&536870912)===0||ot){var n=An;An<<=1,(An&3932160)===0&&(An=262144),vi=n}else vi=536870912;return n=gi.current,n!==null&&(n.flags|=32),vi}function oi(n,r,a){(n===Mt&&(St===2||St===9)||n.cancelPendingCommit!==null)&&(Ia(n,0),os(n,rt,vi,!1)),ut(n,a),((vt&2)===0||n!==Mt)&&(n===Mt&&((vt&2)===0&&(qs|=a),tn===4&&os(n,rt,vi,!1)),rr(n))}function N0(n,r,a){if((vt&6)!==0)throw Error(s(327));var l=!a&&(r&127)===0&&(r&n.expiredLanes)===0||pe(n,r),y=l?QE(n,r):bf(n,r,!0),E=l;do{if(y===0){Oa&&!l&&os(n,r,0,!1);break}else{if(a=n.current.alternate,E&&!ZE(a)){y=bf(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=il;var te=$.current.memoizedState.isDehydrated;if(te&&(Ia($,O).flags|=256),O=bf($,O,!1),O!==2){if(df&&!te){$.errorRecoveryDisabledLanes|=E,qs|=E,y=4;break e}E=ai,ai=y,E!==null&&(ai===null?ai=E:ai.push.apply(ai,E))}y=O}if(E=!1,y!==2)continue}}if(y===1){Ia(n,0),os(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:os(l,r,vi,!is);break e;case 2:ai=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(y=Yc+300-ct(),10<y)){if(os(l,r,vi,!is),ee(l,0,!0)!==0)break e;Lr=r,l.timeoutHandle=c1(O0.bind(null,l,a,ai,Zc,pf,r,vi,qs,Da,is,E,"Throttled",-0,0),y);break e}O0(l,a,ai,Zc,pf,r,vi,qs,Da,is,E,null,-0,0)}}break}while(!0);rr(n)}function O0(n,r,a,l,y,E,O,$,te,ce,fe,me,ue,he){if(n.timeoutHandle=-1,me=r.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:we},E0(r,E,me);var Te=(E&62914560)===E?Yc-ct():(E&4194048)===E?R0-ct():0;if(Te=j5(me,Te),Te!==null){Lr=E,n.cancelPendingCommit=Te($0.bind(null,n,r,E,a,l,y,O,$,te,fe,me,null,ue,he)),os(n,E,O,!ce);return}}$0(n,r,E,a,l,y,O,$,te)}function ZE(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(!fi(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 os(n,r,a,l){r&=~ff,r&=~qs,n.suspendedLanes|=r,n.pingedLanes&=~r,l&&(n.warmLanes|=r),l=n.expirationTimes;for(var y=r;0<y;){var E=31-Je(y),O=1<<E;l[E]=-1,y&=~O}a!==0&&Ce(n,a,r)}function Jc(){return(vt&6)===0?(sl(0),!1):!0}function vf(){if(et!==null){if(St===0)var n=et.return;else n=et,br=Bs=null,Od(n),ka=null,$o=0,n=et;for(;n!==null;)u0(n.alternate,n),n=n.return;et=null}}function Ia(n,r){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,_5(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),Lr=0,vf(),Mt=n,et=a=_r(n.current,null),rt=r,St=0,_i=null,is=!1,Oa=pe(n,r),df=!1,Da=vi=ff=qs=rs=tn=0,ai=il=null,pf=!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-Je(l),E=1<<y;r|=n[y],l&=~E}return Rr=r,bc(),a}function D0(n,r){qe=null,P.H=Yo,r===Ea||r===Tc?(r=X_(),St=3):r===Sd?(r=X_(),St=4):St=r===Yd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,_i=r,et===null&&(tn=1,$c(n,Ri(r,n.current)))}function j0(){var n=gi.current;return n===null?!0:(rt&4194048)===rt?Oi===null:(rt&62914560)===rt||(rt&536870912)!==0?n===Oi:!1}function I0(){var n=P.H;return P.H=Yo,n===null?Yo:n}function B0(){var n=P.A;return P.A=YE,n}function Qc(){tn=4,is||(rt&4194048)!==rt&&gi.current!==null||(Oa=!0),(rs&134217727)===0&&(qs&134217727)===0||Mt===null||os(Mt,rt,vi,!1)}function bf(n,r,a){var l=vt;vt|=2;var y=I0(),E=B0();(Mt!==n||rt!==r)&&(Zc=null,Ia(n,r)),r=!1;var O=tn;e:do try{if(St!==0&&et!==null){var $=et,te=_i;switch(St){case 8:vf(),O=6;break e;case 3:case 2:case 9:case 6:gi.current===null&&(r=!0);var ce=St;if(St=0,_i=null,Ba(n,$,te,ce),a&&Oa){O=0;break e}break;default:ce=St,St=0,_i=null,Ba(n,$,te,ce)}}JE(),O=tn;break}catch(fe){D0(n,fe)}while(!0);return r&&n.shellSuspendCounter++,br=Bs=null,vt=l,P.H=y,P.A=E,et===null&&(Mt=null,rt=0,bc()),O}function JE(){for(;et!==null;)P0(et)}function QE(n,r){var a=vt;vt|=2;var l=I0(),y=B0();Mt!==n||rt!==r?(Zc=null,Xc=ct()+500,Ia(n,r)):Oa=pe(n,r);e:do try{if(St!==0&&et!==null){r=et;var E=_i;t:switch(St){case 1:St=0,_i=null,Ba(n,r,E,1);break;case 2:case 9:if(V_(E)){St=0,_i=null,z0(r);break}r=function(){St!==2&&St!==9||Mt!==n||(St=7),rr(n)},E.then(r,r);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:V_(E)?(St=0,_i=null,z0(r)):(St=0,_i=null,Ba(n,r,E,7));break;case 5:var O=null;switch(et.tag){case 26:O=et.memoizedState;case 5:case 27:var $=et;if(O?C1(O):$.stateNode.complete){St=0,_i=null;var te=$.sibling;if(te!==null)et=te;else{var ce=$.return;ce!==null?(et=ce,eu(ce)):et=null}break t}}St=0,_i=null,Ba(n,r,E,5);break;case 6:St=0,_i=null,Ba(n,r,E,6);break;case 8:vf(),tn=6;break e;default:throw Error(s(462))}}e5();break}catch(fe){D0(n,fe)}while(!0);return br=Bs=null,P.H=l,P.A=y,vt=a,et!==null?0:(Mt=null,rt=0,bc(),tn)}function e5(){for(;et!==null&&!kn();)P0(et)}function P0(n){var r=l0(n.alternate,n,Rr);n.memoizedProps=n.pendingProps,r===null?eu(n):et=r}function z0(n){var r=n,a=r.alternate;switch(r.tag){case 15:case 0:r=n0(a,r,r.pendingProps,r.type,void 0,rt);break;case 11:r=n0(a,r,r.pendingProps,r.type.render,r.ref,rt);break;case 5:Od(r);default:u0(a,r),r=et=B_(r,Rr),r=l0(a,r,Rr)}n.memoizedProps=n.pendingProps,r===null?eu(n):et=r}function Ba(n,r,a,l){br=Bs=null,Od(r),ka=null,$o=0;var y=r.return;try{if(UE(n,y,r,a,rt)){tn=1,$c(n,Ri(a,n.current)),et=null;return}}catch(E){if(y!==null)throw et=y,E;tn=1,$c(n,Ri(a,n.current)),et=null;return}r.flags&32768?(ot||l===1?n=!0:Oa||(rt&536870912)!==0?n=!1:(is=n=!0,(l===2||l===9||l===3||l===6)&&(l=gi.current,l!==null&&l.tag===13&&(l.flags|=16384))),H0(r,n)):eu(r)}function eu(n){var r=n;do{if((r.flags&32768)!==0){H0(r,is);return}n=r.return;var a=GE(r.alternate,r,Rr);if(a!==null){et=a;return}if(r=r.sibling,r!==null){et=r;return}et=r=n}while(r!==null);tn===0&&(tn=5)}function H0(n,r){do{var a=qE(n.alternate,n);if(a!==null){a.flags&=32767,et=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(n=n.sibling,n!==null)){et=n;return}et=n=a}while(n!==null);tn=6,et=null}function $0(n,r,a,l,y,E,O,$,te){n.cancelPendingCommit=null;do tu();while(yn!==0);if((vt&6)!==0)throw Error(s(327));if(r!==null){if(r===n.current)throw Error(s(177));if(E=r.lanes|r.childLanes,E|=ad,ke(n,a,E,O,$,te),n===Mt&&(et=Mt=null,rt=0),ja=r,as=n,Lr=a,gf=E,mf=y,L0=l,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,r5(Kt,function(){return q0(),null})):(n.callbackNode=null,n.callbackPriority=0),l=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||l){l=P.T,P.T=null,y=G.p,G.p=2,O=vt,vt|=4;try{KE(n,r,a)}finally{vt=O,G.p=y,P.T=l}}yn=1,U0(),F0(),W0()}}function U0(){if(yn===1){yn=0;var n=as,r=ja,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var l=G.p;G.p=2;var y=vt;vt|=4;try{x0(r,n);var E=Mf,O=A_(n.containerInfo),$=E.focusedElem,te=E.selectionRange;if(O!==$&&$&&$.ownerDocument&&T_($.ownerDocument.documentElement,$)){if(te!==null&&td($)){var ce=te.start,fe=te.end;if(fe===void 0&&(fe=ce),"selectionStart"in $)$.selectionStart=ce,$.selectionEnd=Math.min(fe,$.value.length);else{var me=$.ownerDocument||document,ue=me&&me.defaultView||window;if(ue.getSelection){var he=ue.getSelection(),Te=$.textContent.length,He=Math.min(te.start,Te),Tt=te.end===void 0?He:Math.min(te.end,Te);!he.extend&&He>Tt&&(O=Tt,Tt=He,He=O);var ae=k_($,He),ie=k_($,Tt);if(ae&&ie&&(he.rangeCount!==1||he.anchorNode!==ae.node||he.anchorOffset!==ae.offset||he.focusNode!==ie.node||he.focusOffset!==ie.offset)){var le=me.createRange();le.setStart(ae.node,ae.offset),he.removeAllRanges(),He>Tt?(he.addRange(le),he.extend(ie.node,ie.offset)):(le.setEnd(ie.node,ie.offset),he.addRange(le))}}}}for(me=[],he=$;he=he.parentNode;)he.nodeType===1&&me.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<me.length;$++){var ge=me[$];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}fu=!!Lf,Mf=Lf=null}finally{vt=y,G.p=l,P.T=a}}n.current=r,yn=2}}function F0(){if(yn===2){yn=0;var n=as,r=ja,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var l=G.p;G.p=2;var y=vt;vt|=4;try{_0(n,r.alternate,r)}finally{vt=y,G.p=l,P.T=a}}yn=3}}function W0(){if(yn===4||yn===3){yn=0,Zt();var n=as,r=ja,a=Lr,l=L0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?yn=5:(yn=0,ja=as=null,G0(n,n.pendingLanes));var y=n.pendingLanes;if(y===0&&(ss=null),Rn(a),r=r.stateNode,ve&&typeof ve.onCommitFiberRoot=="function")try{ve.onCommitFiberRoot(Tn,r,void 0,(r.current.flags&128)===128)}catch{}if(l!==null){r=P.T,y=G.p,G.p=2,P.T=null;try{for(var E=n.onRecoverableError,O=0;O<l.length;O++){var $=l[O];E($.value,{componentStack:$.stack})}}finally{P.T=r,G.p=y}}(Lr&3)!==0&&tu(),rr(n),y=n.pendingLanes,(a&261930)!==0&&(y&42)!==0?n===_f?rl++:(rl=0,_f=n):rl=0,sl(0)}}function G0(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,zo(r)))}function tu(){return U0(),F0(),W0(),q0()}function q0(){if(yn!==5)return!1;var n=as,r=gf;gf=0;var a=Rn(Lr),l=P.T,y=G.p;try{G.p=32>a?32:a,P.T=null,a=mf,mf=null;var E=as,O=Lr;if(yn=0,ja=as=null,Lr=0,(vt&6)!==0)throw Error(s(331));var $=vt;if(vt|=4,T0(E.current),C0(E,E.current,O,a),vt=$,sl(0,!1),ve&&typeof ve.onPostCommitFiberRoot=="function")try{ve.onPostCommitFiberRoot(Tn,E)}catch{}return!0}finally{G.p=y,P.T=l,G0(n,r)}}function K0(n,r,a){r=Ri(a,r),r=Vd(n.stateNode,r,2),n=Qr(n,r,2),n!==null&&(ut(n,2),rr(n))}function xt(n,r,a){if(n.tag===3)K0(n,n,a);else for(;r!==null;){if(r.tag===3){K0(r,n,a);break}else if(r.tag===1){var l=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ss===null||!ss.has(l))){n=Ri(a,n),a=Vv(2),l=Qr(r,a,2),l!==null&&(Yv(a,l,r,n),ut(l,2),rr(l));break}}r=r.return}}function yf(n,r,a){var l=n.pingCache;if(l===null){l=n.pingCache=new XE;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)||(df=!0,y.add(a),n=t5.bind(null,n,r,a),r.then(n,n))}function t5(n,r,a){var l=n.pingCache;l!==null&&l.delete(r),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,Mt===n&&(rt&a)===a&&(tn===4||tn===3&&(rt&62914560)===rt&&300>ct()-Yc?(vt&2)===0&&Ia(n,0):ff|=a,Da===rt&&(Da=0)),rr(n)}function V0(n,r){r===0&&(r=je()),n=Ds(n,r),n!==null&&(ut(n,r),rr(n))}function n5(n){var r=n.memoizedState,a=0;r!==null&&(a=r.retryLane),V0(n,a)}function i5(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),V0(n,a)}function r5(n,r){return vn(n,r)}var nu=null,Pa=null,Sf=!1,iu=!1,xf=!1,ls=0;function rr(n){n!==Pa&&n.next===null&&(Pa===null?nu=Pa=n:Pa=Pa.next=n),iu=!0,Sf||(Sf=!0,a5())}function sl(n,r){if(!xf&&iu){xf=!0;do for(var a=!1,l=nu;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-Je(42|n)+1)-1,E&=y&~(O&~$),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,J0(l,E))}else E=rt,E=ee(l,l===Mt?E:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(E&3)===0||pe(l,E)||(a=!0,J0(l,E));l=l.next}while(a);xf=!1}}function s5(){Y0()}function Y0(){iu=Sf=!1;var n=0;ls!==0&&m5()&&(n=ls);for(var r=ct(),a=null,l=nu;l!==null;){var y=l.next,E=X0(l,r);E===0?(l.next=null,a===null?nu=y:a.next=y,y===null&&(Pa=a)):(a=l,(n!==0||(E&3)!==0)&&(iu=!0)),l=y}yn!==0&&yn!==5||sl(n),ls!==0&&(ls=0)}function X0(n,r){for(var a=n.suspendedLanes,l=n.pingedLanes,y=n.expirationTimes,E=n.pendingLanes&-62914561;0<E;){var O=31-Je(E),$=1<<O,te=y[O];te===-1?(($&a)===0||($&l)!==0)&&(y[O]=Se($,r)):te<=r&&(n.expiredLanes|=$),E&=~$}if(r=Mt,a=rt,a=ee(n,n===r?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l=n.callbackNode,a===0||n===r&&(St===2||St===9)||n.cancelPendingCommit!==null)return l!==null&&l!==null&&on(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&&on(l),Rn(a)){case 2:case 8:a=Ft;break;case 32:a=Kt;break;case 268435456:a=bn;break;default:a=Kt}return l=Z0.bind(null,n),a=vn(a,l),n.callbackPriority=r,n.callbackNode=a,r}return l!==null&&l!==null&&on(l),n.callbackPriority=2,n.callbackNode=null,2}function Z0(n,r){if(yn!==0&&yn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(tu()&&n.callbackNode!==a)return null;var l=rt;return l=ee(n,n===Mt?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),l===0?null:(N0(n,l,r),X0(n,ct()),n.callbackNode!=null&&n.callbackNode===a?Z0.bind(null,n):null)}function J0(n,r){if(tu())return null;N0(n,r,!0)}function a5(){v5(function(){(vt&6)!==0?vn(Ct,s5):Y0()})}function wf(){if(ls===0){var n=wa;n===0&&(n=Dt,Dt<<=1,(Dt&261888)===0&&(Dt=256)),ls=n}return ls}function Q0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Gr(""+n)}function e1(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 o5(n,r,a,l,y){if(r==="submit"&&a&&a.stateNode===y){var E=Q0((y[Nt]||null).action),O=l.submitter;O&&(r=(r=O[Nt]||null)?Q0(r.formAction):O.getAttribute("formAction"),r!==null&&(E=r,O=null));var $=new gc("action","action",null,l,y);n.push({event:$,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ls!==0){var te=O?e1(y,O):new FormData(y);Ud(a,{pending:!0,data:te,method:y.method,action:E},null,te)}}else typeof E=="function"&&($.preventDefault(),te=O?e1(y,O):new FormData(y),Ud(a,{pending:!0,data:te,method:y.method,action:E},E,te))},currentTarget:y}]})}}for(var Cf=0;Cf<sd.length;Cf++){var Ef=sd[Cf],l5=Ef.toLowerCase(),c5=Ef[0].toUpperCase()+Ef.slice(1);Wi(l5,"on"+c5)}Wi(M_,"onAnimationEnd"),Wi(N_,"onAnimationIteration"),Wi(O_,"onAnimationStart"),Wi("dblclick","onDoubleClick"),Wi("focusin","onFocus"),Wi("focusout","onBlur"),Wi(EE,"onTransitionRun"),Wi(kE,"onTransitionStart"),Wi(TE,"onTransitionCancel"),Wi(D_,"onTransitionEnd"),be("onMouseEnter",["mouseout","mouseover"]),be("onMouseLeave",["mouseout","mouseover"]),be("onPointerEnter",["pointerout","pointerover"]),be("onPointerLeave",["pointerout","pointerover"]),Qt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var al="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(" "),u5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(al));function t1(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(fe){vc(fe)}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(fe){vc(fe)}y.currentTarget=null,E=te}}}}function tt(n,r){var a=r[Fr];a===void 0&&(a=r[Fr]=new Set);var l=n+"__bubble";a.has(l)||(n1(r,n,2,!1),a.add(l))}function kf(n,r,a){var l=0;r&&(l|=4),n1(a,n,l,r)}var ru="_reactListening"+Math.random().toString(36).slice(2);function Tf(n){if(!n[ru]){n[ru]=!0,Bt.forEach(function(a){a!=="selectionchange"&&(u5.has(a)||kf(a,!1,n),kf(a,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[ru]||(r[ru]=!0,kf("selectionchange",!1,r))}}function n1(n,r,a,l){switch(M1(r)){case 2:var y=P5;break;case 8:y=z5;break;default:y=Uf}a=y.bind(null,r,a,n),y=void 0,!qh||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 Af(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=Q($),O===null)return;if(te=O.tag,te===5||te===6||te===26||te===27){l=E=O;continue e}$=$.parentNode}}l=l.return}hc(function(){var ce=E,fe=Ge(a),me=[];e:{var ue=j_.get(n);if(ue!==void 0){var he=gc,Te=n;switch(n){case"keypress":if(fc(a)===0)break e;case"keydown":case"keyup":he=iE;break;case"focusin":Te="focus",he=Xh;break;case"focusout":Te="blur",he=Xh;break;case"beforeblur":case"afterblur":he=Xh;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=u_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=G2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=aE;break;case M_:case N_:case O_:he=V2;break;case D_:he=lE;break;case"scroll":case"scrollend":he=F2;break;case"wheel":he=uE;break;case"copy":case"cut":case"paste":he=X2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=d_;break;case"toggle":case"beforetoggle":he=dE}var He=(r&4)!==0,Tt=!He&&(n==="scroll"||n==="scrollend"),ae=He?ue!==null?ue+"Capture":null:ue;He=[];for(var ie=ce,le;ie!==null;){var ge=ie;if(le=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||le===null||ae===null||(ge=Ao(ie,ae),ge!=null&&He.push(ol(ie,ge,le))),Tt)break;ie=ie.return}0<He.length&&(ue=new he(ue,Te,null,a,fe),me.push({event:ue,listeners:He}))}}if((r&7)===0){e:{if(ue=n==="mouseover"||n==="pointerover",he=n==="mouseout"||n==="pointerout",ue&&a!==Re&&(Te=a.relatedTarget||a.fromElement)&&(Q(Te)||Te[Fi]))break e;if((he||ue)&&(ue=fe.window===fe?fe:(ue=fe.ownerDocument)?ue.defaultView||ue.parentWindow:window,he?(Te=a.relatedTarget||a.toElement,he=ce,Te=Te?Q(Te):null,Te!==null&&(Tt=f(Te),He=Te.tag,Te!==Tt||He!==5&&He!==27&&He!==6)&&(Te=null)):(he=null,Te=ce),he!==Te)){if(He=u_,ge="onMouseLeave",ae="onMouseEnter",ie="mouse",(n==="pointerout"||n==="pointerover")&&(He=d_,ge="onPointerLeave",ae="onPointerEnter",ie="pointer"),Tt=he==null?ue:Ee(he),le=Te==null?ue:Ee(Te),ue=new He(ge,ie+"leave",he,a,fe),ue.target=Tt,ue.relatedTarget=le,ge=null,Q(fe)===ce&&(He=new He(ae,ie+"enter",Te,a,fe),He.target=le,He.relatedTarget=Tt,ge=He),Tt=ge,he&&Te)t:{for(He=h5,ae=he,ie=Te,le=0,ge=ae;ge;ge=He(ge))le++;ge=0;for(var Be=ie;Be;Be=He(Be))ge++;for(;0<le-ge;)ae=He(ae),le--;for(;0<ge-le;)ie=He(ie),ge--;for(;le--;){if(ae===ie||ie!==null&&ae===ie.alternate){He=ae;break t}ae=He(ae),ie=He(ie)}He=null}else He=null;he!==null&&i1(me,ue,he,He,!1),Te!==null&&Tt!==null&&i1(me,Tt,Te,He,!0)}}e:{if(ue=ce?Ee(ce):window,he=ue.nodeName&&ue.nodeName.toLowerCase(),he==="select"||he==="input"&&ue.type==="file")var pt=y_;else if(v_(ue))if(S_)pt=xE;else{pt=yE;var Le=bE}else he=ue.nodeName,!he||he.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ce&&Wr(ce.elementType)&&(pt=y_):pt=SE;if(pt&&(pt=pt(n,ce))){b_(me,pt,a,fe);break e}Le&&Le(n,ue,ce),n==="focusout"&&ce&&ue.type==="number"&&ce.memoizedProps.value!=null&&da(ue,"number",ue.value)}switch(Le=ce?Ee(ce):window,n){case"focusin":(v_(Le)||Le.contentEditable==="true")&&(ga=Le,nd=ce,Io=null);break;case"focusout":Io=nd=ga=null;break;case"mousedown":id=!0;break;case"contextmenu":case"mouseup":case"dragend":id=!1,R_(me,a,fe);break;case"selectionchange":if(CE)break;case"keydown":case"keyup":R_(me,a,fe)}var Ye;if(Jh)e:{switch(n){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else pa?m_(n,a)&&(st="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(st="onCompositionStart");st&&(f_&&a.locale!=="ko"&&(pa||st!=="onCompositionStart"?st==="onCompositionEnd"&&pa&&(Ye=l_()):(qr=fe,Kh="value"in qr?qr.value:qr.textContent,pa=!0)),Le=su(ce,st),0<Le.length&&(st=new h_(st,n,null,a,fe),me.push({event:st,listeners:Le}),Ye?st.data=Ye:(Ye=__(a),Ye!==null&&(st.data=Ye)))),(Ye=pE?gE(n,a):mE(n,a))&&(st=su(ce,"onBeforeInput"),0<st.length&&(Le=new h_("onBeforeInput","beforeinput",null,a,fe),me.push({event:Le,listeners:st}),Le.data=Ye)),o5(me,n,ce,a,fe)}t1(me,r)})}function ol(n,r,a){return{instance:n,listener:r,currentTarget:a}}function su(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=Ao(n,a),y!=null&&l.unshift(ol(n,y,E)),y=Ao(n,r),y!=null&&l.push(ol(n,y,E))),n.tag===3)return l;n=n.return}return[]}function h5(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function i1(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=Ao(a,E),ce!=null&&O.unshift(ol(a,ce,te))):y||(ce=Ao(a,E),ce!=null&&O.push(ol(a,ce,te)))),a=a.return}O.length!==0&&n.push({event:r,listeners:O})}var d5=/\r\n?/g,f5=/\u0000|\uFFFD/g;function r1(n){return(typeof n=="string"?n:""+n).replace(d5,`
|
|
9
|
+
`).replace(f5,"")}function s1(n,r){return r=r1(r),r1(n)===r}function kt(n,r,a,l,y,E){switch(a){case"children":typeof l=="string"?r==="body"||r==="textarea"&&l===""||Ue(n,l):(typeof l=="number"||typeof l=="bigint")&&r!=="body"&&Ue(n,""+l);break;case"className":hi(n,"class",l);break;case"tabIndex":hi(n,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":hi(n,a,l);break;case"style":yt(n,l,E);break;case"data":if(r!=="object"){hi(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=Gr(""+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"&&kt(n,r,"name",y.name,y,null),kt(n,r,"formEncType",y.formEncType,y,null),kt(n,r,"formMethod",y.formMethod,y,null),kt(n,r,"formTarget",y.formTarget,y,null)):(kt(n,r,"encType",y.encType,y,null),kt(n,r,"method",y.method,y,null),kt(n,r,"target",y.target,y,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){n.removeAttribute(a);break}l=Gr(""+l),n.setAttribute(a,l);break;case"onClick":l!=null&&(n.onclick=we);break;case"onScroll":l!=null&&tt("scroll",n);break;case"onScrollEnd":l!=null&&tt("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=Gr(""+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":tt("beforetoggle",n),tt("toggle",n),zn(n,"popover",l);break;case"xlinkActuate":ei(n,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ei(n,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ei(n,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ei(n,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ei(n,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ei(n,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ei(n,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ei(n,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ei(n,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":zn(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=gr.get(a)||a,zn(n,a,l))}}function Rf(n,r,a,l,y,E){switch(a){case"style":yt(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"?Ue(n,l):(typeof l=="number"||typeof l=="bigint")&&Ue(n,""+l);break;case"onScroll":l!=null&&tt("scroll",n);break;case"onScrollEnd":l!=null&&tt("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(!Jt.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[Nt]||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,""):zn(n,a,l)}}}function Dn(n,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":tt("error",n),tt("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:kt(n,r,E,O,a,null)}}y&&kt(n,r,"srcSet",a.srcSet,a,null),l&&kt(n,r,"src",a.src,a,null);return;case"input":tt("invalid",n);var $=E=O=y=null,te=null,ce=null;for(l in a)if(a.hasOwnProperty(l)){var fe=a[l];if(fe!=null)switch(l){case"name":y=fe;break;case"type":O=fe;break;case"checked":te=fe;break;case"defaultChecked":ce=fe;break;case"value":E=fe;break;case"defaultValue":$=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,r));break;default:kt(n,r,l,fe,a,null)}}Ls(n,E,$,te,ce,O,y,!1);return;case"select":tt("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:kt(n,r,y,$,a,null)}r=E,a=O,n.multiple=!!l,r!=null?Ln(n,!!l,r,!1):a!=null&&Ln(n,!!l,a,!0);return;case"textarea":tt("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:kt(n,r,O,$,a,null)}fa(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":kt(n,r,te,l,a,null));return;case"dialog":tt("beforetoggle",n),tt("toggle",n),tt("cancel",n),tt("close",n);break;case"iframe":case"object":tt("load",n);break;case"video":case"audio":for(l=0;l<al.length;l++)tt(al[l],n);break;case"image":tt("error",n),tt("load",n);break;case"details":tt("toggle",n);break;case"embed":case"source":case"link":tt("error",n),tt("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:kt(n,r,ce,l,a,null)}return;default:if(Wr(r)){for(fe in a)a.hasOwnProperty(fe)&&(l=a[fe],l!==void 0&&Rf(n,r,fe,l,a,void 0));return}}for($ in a)a.hasOwnProperty($)&&(l=a[$],l!=null&&kt(n,r,$,l,a,null))}function p5(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,fe=null;for(he in a){var me=a[he];if(a.hasOwnProperty(he)&&me!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":te=me;default:l.hasOwnProperty(he)||kt(n,r,he,null,l,me)}}for(var ue in l){var he=l[ue];if(me=a[ue],l.hasOwnProperty(ue)&&(he!=null||me!=null))switch(ue){case"type":E=he;break;case"name":y=he;break;case"checked":ce=he;break;case"defaultChecked":fe=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!==me&&kt(n,r,ue,he,l,me)}}Eo(n,O,$,te,ce,fe,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)||kt(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&&kt(n,r,y,E,l,te)}r=$,a=O,l=he,ue!=null?Ln(n,!!a,ue,!1):!!l!=!!a&&(r!=null?Ln(n,!!a,r,!0):Ln(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:kt(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&&kt(n,r,O,y,l,E)}cc(n,ue,he);return;case"option":for(var Te in a)ue=a[Te],a.hasOwnProperty(Te)&&ue!=null&&!l.hasOwnProperty(Te)&&(Te==="selected"?n.selected=!1:kt(n,r,Te,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":kt(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 He in a)ue=a[He],a.hasOwnProperty(He)&&ue!=null&&!l.hasOwnProperty(He)&&kt(n,r,He,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:kt(n,r,ce,ue,l,he)}return;default:if(Wr(r)){for(var Tt in a)ue=a[Tt],a.hasOwnProperty(Tt)&&ue!==void 0&&!l.hasOwnProperty(Tt)&&Rf(n,r,Tt,void 0,l,ue);for(fe in l)ue=l[fe],he=a[fe],!l.hasOwnProperty(fe)||ue===he||ue===void 0&&he===void 0||Rf(n,r,fe,ue,l,he);return}}for(var ae in a)ue=a[ae],a.hasOwnProperty(ae)&&ue!=null&&!l.hasOwnProperty(ae)&&kt(n,r,ae,null,l,ue);for(me in l)ue=l[me],he=a[me],!l.hasOwnProperty(me)||ue===he||ue==null&&he==null||kt(n,r,me,ue,l,he)}function a1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function g5(){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&&$&&a1(O)){for(O=0,$=y.responseEnd,l+=1;l<a.length;l++){var te=a[l],ce=te.startTime;if(ce>$)break;var fe=te.transferSize,me=te.initiatorType;fe&&a1(me)&&(te=te.responseEnd,O+=fe*(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 Lf=null,Mf=null;function au(n){return n.nodeType===9?n:n.ownerDocument}function o1(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 l1(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 Nf(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 Of=null;function m5(){var n=window.event;return n&&n.type==="popstate"?n===Of?!1:(Of=n,!0):(Of=null,!1)}var c1=typeof setTimeout=="function"?setTimeout:void 0,_5=typeof clearTimeout=="function"?clearTimeout:void 0,u1=typeof Promise=="function"?Promise:void 0,v5=typeof queueMicrotask=="function"?queueMicrotask:typeof u1<"u"?function(n){return u1.resolve(null).then(n).catch(b5)}:c1;function b5(n){setTimeout(function(){throw n})}function cs(n){return n==="head"}function h1(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),Ua(r);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")ll(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,ll(a);for(var E=a.firstChild;E;){var O=E.nextSibling,$=E.nodeName;E[er]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=O}}else a==="body"&&ll(n.ownerDocument.body);a=y}while(a);Ua(r)}function d1(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 Df(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":Df(a),De(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function y5(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[er])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=Di(n.nextSibling),n===null)break}return null}function S5(n,r,a){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Di(n.nextSibling),n===null))return null;return n}function f1(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Di(n.nextSibling),n===null))return null;return n}function jf(n){return n.data==="$?"||n.data==="$~"}function If(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function x5(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 Di(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 Bf=null;function p1(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(r===0)return Di(n.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}n=n.nextSibling}return null}function g1(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 m1(n,r,a){switch(r=au(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 ll(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);De(n)}var ji=new Map,_1=new Set;function ou(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Mr=G.d;G.d={f:w5,r:C5,D:E5,C:k5,L:T5,m:A5,X:L5,S:R5,M:M5};function w5(){var n=Mr.f(),r=Jc();return n||r}function C5(n){var r=_e(n);r!==null&&r.tag===5&&r.type==="form"?Dv(r):Mr.r(n)}var za=typeof document>"u"?null:document;function v1(n,r,a){var l=za;if(l&&typeof r=="string"&&r){var y=ti(r);y='link[rel="'+n+'"][href="'+y+'"]',typeof a=="string"&&(y+='[crossorigin="'+a+'"]'),_1.has(y)||(_1.add(y),n={rel:n,crossOrigin:a,href:r},l.querySelector(y)===null&&(r=l.createElement("link"),Dn(r,"link",n),Qe(r),l.head.appendChild(r)))}}function E5(n){Mr.D(n),v1("dns-prefetch",n,null)}function k5(n,r){Mr.C(n,r),v1("preconnect",n,r)}function T5(n,r,a){Mr.L(n,r,a);var l=za;if(l&&n&&r){var y='link[rel="preload"][as="'+ti(r)+'"]';r==="image"&&a&&a.imageSrcSet?(y+='[imagesrcset="'+ti(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(y+='[imagesizes="'+ti(a.imageSizes)+'"]')):y+='[href="'+ti(n)+'"]';var E=y;switch(r){case"style":E=Ha(n);break;case"script":E=$a(n)}ji.has(E)||(n=g({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:n,as:r},a),ji.set(E,n),l.querySelector(y)!==null||r==="style"&&l.querySelector(cl(E))||r==="script"&&l.querySelector(ul(E))||(r=l.createElement("link"),Dn(r,"link",n),Qe(r),l.head.appendChild(r)))}}function A5(n,r){Mr.m(n,r);var a=za;if(a&&n){var l=r&&typeof r.as=="string"?r.as:"script",y='link[rel="modulepreload"][as="'+ti(l)+'"][href="'+ti(n)+'"]',E=y;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=$a(n)}if(!ji.has(E)&&(n=g({rel:"modulepreload",href:n},r),ji.set(E,n),a.querySelector(y)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ul(E)))return}l=a.createElement("link"),Dn(l,"link",n),Qe(l),a.head.appendChild(l)}}}function R5(n,r,a){Mr.S(n,r,a);var l=za;if(l&&n){var y=at(l).hoistableStyles,E=Ha(n);r=r||"default";var O=y.get(E);if(!O){var $={loading:0,preload:null};if(O=l.querySelector(cl(E)))$.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":r},a),(a=ji.get(E))&&Pf(n,a);var te=O=l.createElement("link");Qe(te),Dn(te,"link",n),te._p=new Promise(function(ce,fe){te.onload=ce,te.onerror=fe}),te.addEventListener("load",function(){$.loading|=1}),te.addEventListener("error",function(){$.loading|=2}),$.loading|=4,lu(O,r,l)}O={type:"stylesheet",instance:O,count:1,state:$},y.set(E,O)}}}function L5(n,r){Mr.X(n,r);var a=za;if(a&&n){var l=at(a).hoistableScripts,y=$a(n),E=l.get(y);E||(E=a.querySelector(ul(y)),E||(n=g({src:n,async:!0},r),(r=ji.get(y))&&zf(n,r),E=a.createElement("script"),Qe(E),Dn(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},l.set(y,E))}}function M5(n,r){Mr.M(n,r);var a=za;if(a&&n){var l=at(a).hoistableScripts,y=$a(n),E=l.get(y);E||(E=a.querySelector(ul(y)),E||(n=g({src:n,async:!0,type:"module"},r),(r=ji.get(y))&&zf(n,r),E=a.createElement("script"),Qe(E),Dn(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},l.set(y,E))}}function b1(n,r,a,l){var y=(y=re.current)?ou(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=Ha(a.href),a=at(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=Ha(a.href);var E=at(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(cl(n)))&&!E._p&&(O.instance=E,O.state.loading=5),ji.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},ji.set(n,a),E||N5(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=$a(a),a=at(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 Ha(n){return'href="'+ti(n)+'"'}function cl(n){return'link[rel="stylesheet"]['+n+"]"}function y1(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function N5(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}),Dn(r,"link",a),Qe(r),n.head.appendChild(r))}function $a(n){return'[src="'+ti(n)+'"]'}function ul(n){return"script[async]"+n}function S1(n,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var l=n.querySelector('style[data-href~="'+ti(a.href)+'"]');if(l)return r.instance=l,Qe(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"),Qe(l),Dn(l,"style",y),lu(l,a.precedence,n),r.instance=l;case"stylesheet":y=Ha(a.href);var E=n.querySelector(cl(y));if(E)return r.state.loading|=4,r.instance=E,Qe(E),E;l=y1(a),(y=ji.get(y))&&Pf(l,y),E=(n.ownerDocument||n).createElement("link"),Qe(E);var O=E;return O._p=new Promise(function($,te){O.onload=$,O.onerror=te}),Dn(E,"link",l),r.state.loading|=4,lu(E,a.precedence,n),r.instance=E;case"script":return E=$a(a.src),(y=n.querySelector(ul(E)))?(r.instance=y,Qe(y),y):(l=a,(y=ji.get(E))&&(l=g({},a),zf(l,y)),n=n.ownerDocument||n,y=n.createElement("script"),Qe(y),Dn(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,lu(l,a.precedence,n));return r.instance}function lu(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 Pf(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function zf(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var cu=null;function x1(n,r,a){if(cu===null){var l=new Map,y=cu=new Map;y.set(a,l)}else y=cu,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[er]||E[It]||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 w1(n,r,a){n=n.ownerDocument||n,n.head.insertBefore(a,r==="title"?n.querySelector("head > title"):null)}function O5(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 C1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function D5(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=Ha(l.href),E=r.querySelector(cl(y));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=uu.bind(n),r.then(n,n)),a.state.loading|=4,a.instance=E,Qe(E);return}E=r.ownerDocument||r,l=y1(l),(y=ji.get(y))&&Pf(l,y),E=E.createElement("link"),Qe(E);var O=E;O._p=new Promise(function($,te){O.onload=$,O.onerror=te}),Dn(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=uu.bind(n),r.addEventListener("load",a),r.addEventListener("error",a))}}var Hf=0;function j5(n,r){return n.stylesheets&&n.count===0&&du(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var l=setTimeout(function(){if(n.stylesheets&&du(n,n.stylesheets),n.unsuspend){var E=n.unsuspend;n.unsuspend=null,E()}},6e4+r);0<n.imgBytes&&Hf===0&&(Hf=62500*g5());var y=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&du(n,n.stylesheets),n.unsuspend)){var E=n.unsuspend;n.unsuspend=null,E()}},(n.imgBytes>Hf?50:800)+r);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(l),clearTimeout(y)}}:null}function uu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)du(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var hu=null;function du(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,hu=new Map,r.forEach(I5,n),hu=null,uu.call(n))}function I5(n,r){if(!(r.state.loading&4)){var a=hu.get(n);if(a)var l=a.get(null);else{a=new Map,hu.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=uu.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 hl={$$typeof:S,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function B5(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=bt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bt(0),this.hiddenUpdates=bt(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 E1(n,r,a,l,y,E,O,$,te,ce,fe,me){return n=new B5(n,r,a,O,te,ce,fe,me,$),r=1,E===!0&&(r|=24),E=pi(3,null,null,r),n.current=E,E.stateNode=n,r=vd(),r.refCount++,n.pooledCache=r,r.refCount++,E.memoizedState={element:l,isDehydrated:a,cache:r},xd(E),n}function k1(n){return n?(n=va,n):va}function T1(n,r,a,l,y,E){y=k1(y),l.context===null?l.context=y:l.pendingContext=y,l=Jr(r),l.payload={element:a},E=E===void 0?null:E,E!==null&&(l.callback=E),a=Qr(n,l,r),a!==null&&(oi(a,n,r),Fo(a,n,r))}function A1(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<r?a:r}}function $f(n,r){A1(n,r),(n=n.alternate)&&A1(n,r)}function R1(n){if(n.tag===13||n.tag===31){var r=Ds(n,67108864);r!==null&&oi(r,n,67108864),$f(n,67108864)}}function L1(n){if(n.tag===13||n.tag===31){var r=bi();r=nt(r);var a=Ds(n,r);a!==null&&oi(a,n,r),$f(n,r)}}var fu=!0;function P5(n,r,a,l){var y=P.T;P.T=null;var E=G.p;try{G.p=2,Uf(n,r,a,l)}finally{G.p=E,P.T=y}}function z5(n,r,a,l){var y=P.T;P.T=null;var E=G.p;try{G.p=8,Uf(n,r,a,l)}finally{G.p=E,P.T=y}}function Uf(n,r,a,l){if(fu){var y=Ff(l);if(y===null)Af(n,r,l,pu,a),N1(n,l);else if($5(y,n,r,a,l))l.stopPropagation();else if(N1(n,l),r&4&&-1<H5.indexOf(n)){for(;y!==null;){var E=_e(y);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var O=jt(E.pendingLanes);if(O!==0){var $=E;for($.pendingLanes|=2,$.entangledLanes|=2;O;){var te=1<<31-Je(O);$.entanglements[1]|=te,O&=~te}rr(E),(vt&6)===0&&(Xc=ct()+500,sl(0))}}break;case 31:case 13:$=Ds(E,2),$!==null&&oi($,E,2),Jc(),$f(E,2)}if(E=Ff(l),E===null&&Af(n,r,l,pu,a),E===y)break;y=E}y!==null&&l.stopPropagation()}else Af(n,r,l,null,a)}}function Ff(n){return n=Ge(n),Wf(n)}var pu=null;function Wf(n){if(pu=null,n=Q(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 pu=n,null}function M1(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(Lt()){case Ct:return 2;case Ft:return 8;case Kt:case Jn:return 32;case bn:return 268435456;default:return 32}default:return 32}}var Gf=!1,us=null,hs=null,ds=null,dl=new Map,fl=new Map,fs=[],H5="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 N1(n,r){switch(n){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":hs=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":dl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":fl.delete(r.pointerId)}}function pl(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=_e(r),r!==null&&R1(r)),n):(n.eventSystemFlags|=l,r=n.targetContainers,y!==null&&r.indexOf(y)===-1&&r.push(y),n)}function $5(n,r,a,l,y){switch(r){case"focusin":return us=pl(us,n,r,a,l,y),!0;case"dragenter":return hs=pl(hs,n,r,a,l,y),!0;case"mouseover":return ds=pl(ds,n,r,a,l,y),!0;case"pointerover":var E=y.pointerId;return dl.set(E,pl(dl.get(E)||null,n,r,a,l,y)),!0;case"gotpointercapture":return E=y.pointerId,fl.set(E,pl(fl.get(E)||null,n,r,a,l,y)),!0}return!1}function O1(n){var r=Q(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,fr(n.priority,function(){L1(a)});return}}else if(r===31){if(r=c(a),r!==null){n.blockedOn=r,fr(n.priority,function(){L1(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 gu(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var a=Ff(n.nativeEvent);if(a===null){a=n.nativeEvent;var l=new a.constructor(a.type,a);Re=l,a.target.dispatchEvent(l),Re=null}else return r=_e(a),r!==null&&R1(r),n.blockedOn=a,!1;r.shift()}return!0}function D1(n,r,a){gu(n)&&a.delete(r)}function U5(){Gf=!1,us!==null&&gu(us)&&(us=null),hs!==null&&gu(hs)&&(hs=null),ds!==null&&gu(ds)&&(ds=null),dl.forEach(D1),fl.forEach(D1)}function mu(n,r){n.blockedOn===r&&(n.blockedOn=null,Gf||(Gf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,U5)))}var _u=null;function j1(n){_u!==n&&(_u=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){_u===n&&(_u=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(Wf(l||a)===null)continue;break}var E=_e(a);E!==null&&(n.splice(r,3),r-=3,Ud(E,{pending:!0,data:y,method:a.method,action:l},l,y))}}))}function Ua(n){function r(te){return mu(te,n)}us!==null&&mu(us,n),hs!==null&&mu(hs,n),ds!==null&&mu(ds,n),dl.forEach(r),fl.forEach(r);for(var a=0;a<fs.length;a++){var l=fs[a];l.blockedOn===n&&(l.blockedOn=null)}for(;0<fs.length&&(a=fs[0],a.blockedOn===null);)O1(a),a.blockedOn===null&&fs.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[Nt]||null;if(typeof E=="function")O||j1(a);else if(O){var $=null;if(E&&E.hasAttribute("formAction")){if(y=E,O=E[Nt]||null)$=O.formAction;else if(Wf(y)!==null)continue}else $=O.action;typeof $=="function"?a[l+1]=$:(a.splice(l,3),l-=3),j1(a)}}}function I1(){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 qf(n){this._internalRoot=n}vu.prototype.render=qf.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));var a=r.current,l=bi();T1(a,l,n,r,null,null)},vu.prototype.unmount=qf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;T1(n.current,2,null,n,null,null),Jc(),r[Fi]=null}};function vu(n){this._internalRoot=n}vu.prototype.unstable_scheduleHydration=function(n){if(n){var r=dr();n={blockedOn:null,target:n,priority:r};for(var a=0;a<fs.length&&r!==0&&r<fs[a].priority;a++);fs.splice(a,0,n),a===0&&O1(n)}};var B1=t.version;if(B1!=="19.2.7")throw Error(s(527,B1,"19.2.7"));G.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?v(n):null,n=n===null?null:n.stateNode,n};var F5={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bu.isDisabled&&bu.supportsFiber)try{Tn=bu.inject(F5),ve=bu}catch{}}return ml.createRoot=function(n,r){if(!o(n))throw Error(s(299));var a=!1,l="",y=Wv,E=Gv,O=qv;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=E1(n,1,!1,null,null,a,l,null,y,E,O,I1),n[Fi]=r.current,Tf(n),new qf(r)},ml.hydrateRoot=function(n,r,a){if(!o(n))throw Error(s(299));var l=!1,y="",E=Wv,O=Gv,$=qv,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=E1(n,1,!0,r,a??null,l,y,te,E,O,$,I1),r.context=k1(null),a=r.current,l=bi(),l=nt(l),y=Jr(l),y.callback=null,Qr(a,y,l),a=l,r.current.lanes=a,ut(r,a),rr(r),n[Fi]=r.current,Tf(n),new vu(r)},ml.version="19.2.7",ml}var V1;function Lk(){if(V1)return Xf.exports;V1=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(),Xf.exports=Rk(),Xf.exports}var Mk=Lk();var Y1="popstate";function X1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Nk(e={}){function t(s,o){let f=o.state?.masked,{pathname:p,search:c,hash:h}=f||s.location;return ng("",{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:Gl(o)}return Dk(t,i,null,e)}function qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zi(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ok(){return Math.random().toString(36).substring(2,10)}function Z1(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 ng(e,t,i=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?bo(t):t,state:i,key:t&&t.key||s||Ok(),mask:o}}function Gl({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 bo(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 Dk(e,t,i,s={}){let{window:o=document.defaultView,v5Compat:f=!1}=s,p=o.history,c="POP",h=null,d=v();d==null&&(d=0,p.replaceState({...p.state,idx:d},""));function v(){return(p.state||{idx:null}).idx}function g(){c="POP";let m=v(),b=m==null?null:m-d;d=m,h&&h({action:c,location:w.location,delta:b})}function x(m,b){c="PUSH";let _=X1(m)?m:ng(w.location,m,b);d=v()+1;let S=Z1(_,d),k=w.createHref(_.mask||_);try{p.pushState(S,"",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 _=X1(m)?m:ng(w.location,m,b);d=v();let S=Z1(_,d),k=w.createHref(_.mask||_);p.replaceState(S,"",k),f&&h&&h({action:c,location:w.location,delta:0})}function T(m){return jk(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(Y1,g),h=m,()=>{o.removeEventListener(Y1,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:x,replace:C,go(m){return p.go(m)}};return w}function jk(e,t,i=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),qt(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Gl(t);return o=o.replace(/ $/,"%20"),!i&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function QS(e,t,i="/"){return Ik(e,t,i,!1)}function Ik(e,t,i,s,o){let f=typeof t=="string"?bo(t):t,p=Hr(f.pathname||"/",i);if(p==null)return null;let c=Bk(e),h=null,d=Yk(p);for(let v=0;h==null&&v<c.length;++v)h=Kk(c[v],d,s);return h}function Bk(e){let t=ex(e);return Pk(t),t}function ex(e,t=[],i=[],s="",o=!1){let f=(p,c,h=o,d)=>{let v={relativePath:d===void 0?p.path||"":d,caseSensitive:p.caseSensitive===!0,childrenIndex:c,route:p};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&h)return;qt(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let g=Xi([s,v.relativePath]),x=i.concat(v);p.children&&p.children.length>0&&(qt(p.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),ex(p.children,t,x,g,h)),!(p.path==null&&!p.index)&&t.push({path:g,score:Gk(g,p.index),routesMeta:x})};return e.forEach((p,c)=>{if(p.path===""||!p.path?.includes("?"))f(p,c);else for(let h of tx(p.path))f(p,c,!0,h)}),t}function tx(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=tx(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 Pk(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:qk(t.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var zk=/^:[\w-]+$/,Hk=3,$k=2,Uk=1,Fk=10,Wk=-2,J1=e=>e==="*";function Gk(e,t){let i=e.split("/"),s=i.length;return i.some(J1)&&(s+=Wk),t&&(s+=$k),i.filter(o=>!J1(o)).reduce((o,f)=>o+(zk.test(f)?Hk:f===""?Uk:Fk),s)}function qk(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 Kk(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,v=f==="/"?t:t.slice(f.length)||"/",g=ah({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},v),x=h.route;if(!g&&d&&i&&!s[s.length-1].route.index&&(g=ah({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!g)return null;Object.assign(o,g.params),p.push({params:o,pathname:Xi([f,g.pathname]),pathnameBase:Qk(Xi([f,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(f=Xi([f,g.pathnameBase]))}return p}function ah(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=Vk(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:v,isOptional:g},x)=>{if(v==="*"){let T=c[x]||"";p=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const C=c[x];return g&&!C?d[v]=void 0:d[v]=(C||"").replace(/%2F/g,"/"),d},{}),pathname:f,pathnameBase:p,pattern:e}}function Vk(e,t=!1,i=!0){Zi(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,v)=>{if(s.push({paramName:c,isOptional:h!=null}),h){let g=v.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 Yk(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zi(!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 Hr(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 Xk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Zk(e,t="/"){let{pathname:i,search:s="",hash:o=""}=typeof e=="string"?bo(e):e,f;return i?(i=nx(i),i.startsWith("/")?f=Q1(i.substring(1),"/"):f=Q1(i,t)):f=t,{pathname:f,search:eT(s),hash:tT(o)}}function Q1(e,t){let i=oh(t).split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function ep(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 Jk(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function fm(e){let t=Jk(e);return t.map((i,s)=>s===t.length-1?i.pathname:i.pathnameBase)}function Lh(e,t,i,s=!1){let o;typeof e=="string"?o=bo(e):(o={...e},qt(!o.pathname||!o.pathname.includes("?"),ep("?","pathname","search",o)),qt(!o.pathname||!o.pathname.includes("#"),ep("#","pathname","hash",o)),qt(!o.search||!o.search.includes("#"),ep("#","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 x=p.split("/");for(;x[0]==="..";)x.shift(),g-=1;o.pathname=x.join("/")}c=g>=0?t[g]:"/"}let h=Zk(o,c),d=p&&p!=="/"&&p.endsWith("/"),v=(f||p===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(d||v)&&(h.pathname+="/"),h}var nx=e=>e.replace(/\/\/+/g,"/"),Xi=e=>nx(e.join("/")),oh=e=>e.replace(/\/+$/,""),Qk=e=>oh(e).replace(/^\/*/,"/"),eT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,tT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,nT=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 iT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function rT(e){let t=e.map(i=>i.route.path).filter(Boolean);return Xi(t)||"/"}var ix=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function rx(e,t){let i=e;if(typeof i!="string"||!Xk.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,o=!1;if(ix)try{let f=new URL(window.location.href),p=i.startsWith("//")?new URL(f.protocol+i):new URL(i),c=Hr(p.pathname,t);p.origin===f.origin&&c!=null?i=c+p.search+p.hash:o=!0}catch{Zi(!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 sx=["POST","PUT","PATCH","DELETE"];new Set(sx);var sT=["GET",...sx];new Set(sT);var yo=M.createContext(null);yo.displayName="DataRouter";var Mh=M.createContext(null);Mh.displayName="DataRouterState";var ax=M.createContext(!1);function aT(){return M.useContext(ax)}var ox=M.createContext({isTransitioning:!1});ox.displayName="ViewTransition";var oT=M.createContext(new Map);oT.displayName="Fetchers";var lT=M.createContext(null);lT.displayName="Await";var ki=M.createContext(null);ki.displayName="Navigation";var rc=M.createContext(null);rc.displayName="Location";var ur=M.createContext({outlet:null,matches:[],isDataRoute:!1});ur.displayName="Route";var pm=M.createContext(null);pm.displayName="RouteError";var lx="REACT_ROUTER_ERROR",cT="REDIRECT",uT="ROUTE_ERROR_RESPONSE";function hT(e){if(e.startsWith(`${lx}:${cT}:{`))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 dT(e){if(e.startsWith(`${lx}:${uT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new nT(t.status,t.statusText,t.data)}catch{}}function fT(e,{relative:t}={}){qt(So(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=M.useContext(ki),{hash:o,pathname:f,search:p}=sc(e,{relative:t}),c=f;return i!=="/"&&(c=f==="/"?i:Xi([i,f])),s.createHref({pathname:c,search:p,hash:o})}function So(){return M.useContext(rc)!=null}function Ui(){return qt(So(),"useLocation() may be used only in the context of a <Router> component."),M.useContext(rc).location}var cx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ux(e){M.useContext(ki).static||M.useLayoutEffect(e)}function Nh(){let{isDataRoute:e}=M.useContext(ur);return e?kT():pT()}function pT(){qt(So(),"useNavigate() may be used only in the context of a <Router> component.");let e=M.useContext(yo),{basename:t,navigator:i}=M.useContext(ki),{matches:s}=M.useContext(ur),{pathname:o}=Ui(),f=JSON.stringify(fm(s)),p=M.useRef(!1);return ux(()=>{p.current=!0}),M.useCallback((h,d={})=>{if(Zi(p.current,cx),!p.current)return;if(typeof h=="number"){i.go(h);return}let v=Lh(h,JSON.parse(f),o,d.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:Xi([t,v.pathname])),(d.replace?i.replace:i.push)(v,d.state,d)},[t,i,f,o,e])}M.createContext(null);function sc(e,{relative:t}={}){let{matches:i}=M.useContext(ur),{pathname:s}=Ui(),o=JSON.stringify(fm(i));return M.useMemo(()=>Lh(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function gT(e,t){return hx(e,t)}function hx(e,t,i){qt(So(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=M.useContext(ki),{matches:o}=M.useContext(ur),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||"";fx(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 v=Ui(),g;if(t){let m=typeof t=="string"?bo(t):t;qt(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=v;let x=g.pathname||"/",C=x;if(h!=="/"){let m=h.replace(/^\//,"").split("/");C="/"+x.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})):QS(e,{pathname:C});Zi(d||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Zi(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=yT(T&&T.map(m=>Object.assign({},m,{params:Object.assign({},p,m.params),pathname:Xi([h,s.encodeLocation?s.encodeLocation(m.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?h:Xi([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(rc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},w):w}function mT(){let e=ET(),t=iT(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 _T=M.createElement(mT,null),dx=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=dT(e.digest);i&&(e=i)}let t=e!==void 0?M.createElement(ur.Provider,{value:this.props.routeContext},M.createElement(pm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?M.createElement(vT,{error:e},t):t}};dx.contextType=ax;var tp=new WeakMap;function vT({children:e,error:t}){let{basename:i}=M.useContext(ki);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=hT(t.digest);if(s){let o=tp.get(t);if(o)throw o;let f=rx(s.location,i);if(ix&&!tp.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 tp.set(t,p),p}return M.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return e}function bT({routeContext:e,match:t,children:i}){let s=M.useContext(yo);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(ur.Provider,{value:e},i)}function yT(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 v=o.findIndex(g=>g.route.id&&f?.[g.route.id]!==void 0);qt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),o=o.slice(0,Math.min(o.length,v+1))}let p=!1,c=-1;if(i&&s){p=s.renderFallback;for(let v=0;v<o.length;v++){let g=o[v];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(c=v),g.route.id){let{loaderData:x,errors:C}=s,T=g.route.loader&&!x.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?(v,g)=>{h(v,{location:s.location,params:s.matches?.[0]?.params??{},pattern:rT(s.matches),errorInfo:g})}:void 0;return o.reduceRight((v,g,x)=>{let C,T=!1,w=null,m=null;s&&(C=f&&g.route.id?f[g.route.id]:void 0,w=g.route.errorElement||_T,p&&(c<0&&x===0?(fx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,m=null):c===x&&(T=!0,m=g.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,x+1)),_=()=>{let S;return C?S=w:T?S=m:g.route.Component?S=M.createElement(g.route.Component,null):g.route.element?S=g.route.element:S=v,M.createElement(bT,{match:g,routeContext:{outlet:v,matches:b,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?M.createElement(dx,{location:s.location,revalidation:s.revalidation,component:w,error:C,children:_(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:d}):_()},null)}function gm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ST(e){let t=M.useContext(yo);return qt(t,gm(e)),t}function xT(e){let t=M.useContext(Mh);return qt(t,gm(e)),t}function wT(e){let t=M.useContext(ur);return qt(t,gm(e)),t}function mm(e){let t=wT(e),i=t.matches[t.matches.length-1];return qt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function CT(){return mm("useRouteId")}function ET(){let e=M.useContext(pm),t=xT("useRouteError"),i=mm("useRouteError");return e!==void 0?e:t.errors?.[i]}function kT(){let{router:e}=ST("useNavigate"),t=mm("useNavigate"),i=M.useRef(!1);return ux(()=>{i.current=!0}),M.useCallback(async(o,f={})=>{Zi(i.current,cx),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...f}))},[e,t])}var eb={};function fx(e,t,i){!t&&!eb[e]&&(eb[e]=!0,Zi(!1,i))}M.memo(TT);function TT({routes:e,manifest:t,future:i,state:s,isStatic:o,onError:f}){return hx(e,void 0,{manifest:t,state:s,isStatic:o,onError:f})}function tb({to:e,replace:t,state:i,relative:s}){qt(So(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=M.useContext(ki);Zi(!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(ur),{pathname:p}=Ui(),c=Nh(),h=Lh(e,fm(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 Ya(e){qt(!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 AT({basename:e="/",children:t=null,location:i,navigationType:s="POP",navigator:o,static:f=!1,useTransitions:p}){qt(!So(),"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=bo(i));let{pathname:d="/",search:v="",hash:g="",state:x=null,key:C="default",mask:T}=i,w=M.useMemo(()=>{let m=Hr(d,c);return m==null?null:{location:{pathname:m,search:v,hash:g,state:x,key:C,mask:T},navigationType:s}},[c,d,v,g,x,C,s,T]);return Zi(w!=null,`<Router basename="${c}"> is not able to match the URL "${d}${v}${g}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:M.createElement(ki.Provider,{value:h},M.createElement(rc.Provider,{children:t,value:w}))}function RT({children:e,location:t}){return gT(ig(e),t)}function ig(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,ig(s.props.children,f));return}qt(s.type===Ya,`[${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>`),qt(!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=ig(s.props.children,f)),i.push(p)}),i}var Fu="get",Wu="application/x-www-form-urlencoded";function Oh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function LT(e){return Oh(e)&&e.tagName.toLowerCase()==="button"}function MT(e){return Oh(e)&&e.tagName.toLowerCase()==="form"}function NT(e){return Oh(e)&&e.tagName.toLowerCase()==="input"}function OT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function DT(e,t){return e.button===0&&(!t||t==="_self")&&!OT(e)}var yu=null;function jT(){if(yu===null)try{new FormData(document.createElement("form"),0),yu=!1}catch{yu=!0}return yu}var IT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function np(e){return e!=null&&!IT.has(e)?(Zi(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wu}"`),null):e}function BT(e,t){let i,s,o,f,p;if(MT(e)){let c=e.getAttribute("action");s=c?Hr(c,t):null,i=e.getAttribute("method")||Fu,o=np(e.getAttribute("enctype"))||Wu,f=new FormData(e)}else if(LT(e)||NT(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?Hr(h,t):null,i=e.getAttribute("formmethod")||c.getAttribute("method")||Fu,o=np(e.getAttribute("formenctype"))||np(c.getAttribute("enctype"))||Wu,f=new FormData(c,e),!jT()){let{name:d,type:v,value:g}=e;if(v==="image"){let x=d?`${d}.`:"";f.append(`${x}x`,"0"),f.append(`${x}y`,"0")}else d&&f.append(d,g)}}else{if(Oh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Fu,s=null,o=Wu,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 _m(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function px(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&&Hr(o.pathname,t)==="/"?o.pathname=`${oh(t)}/_root.${s}`:o.pathname=`${oh(o.pathname)}.${s}`,o}async function PT(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 zT(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 HT(e,t,i){let s=await Promise.all(e.map(async o=>{let f=t.routes[o.route.id];if(f){let p=await PT(f,i);return p.links?p.links():[]}return[]}));return WT(s.flat(1).filter(zT).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function nb(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 v=s.routes[h.route.id];if(!v||!v.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 $T(e,t,{includeHydrateFallback:i}={}){return UT(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 UT(e){return[...new Set(e)]}function FT(e){let t={},i=Object.keys(e).sort();for(let s of i)t[s]=e[s];return t}function WT(e,t){let i=new Set;return new Set(t),e.reduce((s,o)=>{let f=JSON.stringify(FT(o));return i.has(f)||(i.add(f),s.push({key:f,link:o})),s},[])}function vm(){let e=M.useContext(yo);return _m(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function GT(){let e=M.useContext(Mh);return _m(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bm=M.createContext(void 0);bm.displayName="FrameworkContext";function ym(){let e=M.useContext(bm);return _m(e,"You must render this element inside a <HydratedRouter> element"),e}function qT(e,t){let i=M.useContext(bm),[s,o]=M.useState(!1),[f,p]=M.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:v,onTouchStart:g}=t,x=M.useRef(null);M.useEffect(()=>{if(e==="render"&&p(!0),e==="viewport"){let w=b=>{b.forEach(_=>{p(_.isIntersecting)})},m=new IntersectionObserver(w,{threshold:.5});return x.current&&m.observe(x.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,x,{}]:[f,x,{onFocus:_l(c,C),onBlur:_l(h,T),onMouseEnter:_l(d,C),onMouseLeave:_l(v,T),onTouchStart:_l(g,C)}]:[!1,x,{}]}function _l(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function KT({page:e,...t}){let i=aT(),{router:s}=vm(),o=M.useMemo(()=>QS(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?i?M.createElement(YT,{page:e,matches:o,...t}):M.createElement(XT,{page:e,matches:o,...t}):null}function VT(e){let{manifest:t,routeModules:i}=ym(),[s,o]=M.useState([]);return M.useEffect(()=>{let f=!1;return HT(e,t,i).then(p=>{f||o(p)}),()=>{f=!0}},[e,t,i]),s}function YT({page:e,matches:t,...i}){let s=Ui(),{future:o}=ym(),{basename:f}=vm(),p=M.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=px(e,f,o.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,d=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?h=!0:d.push(v.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 XT({page:e,matches:t,...i}){let s=Ui(),{future:o,manifest:f,routeModules:p}=ym(),{basename:c}=vm(),{loaderData:h,matches:d}=GT(),v=M.useMemo(()=>nb(e,t,d,f,s,"data"),[e,t,d,f,s]),g=M.useMemo(()=>nb(e,t,d,f,s,"assets"),[e,t,d,f,s]),x=M.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,m=!1;if(t.forEach(_=>{let S=f.routes[_.route.id];!S||!S.hasLoader||(!v.some(k=>k.route.id===_.route.id)&&_.route.id in h&&p[_.route.id]?.shouldRevalidate||S.hasClientLoader?m=!0:w.add(_.route.id))}),w.size===0)return[];let b=px(e,c,o.v8_trailingSlashAwareDataRequests,"data");return m&&w.size>0&&b.searchParams.set("_routes",t.filter(_=>w.has(_.route.id)).map(_=>_.route.id).join(",")),[b.pathname+b.search]},[c,o.v8_trailingSlashAwareDataRequests,h,s,f,v,t,e,p]),C=M.useMemo(()=>$T(g,f),[g,f]),T=VT(g);return M.createElement(M.Fragment,null,x.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 ZT(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var JT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{JT&&(window.__reactRouterVersion="7.17.0")}catch{}function QT({basename:e,children:t,useTransitions:i,window:s}){let o=M.useRef();o.current==null&&(o.current=Nk({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(AT,{basename:e,children:t,location:p.location,navigationType:p.action,navigator:f,useTransitions:i})}var gx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ql=M.forwardRef(function({onClick:t,discover:i="render",prefetch:s="none",relative:o,reloadDocument:f,replace:p,mask:c,state:h,target:d,to:v,preventScrollReset:g,viewTransition:x,defaultShouldRevalidate:C,...T},w){let{basename:m,navigator:b,useTransitions:_}=M.useContext(ki),S=typeof v=="string"&&gx.test(v),k=rx(v,m);v=k.to;let L=fT(v,{relative:o}),R=Ui(),N=null;if(c){let Y=Lh(c,[],R.mask?R.mask.pathname:"/",!0);m!=="/"&&(Y.pathname=Y.pathname==="/"?m:Xi([m,Y.pathname])),N=b.createHref(Y)}let[A,B,V]=qT(s,T),U=nA(v,{replace:p,mask:c,state:h,target:d,preventScrollReset:g,relative:o,viewTransition:x,defaultShouldRevalidate:C,useTransitions:_});function W(Y){t&&t(Y),Y.defaultPrevented||U(Y)}let I=!(k.isExternal||f),X=M.createElement("a",{...T,...V,href:(I?N:void 0)||k.absoluteURL||L,onClick:I?W:t,ref:ZT(w,B),target:d,"data-discover":!S&&i==="render"?"true":void 0});return A&&!S?M.createElement(M.Fragment,null,X,M.createElement(KT,{page:L})):X});ql.displayName="Link";var rg=M.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:s="",end:o=!1,style:f,to:p,viewTransition:c,children:h,...d},v){let g=sc(p,{relative:d.relative}),x=Ui(),C=M.useContext(Mh),{navigator:T,basename:w}=M.useContext(ki),m=C!=null&&oA(g)&&c===!0,b=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,_=x.pathname,S=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;i||(_=_.toLowerCase(),S=S?S.toLowerCase():null,b=b.toLowerCase()),S&&w&&(S=Hr(S,w)||S);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let L=_===b||!o&&_.startsWith(b)&&_.charAt(k)==="/",R=S!=null&&(S===b||!o&&S.startsWith(b)&&S.charAt(b.length)==="/"),N={isActive:L,isPending:R,isTransitioning:m},A=L?t:void 0,B;typeof s=="function"?B=s(N):B=[s,L?"active":null,R?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let V=typeof f=="function"?f(N):f;return M.createElement(ql,{...d,"aria-current":A,className:B,ref:v,style:V,to:p,viewTransition:c},typeof h=="function"?h(N):h)});rg.displayName="NavLink";var eA=M.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:s,replace:o,state:f,method:p=Fu,action:c,onSubmit:h,relative:d,preventScrollReset:v,viewTransition:g,defaultShouldRevalidate:x,...C},T)=>{let{useTransitions:w}=M.useContext(ki),m=sA(),b=aA(c,{relative:d}),_=p.toLowerCase()==="get"?"get":"post",S=typeof c=="string"&&gx.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:v,viewTransition:g,defaultShouldRevalidate:x});w&&i!==!1?M.startTransition(()=>A()):A()};return M.createElement("form",{ref:T,method:_,action:b,onSubmit:s?h:k,...C,"data-discover":!S&&e==="render"?"true":void 0})});eA.displayName="Form";function tA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mx(e){let t=M.useContext(yo);return qt(t,tA(e)),t}function nA(e,{target:t,replace:i,mask:s,state:o,preventScrollReset:f,relative:p,viewTransition:c,defaultShouldRevalidate:h,useTransitions:d}={}){let v=Nh(),g=Ui(),x=sc(e,{relative:p});return M.useCallback(C=>{if(DT(C,t)){C.preventDefault();let T=i!==void 0?i:Gl(g)===Gl(x),w=()=>v(e,{replace:T,mask:s,state:o,preventScrollReset:f,relative:p,viewTransition:c,defaultShouldRevalidate:h});d?M.startTransition(()=>w()):w()}},[g,v,x,i,s,o,t,e,f,p,c,h,d])}var iA=0,rA=()=>`__${String(++iA)}__`;function sA(){let{router:e}=mx("useSubmit"),{basename:t}=M.useContext(ki),i=CT(),s=e.fetch,o=e.navigate;return M.useCallback(async(f,p={})=>{let{action:c,method:h,encType:d,formData:v,body:g}=BT(f,t);if(p.navigate===!1){let x=p.fetcherKey||rA();await s(x,i,p.action||c,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:v,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:v,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 aA(e,{relative:t}={}){let{basename:i}=M.useContext(ki),s=M.useContext(ur);qt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),f={...sc(e||".",{relative:t})},p=Ui();if(e==null){f.search=p.search;let c=new URLSearchParams(f.search),h=c.getAll("index");if(h.some(v=>v==="")){c.delete("index"),h.filter(g=>g).forEach(g=>c.append("index",g));let v=c.toString();f.search=v?`?${v}`:""}}return(!e||e===".")&&o.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(f.pathname=f.pathname==="/"?i:Xi([i,f.pathname])),Gl(f)}function oA(e,{relative:t}={}){let i=M.useContext(ox);qt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=mx("useViewTransitionState"),o=sc(e,{relative:t});if(!i.isTransitioning)return!1;let f=Hr(i.currentLocation.pathname,s)||i.currentLocation.pathname,p=Hr(i.nextLocation.pathname,s)||i.nextLocation.pathname;return ah(o.pathname,p)!=null||ah(o.pathname,f)!=null}var Es=JS();const lA="fleet-console.canvas.",Sm="fleet-console.canvas.backgroundAnimation",xm="fleet-console.canvas.perimeterAnimation",_x="fleet-console.canvas.maximized",cA=400,sg=640,ag=400,ib=40,rb=96,uA=.25,hA=1,ip=.2,sb=.5,dA=.001,eo={x:0,y:0,zoom:1},ao={viewport:eo,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},og=new Set,lg=new Set,cg=new Set,ug=new Set,hg=new Set,Kl=new Map;let Ci=null,ks=null,Ke=ao,oo=$A(),lo=WA(),zl=KA(),Yn=null,ws=eo,Js=null,lh=0;function wm(e){return og.add(e),()=>{og.delete(e)}}function po(){return Ke}function dg(){return Yn}function fA(){return Ci}function vx(){return M.useSyncExternalStore(wm,po,po)}function pA(){return M.useSyncExternalStore(AA,ob,ob)}function gA(){return M.useSyncExternalStore(RA,lb,lb)}function bx(){return M.useSyncExternalStore(LA,cb,cb)}function yx(){return M.useSyncExternalStore(MA,ub,ub)}function Sx(){return M.useSyncExternalStore(wm,hb,hb)}function Ei(e){Ke={viewport:e.viewport??Ke.viewport,operations:e.operations??Ke.operations,operationOrder:e.operationOrder??Ke.operationOrder,operationAccent:e.operationAccent??Ke.operationAccent,minimized:e.minimized??Ke.minimized,collapsedGroups:e.collapsedGroups??Ke.collapsedGroups},BA(),wx()}function mA(e){const t=Ke.collapsedGroups.includes(e)?Ke.collapsedGroups.filter(i=>i!==e):[...Ke.collapsedGroups,e];Ei({collapsedGroups:t})}function _A(){return M.useSyncExternalStore(wm,db,db)}function fg(e){Em();const t=km(e);ws=t,Ei({viewport:t})}function xx(e){const t=km(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||IA()){fg(t);return}ws=t,Js===null&&(Js=window.requestAnimationFrame(kx))}function pg(e,t){const i=ia();Ei({operations:{...Ke.operations,[e]:{...Tm(t,i),zIndex:i}}})}function vA(e){Ke.minimized.includes(e)||(Yn===e&&go(),Ei({minimized:[...Ke.minimized,e]}))}function bA(e){if(!Ke.minimized.includes(e))return;Yn===e&&go();const t=Ke.minimized.filter(o=>o!==e),i=Ke.operations[e];if(!i){Ei({minimized:t});return}const s=ia();Ei({minimized:t,operations:{...Ke.operations,[e]:{...i,zIndex:s}}})}function rp(e){Ei({operationOrder:Rx(e)})}function ia(){return lh+=1,lh}function yA(e){const t=Ke.operations[e];if(t)return t;const i=Object.keys(Ke.operations).length,s={x:i*ib,y:i*ib,width:sg,height:ag,zIndex:ia()};return Ei({operations:{...Ke.operations,[e]:s}}),s}function SA(e){const t=new Set(e),i={};let s=!1;for(const[v,g]of Object.entries(Ke.operations))t.has(v)?i[v]=g:s=!0;const o=Ke.minimized.filter(v=>t.has(v)),f=o.length!==Ke.minimized.length,p=Ke.operationOrder.filter(v=>t.has(v)),c=p.length!==Ke.operationOrder.length,h=Object.fromEntries(Object.entries(Ke.operationAccent).filter(([v])=>t.has(v))),d=Object.keys(h).length!==Object.keys(Ke.operationAccent).length;Yn&&(!t.has(Yn)||o.includes(Yn))&&go(),(s||f||c||d)&&Ei({operations:i,minimized:o,operationOrder:p,operationAccent:h})}function xA(e){PA(),Em(),OA(),Ci=e,Ke=e?HA(e):ao;const t=e?Kl.get(e)??null:null,i=Yn!==t;Yn=t,ws=Ke.viewport,lh=Math.max(lh,Lx(Ke.operations)),wx(),i&&Cm()}function ab(e,t){const i=Ke.operations[e];if(!i)return;const s=Math.max(uA,Math.min(hA,Math.min((t.width-rb)/i.width,(t.height-rb)/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};Em(),ws=o;const f=ia(),p=Ke.minimized.includes(e);Ei({viewport:o,operations:{...Ke.operations,[e]:{...Tm(i,f),zIndex:f}},...p?{minimized:Ke.minimized.filter(c=>c!==e)}:{}})}function wA(){oo=!oo,FA(oo),Cx()}function CA(){lo=!lo,qA(lo),Ex()}function EA(e){e==="local"&&(oo&&!UA()&&(oo=!1,Cx()),lo&&!GA()&&(lo=!1,Ex()))}function kA(){TA(!zl)}function TA(e){zl!==e&&(zl=e,VA(zl),NA())}function Hl(e){Ci&&Kl.set(Ci,e);const t=DA(e),i=!jA(Ke.minimized,t),s=Yn!==e;s&&(Yn=e),i&&Ei({minimized:t}),s&&Cm()}function go(){Ci&&Kl.delete(Ci),Yn!==null&&(Yn=null,Cm())}function AA(e){return lg.add(e),()=>{lg.delete(e)}}function ob(){return oo}function RA(e){return cg.add(e),()=>{cg.delete(e)}}function lb(){return lo}function wx(){for(const e of og)e()}function Cx(){for(const e of lg)e()}function Ex(){for(const e of cg)e()}function LA(e){return ug.add(e),()=>{ug.delete(e)}}function cb(){return zl}function MA(e){return hg.add(e),()=>{hg.delete(e)}}function ub(){return Yn}function hb(){return Ke.minimized}function db(){return Ke.collapsedGroups}function NA(){for(const e of ug)e()}function Cm(){for(const e of hg)e()}function OA(){Ci&&(Yn?Kl.set(Ci,Yn):Kl.delete(Ci))}function DA(e){return Object.keys(Ke.operations).filter(t=>t!==e)}function jA(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}function kx(){const e=Ke.viewport,t=ws.x-e.x,i=ws.y-e.y,s=ws.zoom-e.zoom;if(Math.abs(t)<sb&&Math.abs(i)<sb&&Math.abs(s)<dA){Js=null,Ei({viewport:ws});return}Ei({viewport:{x:e.x+t*ip,y:e.y+i*ip,zoom:e.zoom+s*ip}}),Js=typeof window<"u"?window.requestAnimationFrame(kx):null}function Em(){Js===null||typeof window>"u"||(window.cancelAnimationFrame(Js),Js=null)}function IA(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function BA(){!Ci||typeof window>"u"||(zA(),ks=window.setTimeout(()=>{ks=null,Tx(Ci,Ke)},cA))}function PA(){!ks||!Ci||typeof window>"u"||(window.clearTimeout(ks),ks=null,Tx(Ci,Ke))}function zA(){!ks||typeof window>"u"||(window.clearTimeout(ks),ks=null)}function HA(e){if(typeof window>"u")return ao;try{const t=window.localStorage.getItem(Ax(e));if(!t)return ao;const i=JSON.parse(t);return YA(i)}catch{return ao}}function Tx(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(Ax(e),JSON.stringify(t))}catch{}}function $A(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(Sm);return e===null?!0:e==="true"}catch{return!0}}function UA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Sm)!==null}catch{return!1}}function FA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Sm,String(e))}catch{}}function WA(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(xm);return e===null?!0:e==="true"}catch{return!0}}function GA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(xm)!==null}catch{return!1}}function qA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(xm,String(e))}catch{}}function KA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(_x)==="true"}catch{return!1}}function VA(e){if(!(typeof window>"u"))try{window.localStorage.setItem(_x,String(e))}catch{}}function Ax(e){return`${lA}${e}`}function YA(e){if(!mo(e))return ao;const t=JA(e.operations);return{viewport:km(e.viewport),operations:t,operationOrder:Rx(e.operationOrder),operationAccent:XA(e.operationAccent),minimized:ZA(e.minimized,t),collapsedGroups:e3(e.collapsedGroups)}}function Rx(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 XA(e){if(!mo(e))return{};const t={};for(const[i,s]of Object.entries(e))typeof s=="string"&&(t[i]=s);return t}function ZA(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 km(e){if(!mo(e))return eo;const t=$l(e.x,eo.x),i=$l(e.y,eo.y),s=gg(e.zoom,eo.zoom);return{x:t,y:i,zoom:s}}function JA(e){if(!mo(e))return{};const t={};for(const[i,s]of Object.entries(e))mo(s)&&(t[i]=Tm(s,QA(t)));return t}function Tm(e,t){return mo(e)?{x:$l(e.x,0),y:$l(e.y,0),width:gg(e.width,sg),height:gg(e.height,ag),zIndex:$l(e.zIndex,t)}:{x:0,y:0,width:sg,height:ag,zIndex:t}}function QA(e){return Lx(e)+1}function Lx(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function $l(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function gg(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function mo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function e3(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 t3=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class lt extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function n3(e){const t=await fetch("/api/v1/theaters",{signal:e});await ui(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new lt(t.status,"Invalid Theater response");return{theaters:i.theaters.map(s=>Ix(s,t.status))}}async function i3(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/status${i}`,{signal:t});return await ui(s),c3(await s.json(),s.status)}async function Mx(e={}){const t=e.force?"?force=true":"",i=await fetch(`/api/v1/updates/release-notes${t}`,{signal:e.signal});return await ui(i),h3(await i.json(),i.status)}async function r3(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await ui(t),u3(await t.json(),t.status)}async function Nx(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await ui(i);const s=await i.json();return Ix(s,i.status)}async function s3(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 ui(i),g3(await i.json(),i.status)}async function Ox(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 ui(i);const s=await i.json();if(typeof s.folderGrantId!="string")throw new lt(i.status,"Invalid folder grant response");return s.folderGrantId}async function a3(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ui(i)}async function Si(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/operations${i}`,{signal:t});await ui(s);const o=await s.json();if(!Array.isArray(o.operations))throw new lt(s.status,"Invalid operations response");return o.operations.map(f=>jx(f,s.status))}async function Nl(e,t){const s=await fetch("/api/v1/operations/groups",{signal:t});await ui(s);const o=await s.json();if(!Array.isArray(o.groups))throw new lt(s.status,"Invalid groups response");return o.groups.map(f=>Am(f,s.status))}async function o3(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await ui(i);const s=await i.json();return Am(s.group,i.status)}async function fb(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 ui(s);const o=await s.json();return Am(o.group,s.status)}async function l3(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ui(i)}async function Dx(e,t,i){return Gu(e,{title:t},i)}async function Gu(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 ui(s);const o=await s.json();return jx(o.operation,s.status)}function jx(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"||Vl(i)||Vl(i.payload))throw new lt(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 Am(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 lt(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function Ix(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"||Vl(i))throw new lt(t,"Invalid Theater response");return i}function c3(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 lt(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 u3(e,t){const i=e;if(!i||i.status!=="accepted")throw new lt(t,"Invalid update response");return{status:"accepted"}}function h3(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 lt(t,"Invalid release notes response");return{notes:i.notes.map(s=>d3(s,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function d3(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections))throw new lt(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(s=>f3(s,t))}}function f3(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 lt(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(s=>p3(s,t))}}function p3(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(s=>typeof s=="string")||typeof i.text!="string")throw new lt(t,"Invalid release notes response");return{packageTags:i.packageTags,text:i.text}}function g3(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)||Vl(i))throw new lt(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=>m3(s,t)),truncated:i.truncated===!0?!0:void 0}}function m3(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||Vl(i))throw new lt(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function Vl(e){if(!e||typeof e!="object")return!1;const t=e;return t3.some(i=>i in t)}async function ui(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 lt(e.status,t)}const _3="__unassigned__";function v3(e){const t=new Map(e.theaters.map(s=>[s.id,s])),i=[];for(const s of e.operations)s.theaterId&&i.push(S3(s,t.get(s.theaterId)));return i}function b3(e,t){const i=Bx(t);return i.length===0?e:e.filter(s=>{const o=x3(s);return i.every(f=>o.includes(f))})}function y3(e){const t=[],i=new Map;for(const s of e){const o=s.theaterId??_3,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 Bx(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function S3(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function x3(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const mg="fleet-console.activeTheaterId",Px="fleet-console.commissioningSeen",zx="fleet-console.whatsNewSeenVersion",Hx="fleet-console.notificationPreferences",$x=1,w3="maritime",Su={globalMute:!1,dnd:!1,mutedTheaterIds:{}},_g=new Set;let pb=0,vg=null,ze={connection:"connecting",connectionError:null,activeTheme:w3,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:Y3(),codexReader:null,codexReaderExpanded:!1};function bg(){return ze}function C3(e){return _g.add(e),()=>{_g.delete(e)}}function Ze(e){ze={...ze,...e},G3()}function E3(e){ze.operationsViewActive!==e&&Ze({operationsViewActive:e})}function Ux(e){T3(e),Ze({activeTheme:e})}function k3(e){EA(e.channel),Ze({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...Jx({...ze,version:e.version})})}function Fx(){Ze({releaseNotesLoading:!0,releaseNotesError:null})}function Wx(e){const t={...ze,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:ze.selectedReleaseNoteKey&&ew(e.notes,ze.selectedReleaseNoteKey)?ze.selectedReleaseNoteKey:Qx(e.notes)};Ze({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...Jx(t)})}function Gx(e){Ze({releaseNotesLoading:!1,releaseNotesError:e})}function T3(e){if(!(typeof document>"u")){if(e==="maritime"){document.documentElement.removeAttribute("data-theme");return}document.documentElement.setAttribute("data-theme",e)}}function A3(e){const t=Zx(e,ze.activeTheaterId);Ze({theaters:e,activeTheaterId:t})}function R3(e){A3(e.theaters)}function xi(e){Ze({operations:e,operationsHydrated:!0})}function L3(e){const t=ze.operations.findIndex(s=>s.id===e.id);if(t===-1)return;const i=[...ze.operations];i[t]=e,Ze({operations:i})}function Ol(e){Ze({groups:e})}function M3(e){jh(e),Ze({activeTheaterId:e})}function or(e){ze.activeOperationId!==e&&Ze({activeOperationId:e})}function N3(e,t){if(t==="idle"){qx(e);return}ze.operationStatus[e]!==t&&Ze({operationStatus:{...ze.operationStatus,[e]:t}})}function qx(e){if(!(e in ze.operationStatus))return;const t={...ze.operationStatus};delete t[e],Ze({operationStatus:t})}function O3(e){if(!e.operationId)return;const t=ze.operations.find(p=>p.id===e.operationId);if(!t)return;const i=t.theaterId??null,s=ze.theaters.find(p=>p.id===i)?.label??i??"Unknown",o=t.title,f=K3(e.kind);pb+=1,Ze({operationNotifications:{...ze.operationNotifications,[e.operationId]:{kind:f,operationId:e.operationId,theaterId:i,theaterLabel:s,operationLabel:o,lastRaisedSeq:pb}}})}function Kx(){Ze({addingTheater:!0,theaterError:null})}function Vx(e){const t=[e,...ze.theaters.filter(i=>i.id!==e.id)];jh(e.id),Ze({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function D3(){Ze({addingTheater:!1,theaterError:null})}function yg(e){Ze({addingTheater:!1,theaterError:e})}function Dh(e){const t=ze.operations.find(i=>i.id===e);t&&(jh(t.theaterId),Ze({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:Xx(ze.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function gb(){ze.pendingOperationFocus!==null&&Ze({pendingOperationFocus:null})}function j3(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 Yx(e,t){if(t.length===0)return[...e].sort(Sg);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:Sg(s,o)})}function I3(e,t,i,s=[]){const o=Yx(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 Sg(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function sp(){Ze({operationSearchOpen:!1})}function B3(){Ze({operationSearchOpen:!ze.operationSearchOpen})}function P3(){ze.releaseNotes.length===0||ze.whatsNewOpen||Ze({whatsNewOpen:!0,selectedReleaseNoteKey:ze.selectedReleaseNoteKey??Qx(ze.releaseNotes)})}function xu(){ze.whatsNewOpen&&(ze.automaticWhatsNewVersion&&Q3(ze.automaticWhatsNewVersion),Ze({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function mb(e){ew(ze.releaseNotes,e)&&Ze({selectedReleaseNoteKey:e})}function vl(){Z3(!0),ze.onboardingOpen&&Ze({onboardingOpen:!1})}function Br(e){Ze({codexReader:e,codexReaderExpanded:!1})}function qu(){ze.codexReader!==null&&Ze({codexReaderExpanded:!0})}function z3(){Ze({codexReaderExpanded:!1})}function _b(){Ze({codexReader:null,codexReaderExpanded:!1})}function vb(){if(ze.bootstrapped)return;const e=ze.theaters.length===0&&!X3();Ze({bootstrapped:!0,onboardingOpen:e?!0:ze.onboardingOpen})}function bb(e){const t=ze.theaters.filter(p=>p.id!==e),i=Zx(t,ze.activeTheaterId===e?null:ze.activeTheaterId),s=q3(ze.operationNotifications,e),o=new Set(ze.operations.filter(p=>p.theaterId===e).map(p=>p.id)),f=ze.activeOperationId&&o.has(ze.activeOperationId)?null:ze.activeOperationId;jh(i),Ze({theaters:t,activeTheaterId:i,activeOperationId:f,operationNotifications:s})}function H3(e){const t=Xx(ze.operationNotifications,e);t!==ze.operationNotifications&&Ze({operationNotifications:t})}function $3(e){const t={...ze.notificationPreferences,globalMute:e};Lm(t),Ze({notificationPreferences:t})}function U3(e){const t={...ze.notificationPreferences,dnd:e};Lm(t),Ze({notificationPreferences:t})}function F3(e){const t={...ze.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...ze.notificationPreferences,mutedTheaterIds:t};Lm(i),Ze({notificationPreferences:i})}function W3(e){return v3(e)}function G3(){for(const e of _g)e()}function Xx(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function q3(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 Zx(e,t){const i=new Set(e.map(o=>o.id)),s=V3();return s&&i.has(s)?s:t&&i.has(t)?t:e[0]?.id??null}function K3(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function Jx(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||J3()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:Rm(i.version,t)}}function Qx(e){return e[0]?Rm(e[0].version,0):null}function ew(e,t){return e.some((i,s)=>Rm(i.version,s)===t)}function Rm(e,t){return`${e}:${t}`}function V3(){if(typeof window>"u")return null;try{return window.localStorage.getItem(mg)}catch{return null}}function jh(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(mg,e):window.localStorage.removeItem(mg)}catch{}}function Y3(){if(typeof window>"u")return Su;try{const e=window.localStorage.getItem(Hx);if(!e)return Su;const t=JSON.parse(e);return eR(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Su}catch{return Su}}function X3(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Px)==="1"}catch{return!1}}function Z3(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(Px,"1")}catch{}}function J3(){if(vg!==null)return vg;if(typeof window>"u")return null;try{return window.localStorage.getItem(zx)}catch{return null}}function Q3(e){if(vg=e,!(typeof window>"u"))try{window.localStorage.setItem(zx,e)}catch{}}function Lm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Hx,JSON.stringify({version:$x,preferences:e}))}catch{}}function eR(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==$x||!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 wu="directory-browser-sectors";function tw({open:e,onCancel:t,onConfirm:i}){const[s,o]=M.useState(null),[f,p]=M.useState(null),[c,h]=M.useState(null),[d,v]=M.useState(""),[g,x]=M.useState(""),[C,T]=M.useState(0),w=M.useRef(null),m=M.useRef(null),b=async(Y,P)=>{p(Y),h(null),v(""),T(0);try{const G=await s3(Y,P);o(G)}catch(G){if(G instanceof DOMException&&G.name==="AbortError")return;h(G instanceof lt?G.message:String(G))}finally{p(null)}};M.useEffect(()=>{if(!e)return;const Y=new AbortController;return b(null,Y.signal),()=>Y.abort()},[e]),M.useEffect(()=>{e&&w.current?.focus()},[e,s?.path]);const _=s?.entries??[],S=M.useMemo(()=>{const Y=d.trim().toLowerCase();return Y===""?_:_.filter(P=>P.name.toLowerCase().includes(Y))},[_,d]),k=M.useMemo(()=>s?tR(s):[],[s]),L=s?yb(s.path):null,R=s?.roots??[],N=R.length>1,A=S.length===0?-1:Math.min(C,S.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 B=Y=>{Y.accessible&&f===null&&b(Y.path)},V=()=>{s?.parentPath!=null&&f===null&&b(s.parentPath)},U=()=>{const Y=g.trim();Y!==""&&f===null&&b(Y)},W=s?.path??null,I=A>=0?`${wu}-${A}`:void 0,X=Y=>{switch(Y.key){case"Escape":d!==""?v(""):t();return;case"ArrowDown":Y.preventDefault(),T(P=>Math.min(P+1,Math.max(S.length-1,0)));return;case"ArrowUp":Y.preventDefault(),T(P=>Math.max(P-1,0));return;case"Enter":{Y.preventDefault();const P=S[A];P&&B(P);return}case"Backspace":d===""&&(Y.preventDefault(),V());return;default:return}};return Es.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:X,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(rR,{})}),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(Y=>{const P=L!=null&&yb(Y)===L;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${P?"is-active":""}`,"aria-current":P?"location":void 0,disabled:f!==null,title:Y,onClick:()=>{f===null&&b(Y)},onKeyDown:G=>G.stopPropagation(),children:iR(Y)},Y)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:k.map((Y,P)=>{const G=P===k.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[P>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${G?"is-current":""}`,"aria-current":G?"location":void 0,disabled:G||f!==null,title:Y.path,onClick:()=>{b(Y.path)},children:Y.label})]},Y.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(aR,{})}),u.jsx("input",{ref:w,type:"text",className:"directory-browser-filter-input",placeholder:"Filter sectors…","aria-label":"Filter folders","aria-controls":wu,value:d,spellCheck:!1,autoComplete:"off",onChange:Y=>{v(Y.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:V,children:[u.jsx(oR,{}),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:Y=>x(Y.target.value),onKeyDown:Y=>{Y.stopPropagation(),Y.key==="Enter"&&(Y.preventDefault(),U())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:g.trim()===""||f!==null,onClick:U,onKeyDown:Y=>Y.stopPropagation(),children:"Go"})]}),c?u.jsx("p",{className:"directory-browser-error",role:"alert",children:c}):null,u.jsx("div",{className:"directory-browser-list",id:wu,role:"listbox","aria-label":"Folders","aria-busy":f!==null,"aria-activedescendant":I,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…"]}):S.length===0?u.jsx("p",{className:"directory-browser-state",children:d!==""?"No sectors match the filter.":"No sectors to advance into."}):S.map((Y,P)=>u.jsxs("div",{id:`${wu}-${P}`,"data-index":P,role:"option","aria-selected":P===A,"aria-disabled":!Y.accessible,className:`directory-browser-sector ${P===A?"is-active":""} ${Y.accessible?"":"is-locked"}`,title:Y.path,onClick:()=>{T(P),B(Y)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(sR,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:Y.name}),Y.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(lR,{})," Locked"]})]},Y.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:W??"",children:W??"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:W===null||f!==null,onClick:()=>W&&i(W),children:"Establish Theater"})]})]})]})]}),document.body)}function tR(e){if(nR(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 nR(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function yb(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function iR(e){return e.replace(/[\\/]+$/,"")||e}function rR(){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 sR(){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 aR(){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 oR(){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 lR(){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 cR=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function uR({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 v=s.current;s.current=null,v?.focus?.()}},[e.onboardingOpen]),M.useEffect(()=>{if(!e.onboardingOpen)return;const v=g=>{t||(g.key==="Escape"?(g.preventDefault(),vl()):g.key==="Tab"&&hR(g,f.current),g.stopImmediatePropagation())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const c=()=>{i(!0)},h=()=>{i(!1)},d=async v=>{i(!1),Kx();try{const g=await Ox(v),x=await Nx(g);Vx(x)}catch(g){yg(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:vl,"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(ql,{ref:v=>{o.current=v},className:"commissioning-primary-action",to:"/operations",onClick:vl,children:"Go to Operations →"}):u.jsx("button",{ref:v=>{o.current=v},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(ql,{className:"commissioning-secondary-link",to:"/operations",onClick:vl,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:vl,children:"Skip for now"})]})]}),u.jsx(tw,{open:t,onCancel:h,onConfirm:d})]})}function hR(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(cR)),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 dR="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",Sb="operation-search-listbox",nw="__unassigned__";function fR({state:e}){const t=Nh(),[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),v=M.useMemo(()=>W3(e),[e]),g=M.useMemo(()=>b3(v,i),[v,i]),x=M.useMemo(()=>y3(g),[g]),C=M.useMemo(()=>Bx(i),[i]),T=xb(o,g.length),w=g[T]?wb(g[T].operationId):void 0;if(M.useEffect(()=>{if(!e.operationSearchOpen)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const _=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=_,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 _=g[T];_&&d.current.get(_.operationId)?.scrollIntoView({block:"nearest"})},[T,g,e.operationSearchOpen]),!e.operationSearchOpen)return null;const m=_=>{Dh(_),t("/operations"),sp()},b=_=>{if(_.key==="Escape"){_.preventDefault(),sp();return}if(_.key==="ArrowDown"||_.key==="ArrowUp"){_.preventDefault(),f(S=>xb(S+(_.key==="ArrowDown"?1:-1),g.length));return}if(_.key==="Enter"){const S=g[T];if(!S)return;_.preventDefault(),m(S.operationId);return}_.key==="Tab"&&_R(_,c.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:_=>{_.target===_.currentTarget&&sp()},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(vR,{}),u.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:i,onChange:_=>s(_.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":Sb,"aria-activedescendant":w,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:Sb,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:x.length>0?x.map(_=>{const S=gR(_.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":S,children:[u.jsx("h2",{id:S,className:"operation-search-section-heading",children:ap(_.theaterLabel,C)}),_.entries.map(k=>{const L=g.indexOf(k),R=L===T;return u.jsxs("button",{id:wb(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:ap(k.operationName,C)}),u.jsx("small",{children:pR(k)})]}),u.jsx("span",{className:"operation-search-theater",children:ap(k.theaterLabel,C)})]},k.operationId)})]},_.theaterId??nw)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function xb(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function pR(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function gR(e){return`operation-search-heading-${iw(e??nw)}`}function wb(e){return`operation-search-option-${iw(e)}`}function iw(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function ap(e,t){if(t.length===0)return e;const i=[];let s=0;for(;s<e.length;){const o=mR(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 mR(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 _R(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(dR)).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 vR(){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"})})}function bR({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}function yR({state:e}){if(e.releaseNotesLoading||e.releaseNotes.length===0||e.releaseNotesError&&!e.releaseNotesStale)return null;const t=e.releaseNotes.find(s=>s.version===e.version),i=t&&e.version?` v${t.version}`:"";return u.jsx("button",{type:"button",className:"topbar-whatsnew-button",onMouseDown:s=>s.preventDefault(),onClick:P3,"aria-label":`What's new${i}`,title:`What's new${i}`,children:u.jsx("span",{children:"What's new"})})}const SR=1400,xR="https://github.com/sbluemin/fleet-harness",wR="https://github.com/sbluemin/fleet-harness/stargazers",CR="https://api.github.com/repos/sbluemin/fleet-harness",Mm="fleet-console.github-stars",ER=360*60*1e3;function kR({state:e}){const t=e.connectionError!==null,i=Ui().pathname,s=i.startsWith("/carrier-settings")?u.jsx(Eb,{}):i.startsWith("/settings")?u.jsx(Cb,{}):i.startsWith("/operations")?u.jsx(FR,{}):u.jsx(UR,{});return u.jsxs("header",{className:"topbar",children:[u.jsxs("div",{className:"topbar-lead",children:[u.jsxs(ql,{className:"topbar-brand",to:"/operations","aria-label":"Operations로 이동",children:[u.jsx("span",{className:`topbar-sigil ${t?"is-alert":""}`,"aria-hidden":"true",title:e.connectionError??void 0,children:s}),u.jsxs("h1",{className:"topbar-title",children:["Fleet",u.jsx("span",{className:"topbar-title-thin",children:"Console"})]})]}),u.jsxs("span",{className:"topbar-preview-badge",children:[u.jsx("span",{className:"topbar-preview-label",children:"Research Preview"}),e.version?u.jsxs("span",{className:"topbar-preview-version",children:["v",e.version]}):null]}),u.jsx(NR,{}),u.jsx(yR,{state:e})]}),u.jsx(MR,{state:e}),u.jsxs("div",{className:"topbar-meta",children:[e.updateAvailable?u.jsx(TR,{latestVersion:e.latestVersion}):null,u.jsxs(rg,{to:"/carrier-settings",className:({isActive:o})=>`topbar-nav-link ${o?"is-active":""}`,title:"Carrier settings",children:[u.jsx("span",{className:"topbar-nav-icon","aria-hidden":"true",children:u.jsx(Eb,{})}),u.jsx("span",{children:"Carriers"})]}),u.jsxs(rg,{to:"/settings",className:({isActive:o})=>`topbar-nav-link ${o?"is-active":""}`,title:"Settings",children:[u.jsx("span",{className:"topbar-nav-icon","aria-hidden":"true",children:u.jsx(Cb,{})}),u.jsx("span",{children:"Settings"})]})]})]})}function TR({latestVersion:e}){const[t,i]=M.useState("idle"),[s,o]=M.useState(null),f=M.useRef(null),p=AR(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 r3()).status!=="accepted"){i("error"),o("invalid_response");return}i("accepted"),f.current=window.setTimeout(()=>{f.current=null,i("completed")},SR)}catch(h){const d=h instanceof lt?h.message:"network_error";o(d),i(LR(d)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`topbar-update-badge topbar-update-badge--${p.tone}`,onClick:c,disabled:p.disabled,title:p.title,"aria-live":"polite",children:p.label})}function AR(e,t,i){const s=i?`최신 버전 ${i}`:"업데이트 가능";return e==="applying"?{label:"요청 중",title:"업데이트 적용 요청을 보내는 중입니다.",tone:"live",disabled:!0}:e==="accepted"?{label:"업데이트 중",title:"서버가 곧 재시작되고 새 창에서 콘솔을 엽니다.",tone:"live",disabled:!0}:e==="completed"?{label:"완료: 새 창에서 계속",title:"새 창에서 재시작된 콘솔을 계속 사용하세요.",tone:"live",disabled:!0}:e==="blocked"?RR(t):e==="error"?{label:"재시도",title:"업데이트 요청에 실패했습니다. 다시 시도할 수 있습니다.",tone:"error",disabled:!1}:{label:"Update available",title:s,tone:"warn",disabled:!1}}function RR(e){return e==="local_channel"?{label:"로컬 빌드",title:"로컬 개발 빌드는 콘솔에서 업데이트하지 않습니다.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"이미 진행 중",title:"다른 업데이트 적용이 이미 진행 중입니다.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"업데이트 없음",title:"서버 재확인 결과 적용할 업데이트가 없습니다.",tone:"blocked",disabled:!0}:{label:"콘솔 준비 안 됨",title:"콘솔이 업데이트를 시작할 준비가 되지 않았습니다. 잠시 뒤 다시 시도하세요.",tone:"error",disabled:!1}}function LR(e){return e==="local_channel"||e==="update_already_in_progress"||e==="update_not_available"}function MR({state:e}){const[t,i]=M.useState(!1),[s,o]=M.useState(!1),f=M.useRef(null),p=M.useRef(null),c=M.useRef(null),h=e.theaters.find(m=>m.id===e.activeTheaterId)??null,d=h?.label??(e.theaters.length===0?"No Theaters":"Theater");M.useEffect(()=>{if(!t)return;const m=_=>{f.current?.contains(_.target)||i(!1)},b=_=>{_.key==="Escape"&&(i(!1),p.current?.focus())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",b)}},[t]),M.useEffect(()=>{if(!t)return;const m=c.current;if(!m)return;(m.querySelector('[data-active="true"]')??m.querySelector("[role^='menuitem']"))?.focus()},[t]);const v=m=>{M3(m),i(!1),p.current?.focus()},g=async()=>{i(!1),o(!0)},x=()=>{o(!1),D3()},C=async m=>{o(!1),Kx();try{const b=await Ox(m),_=await Nx(b);Vx(_)}catch(b){yg(b instanceof Error?b.message:String(b))}},T=async()=>{if(h){i(!1);try{await a3(h.id),bb(h.id)}catch(m){if(m instanceof lt&&m.status===404){bb(h.id);return}yg(m instanceof Error?m.message:String(m))}}},w=m=>{if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const b=Array.from(c.current?.querySelectorAll("[role^='menuitem']")??[]);if(b.length===0)return;const _=b.indexOf(document.activeElement),S=m.key==="ArrowDown"?1:-1,k=(_+S+b.length)%b.length;b[k]?.focus()};return u.jsxs("div",{className:"theater-control",ref:f,children:[u.jsx("span",{className:"theater-eyebrow","aria-hidden":"true",children:"Theater"}),u.jsxs("button",{type:"button",ref:p,className:`theater-trigger ${t?"is-open":""}`,"aria-haspopup":"menu","aria-expanded":t,"aria-label":"Theater",title:h?.label??e.theaterError??void 0,onClick:()=>i(m=>!m),children:[u.jsx("span",{className:"theater-trigger-sigil","aria-hidden":"true",children:u.jsx(PR,{})}),u.jsx("span",{className:"theater-trigger-label",children:d}),u.jsx("span",{className:"theater-trigger-caret","aria-hidden":"true",children:u.jsx(zR,{})})]}),t?u.jsxs("div",{className:"theater-menu",role:"menu","aria-label":"Theater",ref:c,onKeyDown:w,children:[e.theaters.length>0?u.jsx("ul",{className:"theater-menu-list",children:e.theaters.map(m=>{const b=m.id===e.activeTheaterId;return u.jsx("li",{children:u.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":b,"data-active":b?"true":void 0,className:`theater-menu-item ${b?"is-active":""}`,title:m.label,onClick:()=>v(m.id),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:b?u.jsx(HR,{}):null}),u.jsx("span",{className:"theater-menu-label",children:m.label})]})},m.id)})}):u.jsx("p",{className:"theater-menu-empty",children:"No Theaters yet."}),u.jsx("div",{className:"theater-menu-divider",role:"separator"}),h?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:T,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx($R,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]}),u.jsx("div",{className:"theater-menu-divider",role:"separator"})]}):null,u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-add",disabled:e.addingTheater,onClick:g,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(WR,{})}),u.jsx("span",{className:"theater-menu-label",children:e.addingTheater?"Adding Theater…":"Add Theater…"})]}),e.theaterError?u.jsx("p",{className:"theater-menu-error",children:e.theaterError}):null]}):null,u.jsx(tw,{open:s,onCancel:x,onConfirm:C})]})}function NR(){const e=OR(),t=e.count!==null;return u.jsxs("div",{className:"topbar-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"topbar-github-link",href:xR,target:"_blank",rel:"noopener noreferrer","aria-label":"GitHub 저장소 열기",title:"GitHub 저장소",children:u.jsx(GR,{})}),u.jsxs("a",{className:"topbar-github-stars",href:wR,target:"_blank",rel:"noopener noreferrer","aria-label":t?`GitHub 스타 ${e.count.toLocaleString()}개 — 스타 누르기`:"GitHub에서 스타 누르기",title:"GitHub에서 스타 누르기",children:[u.jsx(qR,{}),t?u.jsx("span",{className:"topbar-github-stars-count",children:BR(e.count)}):null]})]})}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(CR,{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(Mm);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(Mm);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<ER}catch{return!1}}function IR(e){try{window.localStorage.setItem(Mm,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:"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 zR(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.5 6.5 8 10l3.5-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function HR(){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 $R(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.7 4.7 11.3 11.3M11.3 4.7 4.7 11.3",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function UR(){return u.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16",children:[u.jsx("path",{d:"M8 1.8 9.5 6.5 14.2 8 9.5 9.5 8 14.2 6.5 9.5 1.8 8 6.5 6.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),u.jsx("path",{d:"M8 4.7 8.7 7.3 11.3 8 8.7 8.7 8 11.3 7.3 8.7 4.7 8 7.3 7.3Z",fill:"currentColor"})]})}function FR(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"5.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M8 3.7v2.1M8 10.2v2.1M3.7 8h2.1M10.2 8h2.1M8 8l3.1-2.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"})]})}function Cb(){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 Eb(){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 WR(){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.4",strokeLinecap:"round"})})}function GR(){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 qR(){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"})})}const KR=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),bl=10;function VR({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(),xu()):m.key==="Tab"&&ZR(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??Fa(e.releaseNotes[0]?.version??"",0),p=e.releaseNotes.findIndex((w,m)=>Fa(w.version,m)===f),c=e.releaseNotes[p]??e.releaseNotes[0],h=Fa(c.version,p>=0?p:0),d=()=>{Fx(),Mx({force:!0}).then(Wx).catch(w=>Gx(w instanceof Error?w.message:String(w)))},v=Math.max(1,Math.ceil(e.releaseNotes.length/bl)),g=Math.min(v-1,Math.floor((p>=0?p:0)/bl)),x=g*bl,C=e.releaseNotes.slice(x,x+bl),T=w=>{const m=g+w;if(m<0||m>=v)return;const b=m*bl,_=e.releaseNotes[b];_&&mb(Fa(_.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:xu,"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:xu,"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=>mb(w.currentTarget.value),children:C.map((w,m)=>{const b=x+m;return u.jsxs("option",{value:Fa(w.version,b),children:[w.version==="Unreleased"?"Unreleased":`v${w.version}`,w.date?` · ${w.date}`:""]},Fa(w.version,b))})}),v>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," / ",v]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>T(1),disabled:g>=v-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(YR,{section:w,index:m},w.heading))]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:xu,children:"Close"})})]})]})}function YR({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(XR,{item:o})},`${o.text}:${f}`))})]})}function XR({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 Fa(e,t){return`${e}:${t}`}function ZR(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(KR)),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 $r(){return M.useSyncExternalStore(C3,bg,bg)}function Ih(e=()=>{}){return{...XS(e),notifications:{emit:i=>O3(i),dismiss:i=>H3(i)},status:{set:(i,s)=>N3(i,s),clear:i=>qx(i)}}}const kb=250,JR=5e3,Tb=1,QR=1013,eL=4e3,tL=4001;function nL(e){const t=new AbortController,i=new TextEncoder;let s=kb,o=null,f=null,p=null,c=!1;const h=()=>{f?.dispose(),f=null},d=(x,C)=>{p={cols:x,rows:C},o?.readyState===Tb&&o.send(JSON.stringify({type:"resize",cols:x,rows:C}))},v=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:x}=await rL(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await g(iL(x,e.location,e.wsPath),e),s=kb}catch(x){if(t.signal.aborted)return;e.onStatus?.("connecting",x instanceof Error?x.message:String(x))}await aL(s,t.signal),s=Math.min(s*2,JR)}},g=async(x,C)=>{await new Promise((T,w)=>{const m=(C.webSocketFactory??sL)(x);o=m,m.binaryType="arraybuffer",m.onopen=()=>{C.onStatus?.("live"),h(),f=C.terminal.onData(b=>{m.readyState===Tb&&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 _=b?.code;_===eL?(t.abort(),C.onStatus?.("closed","terminal_replaced")):_===tL?(t.abort(),C.onStatus?.("closed","terminal_closed"),C.onExit?.()):_===QR&&(t.abort(),C.onStatus?.("closed","terminal_unavailable")),T()}})};return{start:()=>{c||(c=!0,v())},resize:d,dispose:()=>{t.abort(),h(),e.onStatus?.("closed"),o?.close(),o=null}}}function iL(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function rL(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 sL(e){return new WebSocket(e)}async function aL(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}var op={exports:{}},Ab;function oL(){return Ab||(Ab=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"))),v=window.getComputedStyle(this._terminal.element),g=h-(parseInt(v.getPropertyValue("padding-top"))+parseInt(v.getPropertyValue("padding-bottom"))),x=d-(parseInt(v.getPropertyValue("padding-right"))+parseInt(v.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(x/f.css.cell.width)),rows:Math.max(1,Math.floor(g/f.css.cell.height))}}}})(),i})()))})(op)),op.exports}var lL=oL(),Ku={exports:{}},cL=Ku.exports,Rb;function uL(){return Rb||(Rb=1,(function(e,t){(function(i,s){e.exports=s()})(cL,(()=>(()=>{var i={433:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV11=void 0;const d=h(938),v=[[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]],x=[[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 _,S=0,k=b.length-1;if(m<b[0][0]||m>b[k][1])return!1;for(;k>=S;)if(_=S+k>>1,m>b[_][1])S=_+1;else{if(!(m<b[_][0]))return!0;k=_-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<v.length;++m)T.fill(0,v[m][0],v[m][1]+1);for(let m=0;m<x.length;++m)T.fill(2,x[m][0],x[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 _=this.wcwidth(m),S=_===0&&b!==0;if(S){const k=d.UnicodeService.extractWidth(b);k===0?S=!1:k>_&&(_=k)}return d.UnicodeService.createPropertyValue(0,_,S)}}},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 v=[];for(let g=0;g<this._listeners.length;g++)v.push(this._listeners[g]);for(let g=0;g<v.length;g++)v[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((v=>d.fire(v)))},c.runAndSubscribe=function(h,d){return d(void 0),h((v=>d(v)))}},490:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const d=h(938),v=[[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 x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let C=0;C<v.length;++C)x.fill(0,v[C][0],v[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?x[C]:(function(T,w){let m,b=0,_=w.length-1;if(T<w[0][0]||T>w[_][1])return!1;for(;_>=b;)if(m=b+_>>1,T>w[m][1])b=m+1;else{if(!(T<w[m][0]))return!0;_=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),v=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 v.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 _=C.charCodeAt(b);if(55296<=_&&_<=56319){if(++b>=m)return T+this.wcwidth(_);const L=C.charCodeAt(b);56320<=L&&L<=57343?_=1024*(_-55296)+L-56320+65536:T+=this.wcwidth(L)}const S=this.charProperties(_,w);let k=g.extractWidth(S);g.extractShouldJoin(S)&&(k-=g.extractWidth(w)),T+=k,w=S}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})()))})(Ku)),Ku.exports}var hL=uL();var dL=(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},fL=(e,t)=>(i,s)=>t(i,s,e),pL=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Lb.isErrorNoTelemetry(e)?new Lb(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)}},gL=new pL;function lp(e){mL(e)||gL.onUnexpectedError(e)}var xg="Canceled";function mL(e){return e instanceof _L?!0:e instanceof Error&&e.name===xg&&e.message===xg}var _L=class extends Error{constructor(){super(xg),this.name=this.message}},Lb=class wg extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof wg)return t;let i=new wg;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},vL;(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})(vL||={});function bL(e,t){let i=this,s=!1,o;return function(){return s||(s=!0,t||(o=e.apply(i,arguments))),o}}var rw;(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 v(k,L){let R=0;for(let N of k)if(L(N,R++))return!0;return!1}e.some=v;function g(k,L){for(let R of k)if(L(R))return R}e.find=g;function*x(k,L){for(let R of k)L(R)&&(yield R)}e.filter=x;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 _(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 B=N.next();if(B.done)return[R,e.empty()];R.push(B.value)}return[R,{[Symbol.iterator](){return N}}]}e.consume=_;async function S(k){let L=[];for await(let R of k)L.push(R);return Promise.resolve(L)}e.asyncToArray=S})(rw||={});function sw(e){if(rw.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 aw(...e){return $n(()=>sw(e))}function $n(e){return{dispose:bL(()=>{e()})}}var ow=class lw{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{sw(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?lw.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)}};ow.DISABLE_DISPOSED_WARNING=!1;var co=ow,Ji=class{constructor(){this._store=new co,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)}};Ji.None=Object.freeze({dispose(){}});var yl=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}},Nm=typeof process<"u"&&"title"in process,Bh=Nm?"node":navigator.userAgent,yL=Nm?"node":navigator.platform,SL=Bh.includes("Firefox"),xL=Bh.includes("Edge"),cw=/^((?!chrome|android).)*safari/i.test(Bh);function wL(){if(!cw)return 0;let e=Bh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}yL.indexOf("Linux")>=0;var CL="",wn=0,Cn=0,En=0,an=0,Bi={css:"#00000000",rgba:0},Kn;(e=>{function t(o,f,p,c){return c!==void 0?`#${Ks(o)}${Ks(f)}${Ks(p)}${Ks(c)}`:`#${Ks(o)}${Ks(f)}${Ks(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})(Kn||={});var Dl;(e=>{function t(h,d){if(an=(d.rgba&255)/255,an===1)return{css:d.css,rgba:d.rgba};let v=d.rgba>>24&255,g=d.rgba>>16&255,x=d.rgba>>8&255,C=h.rgba>>24&255,T=h.rgba>>16&255,w=h.rgba>>8&255;wn=C+Math.round((v-C)*an),Cn=T+Math.round((g-T)*an),En=w+Math.round((x-w)*an);let m=Kn.toCss(wn,Cn,En),b=Kn.toRgba(wn,Cn,En);return{css:m,rgba:b}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,d,v){let g=Qs.ensureContrastRatio(h.rgba,d.rgba,v);if(g)return Kn.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=s;function o(h){let d=(h.rgba|255)>>>0;return[wn,Cn,En]=Qs.toChannels(d),{css:Kn.toCss(wn,Cn,En),rgba:d}}e.opaque=o;function f(h,d){return an=Math.round(d*255),[wn,Cn,En]=Qs.toChannels(h.rgba),{css:Kn.toCss(wn,Cn,En,an),rgba:Kn.toRgba(wn,Cn,En,an)}}e.opacity=f;function p(h,d){return an=h.rgba&255,f(h,an*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 EL;(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 wn=parseInt(o.slice(1,2).repeat(2),16),Cn=parseInt(o.slice(2,3).repeat(2),16),En=parseInt(o.slice(3,4).repeat(2),16),Kn.toColor(wn,Cn,En);case 5:return wn=parseInt(o.slice(1,2).repeat(2),16),Cn=parseInt(o.slice(2,3).repeat(2),16),En=parseInt(o.slice(3,4).repeat(2),16),an=parseInt(o.slice(4,5).repeat(2),16),Kn.toColor(wn,Cn,En,an);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 wn=parseInt(f[1]),Cn=parseInt(f[2]),En=parseInt(f[3]),an=Math.round((f[5]===void 0?1:parseFloat(f[5]))*255),Kn.toColor(wn,Cn,En,an);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),[wn,Cn,En,an]=t.getImageData(0,0,1,1).data,an!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Kn.toRgba(wn,Cn,En,an),css:o}}e.toColor=s})(EL||={});var Wn;(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),v=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+v*.7152+g*.0722}e.relativeLuminance2=i})(Wn||={});var Qs;(e=>{function t(p,c){if(an=(c&255)/255,an===1)return c;let h=c>>24&255,d=c>>16&255,v=c>>8&255,g=p>>24&255,x=p>>16&255,C=p>>8&255;return wn=g+Math.round((h-g)*an),Cn=x+Math.round((d-x)*an),En=C+Math.round((v-C)*an),Kn.toRgba(wn,Cn,En)}e.blend=t;function i(p,c,h){let d=Wn.relativeLuminance(p>>8),v=Wn.relativeLuminance(c>>8);if(Nr(d,v)<h){if(v<d){let C=s(p,c,h),T=Nr(d,Wn.relativeLuminance(C>>8));if(T<h){let w=o(p,c,h),m=Nr(d,Wn.relativeLuminance(w>>8));return T>m?C:w}return C}let g=o(p,c,h),x=Nr(d,Wn.relativeLuminance(g>>8));if(x<h){let C=s(p,c,h),T=Nr(d,Wn.relativeLuminance(C>>8));return x>T?g:C}return g}}e.ensureContrastRatio=i;function s(p,c,h){let d=p>>24&255,v=p>>16&255,g=p>>8&255,x=c>>24&255,C=c>>16&255,T=c>>8&255,w=Nr(Wn.relativeLuminance2(x,C,T),Wn.relativeLuminance2(d,v,g));for(;w<h&&(x>0||C>0||T>0);)x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),T-=Math.max(0,Math.ceil(T*.1)),w=Nr(Wn.relativeLuminance2(x,C,T),Wn.relativeLuminance2(d,v,g));return(x<<24|C<<16|T<<8|255)>>>0}e.reduceLuminance=s;function o(p,c,h){let d=p>>24&255,v=p>>16&255,g=p>>8&255,x=c>>24&255,C=c>>16&255,T=c>>8&255,w=Nr(Wn.relativeLuminance2(x,C,T),Wn.relativeLuminance2(d,v,g));for(;w<h&&(x<255||C<255||T<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),w=Nr(Wn.relativeLuminance2(x,C,T),Wn.relativeLuminance2(d,v,g));return(x<<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})(Qs||={});function Ks(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Nr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function mn(e){if(!e)throw new Error("value must not be falsy");return e}function Om(e){return 57508<=e&&e<=57558}function kL(e){return 57520<=e&&e<=57527}function TL(e){return 57344<=e&&e<=63743}function AL(e){return 9472<=e&&e<=9631}function RL(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 LL(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!RL(e)&&!Om(e)&&!TL(e)}function uw(e){return Om(e)||AL(e)}function ML(){return{css:{canvas:Cu(),cell:Cu()},device:{canvas:Cu(),cell:Cu(),char:{width:0,height:0,left:0,top:0}}}}function Cu(){return{width:0,height:0}}function NL(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var jn=0,xn=0,sr=!1,Or=!1,Eu=!1,li,cp=0,OL=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,xn=0,jn=0,Or=!1,sr=!1,Eu=!1,li=this._themeService.colors,cp=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));cp=t*s%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",o=>{o.backgroundColorRGB&&(xn=o.backgroundColorRGB.rgba>>8&16777215,Or=!0),o.foregroundColorRGB&&(jn=o.foregroundColorRGB.rgba>>8&16777215,sr=!0)}),Eu=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Eu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:xn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:xn=(this.result.fg&16777215)<<8|255;break;default:xn=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:xn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:xn=(this.result.bg&16777215)<<8|255;break}xn=Qs.blend(xn,(this._coreBrowserService.isFocused?li.selectionBackgroundOpaque:li.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else xn=(this._coreBrowserService.isFocused?li.selectionBackgroundOpaque:li.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Or=!0,li.selectionForeground&&(jn=li.selectionForeground.rgba>>8&16777215,sr=!0),uw(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)jn=(this._coreBrowserService.isFocused?li.selectionBackgroundOpaque:li.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:jn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:jn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:jn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:jn=(this.result.fg&16777215)<<8|255;break;default:jn=this._themeService.colors.foreground.rgba}jn=Qs.blend(jn,(this._coreBrowserService.isFocused?li.selectionBackgroundOpaque:li.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}sr=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",o=>{o.backgroundColorRGB&&(xn=o.backgroundColorRGB.rgba>>8&16777215,Or=!0),o.foregroundColorRGB&&(jn=o.foregroundColorRGB.rgba>>8&16777215,sr=!0)}),Or&&(Eu?xn=e.bg&-16777216&-134217729|xn|50331648:xn=e.bg&-16777216|xn|50331648),sr&&(jn=e.fg&-16777216&-67108865|jn|50331648),this.result.fg&67108864&&(Or&&!sr&&((this.result.bg&50331648)===0?jn=this.result.fg&-134217728|li.background.rgba>>8&16777215&16777215|50331648:jn=this.result.fg&-134217728|this.result.bg&67108863,sr=!0),!Or&&sr&&((this.result.fg&50331648)===0?xn=this.result.bg&-67108864|li.foreground.rgba>>8&16777215&16777215|50331648:xn=this.result.bg&-67108864|this.result.fg&67108863,Or=!0)),li=void 0,this.result.bg=Or?xn:this.result.bg,this.result.fg=sr?jn:this.result.fg,this.result.ext&=536870911,this.result.ext|=cp<<29&3758096384}},DL=.5,hw=SL||xL?"bottom":"ideographic",jL={"▀":[{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}]},IL={"░":[[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]]},BL={"─":{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`}},Yl={"":{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}};Yl[""]=Yl[""];Yl[""]=Yl[""];function PL(e,t,i,s,o,f,p,c){let h=jL[t];if(h)return zL(e,h,i,s,o,f),!0;let d=IL[t];if(d)return HL(e,d,i,s,o,f),!0;let v=BL[t];if(v)return $L(e,v,i,s,o,f,c),!0;let g=Yl[t];return g?(UL(e,g,i,s,o,f,p,c),!0):!1}function zL(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 Mb=new Map;function HL(e,t,i,s,o,f){let p=Mb.get(t);p||(p=new Map,Mb.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,v=t.length,g=e.canvas.ownerDocument.createElement("canvas");g.width=d,g.height=v;let x=mn(g.getContext("2d")),C=new ImageData(d,v),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(_=>parseFloat(_));else throw new Error(`Unexpected fillStyle color format "${c}" when drawing pattern glyph`);for(let _=0;_<v;_++)for(let S=0;S<d;S++)C.data[(_*d+S)*4]=T,C.data[(_*d+S)*4+1]=w,C.data[(_*d+S)*4+2]=m,C.data[(_*d+S)*4+3]=t[_][S]*(b*255);x.putImageData(C,0,0),h=mn(e.createPattern(g,null)),p.set(c,h)}e.fillStyle=h,e.fillRect(i,s,o,f)}function $L(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 v=.15/f*o;d=h(.15,v)}else d=h;for(let v of d.split(" ")){let g=v[0],x=dw[g];if(!x){console.error(`Could not find drawing instructions for "${g}"`);continue}let C=v.substring(1).split(",");!C[0]||!C[1]||x(e,fw(C,o,f,i,s,!0,p))}e.stroke(),e.closePath()}}function UL(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 v of t.d.split(" ")){let g=v[0],x=dw[g];if(!x){console.error(`Could not find drawing instructions for "${g}"`);continue}let C=v.substring(1).split(",");!C[0]||!C[1]||x(e,fw(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 Nb(e,t,i=0){return Math.max(Math.min(e,t),i)}var dw={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 fw(e,t,i,s,o,f,p,c=0,h=0){let d=e.map(v=>parseFloat(v)||parseInt(v));if(d.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<d.length;v+=2)d[v]*=t-c*p-h*p,f&&d[v]!==0&&(d[v]=Nb(Math.round(d[v]+.5)-.5,t,0)),d[v]+=s+c*p;for(let v=1;v<d.length;v+=2)d[v]*=i,f&&d[v]!==0&&(d[v]=Nb(Math.round(d[v]+.5)-.5,i,0)),d[v]+=o;return d}var Ob=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={}}},Db=class{constructor(){this._data=new Ob}set(e,t,i,s,o){this._data.get(e,t)||this._data.set(e,t,new Ob),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()}},pw=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()}},FL=class extends pw{_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())}}},WL=class extends pw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},GL=!Nm&&"requestIdleCallback"in window?WL:FL,to=class gw{constructor(){this.fg=0,this.bg=0,this.extended=new mw}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 gw;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}},mw=class _w{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 _w(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},qL=globalThis.performance&&typeof globalThis.performance.now=="function",KL=class vw{static create(t){return new vw(t)}constructor(t){this._now=qL&&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}},Pr;(e=>{e.None=()=>Ji.None;function t(W,I){return g(W,()=>{},0,void 0,!0,void 0,I)}e.defer=t;function i(W){return(I,X=null,Y)=>{let P=!1,G;return G=W(K=>{if(!P)return G?G.dispose():P=!0,I.call(X,K)},null,Y),P&&G.dispose(),G}}e.once=i;function s(W,I,X){return d((Y,P=null,G)=>W(K=>Y.call(P,I(K)),null,G),X)}e.map=s;function o(W,I,X){return d((Y,P=null,G)=>W(K=>{I(K),Y.call(P,K)},null,G),X)}e.forEach=o;function f(W,I,X){return d((Y,P=null,G)=>W(K=>I(K)&&Y.call(P,K),null,G),X)}e.filter=f;function p(W){return W}e.signal=p;function c(...W){return(I,X=null,Y)=>{let P=aw(...W.map(G=>G(K=>I.call(X,K))));return v(P,Y)}}e.any=c;function h(W,I,X,Y){let P=X;return s(W,G=>(P=I(P,G),P),Y)}e.reduce=h;function d(W,I){let X,Y={onWillAddFirstListener(){X=W(P.fire,P)},onDidRemoveLastListener(){X?.dispose()}},P=new $t(Y);return I?.add(P),P.event}function v(W,I){return I instanceof Array?I.push(W):I&&I.add(W),W}function g(W,I,X=100,Y=!1,P=!1,G,K){let j,z,D,F=0,J,ne={leakWarningThreshold:G,onWillAddFirstListener(){j=W(re=>{F++,z=I(z,re),Y&&!D&&(Z.fire(z),z=void 0),J=()=>{let q=z;z=void 0,D=void 0,(!Y||F>1)&&Z.fire(q),F=0},typeof X=="number"?(clearTimeout(D),D=setTimeout(J,X)):D===void 0&&(D=0,queueMicrotask(J))})},onWillRemoveListener(){P&&F>0&&J?.()},onDidRemoveLastListener(){J=void 0,j.dispose()}},Z=new $t(ne);return K?.add(Z),Z.event}e.debounce=g;function x(W,I=0,X){return e.debounce(W,(Y,P)=>Y?(Y.push(P),Y):[P],I,void 0,!0,void 0,X)}e.accumulate=x;function C(W,I=(Y,P)=>Y===P,X){let Y=!0,P;return f(W,G=>{let K=Y||!I(G,P);return Y=!1,P=G,K},X)}e.latch=C;function T(W,I,X){return[e.filter(W,I,X),e.filter(W,Y=>!I(Y),X)]}e.split=T;function w(W,I=!1,X=[],Y){let P=X.slice(),G=W(z=>{P?P.push(z):j.fire(z)});Y&&Y.add(G);let K=()=>{P?.forEach(z=>j.fire(z)),P=null},j=new $t({onWillAddFirstListener(){G||(G=W(z=>j.fire(z)),Y&&Y.add(G))},onDidAddFirstListener(){P&&(I?setTimeout(K):K())},onDidRemoveLastListener(){G&&G.dispose(),G=null}});return Y&&Y.add(j),j.event}e.buffer=w;function m(W,I){return(X,Y,P)=>{let G=I(new _);return W(function(K){let j=G.evaluate(K);j!==b&&X.call(Y,j)},void 0,P)}}e.chain=m;let b=Symbol("HaltChainable");class _{constructor(){this.steps=[]}map(I){return this.steps.push(I),this}forEach(I){return this.steps.push(X=>(I(X),X)),this}filter(I){return this.steps.push(X=>I(X)?X:b),this}reduce(I,X){let Y=X;return this.steps.push(P=>(Y=I(Y,P),Y)),this}latch(I=(X,Y)=>X===Y){let X=!0,Y;return this.steps.push(P=>{let G=X||!I(P,Y);return X=!1,Y=P,G?P:b}),this}evaluate(I){for(let X of this.steps)if(I=X(I),I===b)break;return I}}function S(W,I,X=Y=>Y){let Y=(...j)=>K.fire(X(...j)),P=()=>W.on(I,Y),G=()=>W.removeListener(I,Y),K=new $t({onWillAddFirstListener:P,onDidRemoveLastListener:G});return K.event}e.fromNodeEventEmitter=S;function k(W,I,X=Y=>Y){let Y=(...j)=>K.fire(X(...j)),P=()=>W.addEventListener(I,Y),G=()=>W.removeEventListener(I,Y),K=new $t({onWillAddFirstListener:P,onDidRemoveLastListener:G});return K.event}e.fromDOMEventEmitter=k;function L(W){return new Promise(I=>i(W)(I))}e.toPromise=L;function R(W){let I=new $t;return W.then(X=>{I.fire(X)},()=>{I.fire(void 0)}).finally(()=>{I.dispose()}),I.event}e.fromPromise=R;function N(W,I){return W(X=>I.fire(X))}e.forward=N;function A(W,I,X){return I(X),W(Y=>I(Y))}e.runAndSubscribe=A;class B{constructor(I,X){this._observable=I,this._counter=0,this._hasChanged=!1;let Y={onWillAddFirstListener:()=>{I.addObserver(this)},onDidRemoveLastListener:()=>{I.removeObserver(this)}};this.emitter=new $t(Y),X&&X.add(this.emitter)}beginUpdate(I){this._counter++}handlePossibleChange(I){}handleChange(I,X){this._hasChanged=!0}endUpdate(I){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(W,I){return new B(W,I).emitter.event}e.fromObservable=V;function U(W){return(I,X,Y)=>{let P=0,G=!1,K={beginUpdate(){P++},endUpdate(){P--,P===0&&(W.reportChanges(),G&&(G=!1,I.call(X)))},handlePossibleChange(){},handleChange(){G=!0}};W.addObserver(K),W.reportChanges();let j={dispose(){W.removeObserver(K)}};return Y instanceof co?Y.add(j):Array.isArray(Y)&&Y.push(j),j}}e.fromObservableLight=U})(Pr||={});var Cg=class Eg{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Eg._idPool++}`,Eg.all.add(this)}start(t){this._stopWatch=new KL,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}}};Cg.all=new Set,Cg._idPool=0;var VL=Cg,YL=-1,bw=class yw{constructor(t,i,s=(yw._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 JL(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}};bw._idPool=1;var XL=bw,ZL=class Sw{constructor(t){this.value=t}static create(){let t=new Error;return new Sw(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
+
`).slice(2).join(`
|
|
17
|
+
`))}},JL=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},QL=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},eM=0,up=class{constructor(t){this.value=t,this.id=eM++}},tM=2,nM,$t=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new XL(t?.onListenerError??lp,this._options?.leakWarningThreshold??YL):void 0,this._perfMon=this._options?._profName?new VL(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 QL(`${c}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||lp)(d),Ji.None}if(this._disposed)return Ji.None;i&&(t=t.bind(i));let o=new up(t),f;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=ZL.create(),f=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof up?(this._deliveryQueue??=new iM,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let p=$n(()=>{f?.(),this._removeListener(o)});return s instanceof co?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*tM<=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||lp;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 up)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}},iM=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}},jb={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}},Sl=2,xl,vs=class Xa{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new Db,this._cacheMapCombined=new Db,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new to,this._textureSize=512,this._onAddTextureAtlasCanvas=new $t,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new $t,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=xw(t,this._config.deviceCellWidth*4+Sl*2,this._config.deviceCellHeight+Sl*2),this._tmpCtx=mn(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 GL;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(Xa.maxAtlasPages&&this._pages.length>=Math.max(4,Xa.maxAtlasPages)){let i=this._pages.filter(d=>d.canvas.width*2<=(Xa.maxTextureSize||4096)).sort((d,v)=>v.canvas.width!==d.canvas.width?v.canvas.width-d.canvas.width:v.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,v)=>d>v?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 hp(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 hp(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 v of p.glyphs)v.texturePage=i,v.sizeClipSpace.x=v.size.x/s,v.sizeClipSpace.y=v.size.y/s,v.texturePosition.x+=c,v.texturePosition.y+=h,v.texturePositionClipSpace.x=v.texturePosition.x/s,v.texturePositionClipSpace.y=v.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 xl=t.get(i,s,o,f),xl||(xl=this._drawToCache(i,s,o,f,p,c),t.set(i,s,o,f,xl)),xl}_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 Bi;let f;switch(t){case 16777216:case 33554432:f=this._getColorFromAnsiIndex(i);break;case 50331648:let p=to.toColorRGB(i);f=Kn.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,v){let g=this._getMinimumContrastColor(t,i,s,o,f,p,c,d,h,v);if(g)return g;let x;switch(f){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&p<8&&(p+=8),x=this._getColorFromAnsiIndex(p);break;case 50331648:let C=to.toColorRGB(p);x=Kn.toColor(C[0],C[1],C[2]);break;default:c?x=this._config.colors.background:x=this._config.colors.foreground}return this._config.allowTransparency&&(x=Dl.opaque(x)),h&&(x=Dl.multiplyOpacity(x,DL)),x}_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,v){if(this._config.minimumContrastRatio===1||v)return;let g=this._getContrastCache(d),x=g.getColor(t,o);if(x!==void 0)return x||void 0;let C=this._resolveBackgroundRgba(i,s,c),T=this._resolveForegroundRgba(f,p,c,h),w=Qs.ensureContrastRatio(C,T,this._config.minimumContrastRatio/(d?2:1));if(!w){g.setColor(t,o,null);return}let m=Kn.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)+Sl*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let d=Math.min(this._config.deviceCellHeight+Sl*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 jb;let v=!!this._workAttributeData.isBold(),g=!!this._workAttributeData.isInverse(),x=!!this._workAttributeData.isDim(),C=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),w=!!this._workAttributeData.isStrikethrough(),m=!!this._workAttributeData.isOverline(),b=this._workAttributeData.getFgColor(),_=this._workAttributeData.getFgColorMode(),S=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(g){let z=b;b=S,S=z;let D=_;_=k,k=D}let L=this._getBackgroundColor(k,S,g,x);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=v?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=hw;let A=c.length===1&&Om(c.charCodeAt(0)),B=c.length===1&&kL(c.charCodeAt(0)),V=this._getForegroundColor(i,k,S,s,_,b,g,x,v,uw(c.charCodeAt(0)));this._tmpCtx.fillStyle=V.css;let U=B?0:Sl*2,W=!1;this._config.customGlyphs!==!1&&(W=PL(this._tmpCtx,c,U,U,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let I=!A,X;if(typeof t=="number"?X=this._unicodeService.wcwidth(t):X=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=z%2===1?.5:0;if(this._tmpCtx.lineWidth=z,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())I=!1,this._tmpCtx.strokeStyle=`rgb(${to.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{I=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();let F=U,J=Math.ceil(U+this._config.deviceCharHeight)-D-(f?z*2:0),ne=J+z,Z=J+z*2,re=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<X;q++){this._tmpCtx.save();let H=F+q*this._config.deviceCellWidth,se=F+(q+1)*this._config.deviceCellWidth,de=H+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(H,J),this._tmpCtx.lineTo(se,J),this._tmpCtx.moveTo(H,Z),this._tmpCtx.lineTo(se,Z);break;case 3:let xe=z<=1?Z:Math.ceil(U+this._config.deviceCharHeight-z/2)-D,ye=z<=1?J:Math.ceil(U+this._config.deviceCharHeight+z/2)-D,Me=new Path2D;Me.rect(H,J,this._config.deviceCellWidth,Z-J),this._tmpCtx.clip(Me),this._tmpCtx.moveTo(H-this._config.deviceCellWidth/2,ne),this._tmpCtx.bezierCurveTo(H-this._config.deviceCellWidth/2,ye,H,ye,H,ne),this._tmpCtx.bezierCurveTo(H,xe,de,xe,de,ne),this._tmpCtx.bezierCurveTo(de,ye,se,ye,se,ne),this._tmpCtx.bezierCurveTo(se,xe,se+this._config.deviceCellWidth/2,xe,se+this._config.deviceCellWidth/2,ne);break;case 4:let Oe=re===0?0:re>=z?z*2-re:z-re;re>=z||Oe===0?(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(H+Oe,J),this._tmpCtx.lineTo(se,J)):(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(H,J),this._tmpCtx.lineTo(H+Oe,J),this._tmpCtx.moveTo(H+Oe+z,J),this._tmpCtx.lineTo(se,J)),re=NL(se-H,z,re);break;case 5:let Fe=.6,ht=.3,Ae=se-H,Rt=Math.floor(Fe*Ae),Xt=Math.floor(ht*Ae),vn=Ae-Rt-Xt;this._tmpCtx.setLineDash([Rt,Xt,vn]),this._tmpCtx.moveTo(H,J),this._tmpCtx.lineTo(se,J);break;default:this._tmpCtx.moveTo(H,J),this._tmpCtx.lineTo(se,J);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!W&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let q=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();let H=new Path2D;H.rect(F,J-Math.ceil(z/2),this._config.deviceCellWidth*X,Z-J+Math.ceil(z/2)),this._tmpCtx.clip(H),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(c,U,U+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(m){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=z%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(U,U+D),this._tmpCtx.lineTo(U+this._config.deviceCharWidth*X,U+D),this._tmpCtx.stroke()}if(W||this._tmpCtx.fillText(c,U,U+this._config.deviceCharHeight),c==="_"&&!this._config.allowTransparency){let z=dp(this._tmpCtx.getImageData(U,U,this._config.deviceCellWidth,this._config.deviceCellHeight),L,V,I);if(z)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,U,U+this._config.deviceCharHeight-D),z=dp(this._tmpCtx.getImageData(U,U,this._config.deviceCellWidth,this._config.deviceCellHeight),L,V,I),!!z);D++);}if(w){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(U,U+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(U+this._config.deviceCharWidth*X,U+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let Y=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=rM(Y):P=dp(Y,L,V,I),P)return jb;let G=this._findGlyphBoundingBox(Y,this._workBoundingBox,h,B,W,U),K,j;for(;;){if(this._activePages.length===0){let z=this._createNewPage();K=z,j=z.currentRow,j.height=G.size.y;break}K=this._activePages[this._activePages.length-1],j=K.currentRow;for(let z of this._activePages)G.size.y<=z.currentRow.height&&(K=z,j=z.currentRow);for(let z=this._activePages.length-1;z>=0;z--)for(let D of this._activePages[z].fixedRows)D.height<=j.height&&G.size.y<=D.height&&(K=this._activePages[z],j=D);if(G.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new hp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),K=this._overflowSizePage,j=this._overflowSizePage.currentRow,j.x+G.size.x>=K.canvas.width&&(j.x=0,j.y+=j.height,j.height=0);break}if(j.y+G.size.y>=K.canvas.height||j.height>G.size.y+2){let z=!1;if(K.currentRow.y+K.currentRow.height+G.size.y>=K.canvas.height){let D;for(let F of this._activePages)if(F.currentRow.y+F.currentRow.height+G.size.y<F.canvas.height){D=F;break}if(D)K=D;else if(Xa.maxAtlasPages&&this._pages.length>=Xa.maxAtlasPages&&j.y+G.size.y<=K.canvas.height&&j.height>=G.size.y&&j.x+G.size.x<=K.canvas.width)z=!0;else{let F=this._createNewPage();K=F,j=F.currentRow,j.height=G.size.y,z=!0}}z||(K.currentRow.height>0&&K.fixedRows.push(K.currentRow),j={x:0,y:K.currentRow.y+K.currentRow.height,height:G.size.y},K.fixedRows.push(j),K.currentRow={x:0,y:j.y+j.height,height:0})}if(j.x+G.size.x<=K.canvas.width)break;j===K.currentRow?(j.x=0,j.y+=j.height,j.height=0):K.fixedRows.splice(K.fixedRows.indexOf(j),1)}return G.texturePage=this._pages.indexOf(K),G.texturePosition.x=j.x,G.texturePosition.y=j.y,G.texturePositionClipSpace.x=j.x/K.canvas.width,G.texturePositionClipSpace.y=j.y/K.canvas.height,G.sizeClipSpace.x/=K.canvas.width,G.sizeClipSpace.y/=K.canvas.height,j.height=Math.max(j.height,G.size.y),j.x+=G.size.x,K.ctx.putImageData(Y,G.texturePosition.x-this._workBoundingBox.left,G.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,G.size.x,G.size.y),K.addGlyph(G),K.version++,G}_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 v=0;v<c;v++){for(let g=0;g<h;g++){let x=v*this._tmpCanvas.width*4+g*4+3;if(t.data[x]!==0){i.top=v,d=!0;break}}if(d)break}i.left=0,d=!1;for(let v=0;v<p+h;v++){for(let g=0;g<c;g++){let x=g*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){i.left=v,d=!0;break}}if(d)break}i.right=h,d=!1;for(let v=p+h-1;v>=p;v--){for(let g=0;g<c;g++){let x=g*this._tmpCanvas.width*4+v*4+3;if(t.data[x]!==0){i.right=v,d=!0;break}}if(d)break}i.bottom=c,d=!1;for(let v=c-1;v>=0;v--){for(let g=0;g<h;g++){let x=v*this._tmpCanvas.width*4+g*4+3;if(t.data[x]!==0){i.bottom=v,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)}}}},hp=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=xw(e,t,t),this.ctx=mn(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 dp(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,v=Math.floor((Math.abs(o-c)+Math.abs(f-h)+Math.abs(p-d))/12),g=!0;for(let x=0;x<e.data.length;x+=4)e.data[x]===o&&e.data[x+1]===f&&e.data[x+2]===p||s&&Math.abs(e.data[x]-o)+Math.abs(e.data[x+1]-f)+Math.abs(e.data[x+2]-p)<v?e.data[x+3]=0:g=!1;return g}function rM(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function xw(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function sM(e,t,i,s,o,f,p,c){let h={foreground:f.foreground,background:f.background,cursor:Bi,cursorAccent:Bi,selectionForeground:Bi,selectionBackgroundTransparent:Bi,selectionBackgroundOpaque:Bi,selectionInactiveBackgroundTransparent:Bi,selectionInactiveBackgroundOpaque:Bi,overviewRulerBorder:Bi,scrollbarSliderBackground:Bi,scrollbarSliderHoverBackground:Bi,scrollbarSliderActiveBackground:Bi,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 Ib(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 aM(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Hi=[];function ww(e,t,i,s,o,f,p,c,h){let d=sM(s,o,f,p,t,i,c,h);for(let x=0;x<Hi.length;x++){let C=Hi[x],T=C.ownedBy.indexOf(e);if(T>=0){if(Ib(C.config,d))return C.atlas;C.ownedBy.length===1?(C.atlas.dispose(),Hi.splice(x,1)):C.ownedBy.splice(T,1);break}}for(let x=0;x<Hi.length;x++){let C=Hi[x];if(Ib(C.config,d))return C.ownedBy.push(e),C.atlas}let v=e._core,g={atlas:new vs(document,d,v.unicodeService),config:d,ownedBy:[e]};return Hi.push(g),g.atlas}function Bb(e){for(let t=0;t<Hi.length;t++){let i=Hi[t].ownedBy.indexOf(e);if(i!==-1){Hi[t].ownedBy.length===1?(Hi[t].atlas.dispose(),Hi.splice(t,1)):Hi[t].ownedBy.splice(i,1);break}}}var ku=600,oM=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=ku){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=ku-(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=ku-(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})},ku)},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 Pb(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 $n(()=>s?.disconnect())}function lM(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var zb=class Cw extends to{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new mw,this.combinedData=""}static fromCharData(t){let i=new Cw;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?lM(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()]}},Ew=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function kw(e,t,i){let s=mn(e.createProgram());if(e.attachShader(s,mn(Hb(e,e.VERTEX_SHADER,t))),e.attachShader(s,mn(Hb(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 Hb(e,t,i){let s=mn(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 cM(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 uM=class{constructor(e){this.texture=e,this.version=-1}},hM=`#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 dM(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 bs=11,Wa=bs*Float32Array.BYTES_PER_ELEMENT,fM=2,nn=0,Ht,fp=0,wl=0,pM=class extends Ji{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;vs.maxAtlasPages===void 0&&(vs.maxAtlasPages=Math.min(32,mn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),vs.maxTextureSize=mn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=mn(kw(o,hM,dM(vs.maxAtlasPages))),this._register($n(()=>o.deleteProgram(this._program))),this._projectionLocation=mn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=mn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=mn(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($n(()=>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($n(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,c,o.STATIC_DRAW),this._attributesBuffer=mn(o.createBuffer()),this._register($n(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Wa,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Wa,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Wa,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Wa,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Wa,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Wa,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let d=new Int32Array(vs.maxAtlasPages);for(let v=0;v<vs.maxAtlasPages;v++)d[v]=v;o.uniform1iv(this._textureLocation,d),o.uniformMatrix4fv(this._projectionLocation,!1,Ew),this._atlasTextures=[];for(let v=0;v<vs.maxAtlasPages;v++){let g=new uM(mn(o.createTexture()));this._register($n(()=>o.deleteTexture(g.texture))),o.activeTexture(o.TEXTURE0+v),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[v]=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(nn=(i*this._terminal.cols+t)*bs,s===0||s===void 0){e.fill(0,nn,nn+bs-1-fM);return}this._atlas&&(c&&c.length>1?Ht=this._atlas.getRasterizedGlyphCombinedChar(c,o,f,p,!1,this._terminal.element):Ht=this._atlas.getRasterizedGlyph(s,o,f,p,!1,this._terminal.element),fp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==d&&Ht.offset.x>fp?(wl=Ht.offset.x-fp,e[nn]=-(Ht.offset.x-wl)+this._dimensions.device.char.left,e[nn+1]=-Ht.offset.y+this._dimensions.device.char.top,e[nn+2]=(Ht.size.x-wl)/this._dimensions.device.canvas.width,e[nn+3]=Ht.size.y/this._dimensions.device.canvas.height,e[nn+4]=Ht.texturePage,e[nn+5]=Ht.texturePositionClipSpace.x+wl/this._atlas.pages[Ht.texturePage].canvas.width,e[nn+6]=Ht.texturePositionClipSpace.y,e[nn+7]=Ht.sizeClipSpace.x-wl/this._atlas.pages[Ht.texturePage].canvas.width,e[nn+8]=Ht.sizeClipSpace.y):(e[nn]=-Ht.offset.x+this._dimensions.device.char.left,e[nn+1]=-Ht.offset.y+this._dimensions.device.char.top,e[nn+2]=Ht.size.x/this._dimensions.device.canvas.width,e[nn+3]=Ht.size.y/this._dimensions.device.canvas.height,e[nn+4]=Ht.texturePage,e[nn+5]=Ht.texturePositionClipSpace.x,e[nn+6]=Ht.texturePositionClipSpace.y,e[nn+7]=Ht.sizeClipSpace.x,e[nn+8]=Ht.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&LL(s,h,Ht.size.x,this._dimensions.device.cell.width)&&(e[nn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*bs;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+=bs}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*bs,p=this._vertices.attributes.subarray(f,f+e.lineLengths[o]*bs);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/bs)}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}},gM=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 mM(){return new gM}var ch=4,Vu=1,Yu=2,pp=3,_M=2147483648,vM=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=mM()}resize(e,t){let i=e*t*ch;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)}},bM=`#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
|
+
}`,yM=`#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
|
+
}`,Ir=8,gp=Ir*Float32Array.BYTES_PER_ELEMENT,SM=20*Ir,$b=class{constructor(){this.attributes=new Float32Array(SM),this.count=0}},Dr=0,Ub=0,Fb=0,Wb=0,Gb=0,qb=0,Kb=0,xM=class extends Ji{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new $b,this._verticesCursor=new $b;let o=this._gl;this._program=mn(kw(o,bM,yM)),this._register($n(()=>o.deleteProgram(this._program))),this._projectionLocation=mn(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($n(()=>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($n(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,c,o.STATIC_DRAW),this._attributesBuffer=mn(o.createBuffer()),this._register($n(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,gp,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,gp,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,gp,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,Ew),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,v,g,x,C,T;for(o=0;o<t.rows;o++){for(p=-1,c=0,h=0,d=!1,f=0;f<t.cols;f++)v=(o*t.cols+f)*ch,g=e.cells[v+Vu],x=e.cells[v+Yu],C=!!(x&67108864),(g!==c||x!==h&&(d||C))&&((c!==0||d&&h!==0)&&(T=s++*Ir,this._updateRectangle(i,T,h,c,p,f,o)),p=f,c=g,h=x,d=C);(c!==0||d&&h!==0)&&(T=s++*Ir,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++*Ir,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++*Ir,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++*Ir,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++*Ir,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:Dr=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Dr=(i&16777215)<<8;break;default:Dr=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Dr=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Dr=(s&16777215)<<8;break;default:Dr=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=cM(e.attributes,this._terminal.rows*this._terminal.cols*Ir)),Ub=o*this._dimensions.device.cell.width,Fb=p*this._dimensions.device.cell.height,Wb=(Dr>>24&255)/255,Gb=(Dr>>16&255)/255,qb=(Dr>>8&255)/255,Kb=1,this._addRectangle(e.attributes,t,Ub,Fb,(f-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Wb,Gb,qb,Kb)}_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])}},wM=class extends Ji{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($n(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=mn(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=ww(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=hw,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}`}},CM=class extends wM{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&&aM(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()}},Ys=typeof window=="object"?window:globalThis,kg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new $t,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new $t,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}};kg.INSTANCE=new kg;var Tw=kg;function EM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Tw.INSTANCE.onDidChangeZoomLevel;Tw.INSTANCE.onDidChangeFullscreen;var xo=typeof navigator=="object"?navigator.userAgent:"";xo.indexOf("Firefox")>=0;xo.indexOf("AppleWebKit")>=0;var kM=xo.indexOf("Chrome")>=0;!kM&&xo.indexOf("Safari")>=0;xo.indexOf("Electron/")>=0;xo.indexOf("Android")>=0;var mp=!1;if(typeof Ys.matchMedia=="function"){let e=Ys.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ys.matchMedia("(display-mode: fullscreen)");mp=e.matches,EM(Ys,e,({matches:i})=>{mp&&t.matches||(mp=i)})}var no="en",_p=!1,Aw=!1,Tu,Xu=no,Vb=no,TM,jr,ea=globalThis,yi;typeof ea.vscode<"u"&&typeof ea.vscode.process<"u"?yi=ea.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(yi=process);var AM=typeof yi?.versions?.electron=="string",RM=AM&&yi?.type==="renderer";if(typeof yi=="object"){yi.platform,yi.platform,_p=yi.platform==="linux",_p&&yi.env.SNAP&&yi.env.SNAP_REVISION,yi.env.CI||yi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Tu=no,Xu=no;let e=yi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Tu=t.userLocale,Vb=t.osLocale,Xu=t.resolvedLanguage||no,TM=t.languagePack?.translationsConfigFile}catch{}Aw=!0}else typeof navigator=="object"&&!RM?(jr=navigator.userAgent,jr.indexOf("Windows")>=0,jr.indexOf("Macintosh")>=0,(jr.indexOf("Macintosh")>=0||jr.indexOf("iPad")>=0||jr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_p=jr.indexOf("Linux")>=0,jr?.indexOf("Mobi")>=0,Xu=globalThis._VSCODE_NLS_LANGUAGE||no,Tu=navigator.language.toLowerCase(),Vb=Tu):console.error("Unable to resolve platform.");var Yb=Aw,cr=jr,gs=Xu,LM;(e=>{function t(){return gs}e.value=t;function i(){return gs.length===2?gs==="en":gs.length>=3?gs[0]==="e"&&gs[1]==="n"&&gs[2]==="-":!1}e.isDefaultVariant=i;function s(){return gs==="en"}e.isDefault=s})(LM||={});var MM=typeof ea.postMessage=="function"&&!ea.importScripts;(()=>{if(MM){let e=[];ea.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}),ea.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var NM=!!(cr&&cr.indexOf("Chrome")>=0);cr&&cr.indexOf("Firefox")>=0;!NM&&cr&&cr.indexOf("Safari")>=0;cr&&cr.indexOf("Edg/")>=0;cr&&cr.indexOf("Android")>=0;var Ga=typeof navigator=="object"?navigator:{};Yb||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ga&&Ga.clipboard&&Ga.clipboard.writeText,Yb||Ga&&Ga.clipboard&&Ga.clipboard.readText;var Dm=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}},vp=new Dm,Xb=new Dm,Zb=new Dm;new Array(230);var OM;(e=>{function t(c){return vp.keyCodeToStr(c)}e.toString=t;function i(c){return vp.strToKeyCode(c)}e.fromString=i;function s(c){return Xb.keyCodeToStr(c)}e.toUserSettingsUS=s;function o(c){return Zb.keyCodeToStr(c)}e.toUserSettingsGeneral=o;function f(c){return Xb.strToKeyCode(c)||Zb.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 vp.keyCodeToStr(c)}e.toElectronAccelerator=p})(OM||={});var Rw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),DM;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof jM?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Rw})})(DM||={});var jM=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?Rw:(this._emitter||(this._emitter=new $t),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},IM;(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})(IM||={});var Jb=class Pi{static fromArray(t){return new Pi(i=>{i.emitMany(t)})}static fromPromise(t){return new Pi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Pi(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Pi(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 $t,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 Pr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Pi(async s=>{for await(let o of t)s.emitOne(i(o))})}map(t){return Pi.map(this,t)}static filter(t,i){return new Pi(async s=>{for await(let o of t)i(o)&&s.emitOne(o)})}filter(t){return Pi.filter(this,t)}static coalesce(t){return Pi.filter(t,i=>!!i)}coalesce(){return Pi.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Pi.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())}};Jb.EMPTY=Jb.fromArray([]);var{getWindow:BM}=(function(){let e=new Map,t={window:Ys,disposables:new co};e.set(Ys.vscodeWindowId,t);let i=new $t,s=new $t,o=new $t;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 Ji.None;let c=new co,h={window:p,disposables:c.add(new co)};return e.set(p.vscodeWindowId,h),c.add($n(()=>{e.delete(p.vscodeWindowId),s.fire(p)})),c.add(Tg(p,zM.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:Ys},getDocument(p){return BM(p).document}}})(),PM=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 Tg(e,t,i,s){return new PM(e,t,i,s)}var zM={BEFORE_UNLOAD:"beforeunload"},HM=class extends Ji{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 yl,this._charAtlasDisposable=this._register(new yl),this._observerDisposable=this._register(new yl),this._model=new vM,this._workCell=new zb,this._workCell2=new zb,this._rectangleRenderer=this._register(new yl),this._glyphRenderer=this._register(new yl),this._onChangeTextureAtlas=this._register(new $t),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new $t),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new $t),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new $t),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new $t),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 OL(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new CM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,p,this._themeService)],this.dimensions=ML(),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(Tg(this._canvas,"webglcontextlost",v=>{console.log("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(Tg(this._canvas,"webglcontextrestored",v=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Bb(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Pb(this._canvas,this._coreBrowserService.window,(v,g)=>this._setCanvasDevicePixelDimensions(v,g)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=Pb(this._canvas,v,(g,x)=>this._setCanvasDevicePixelDimensions(g,x))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register($n(()=>{for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),Bb(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 xM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new pM(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=ww(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=aw(Pr.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Pr.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 oM(()=>{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,v=0,g=!0,x,C,T,w,m,b,_,S,k;e=Qb(e,i.rows-1,0),t=Qb(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),B=-1,V=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let U=!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,v=0,h=this._characterJoinerService.getJoinedCharacters(p),S=0;S<i.cols;S++){if(o=this._cellColorResolver.result.bg,c.loadCell(S,s),S===0&&(o=this._cellColorResolver.result.bg),d=!1,g=S>=v,x=S,h.length>0&&S===h[0][0]&&g){C=h.shift();let W=this._model.selection.isCellSelected(this._terminal,C[0],p);for(_=C[0]+1;_<C[1];_++)g&&=W===this._model.selection.isCellSelected(this._terminal,_,p);g&&=!T||A<C[0]||A>=C[1],g?(d=!0,s=new $M(s,c.translateToString(!0,C[0],C[1]),C[1]-C[0]),x=C[1]-1):v=C[1]}if(w=s.getChars(),m=s.getCode(),_=(f*i.cols+S)*ch,this._cellColorResolver.resolve(s,S,p,this.dimensions.device.cell.width),V&&p===R&&(S===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},B=A+s.getWidth()-1),S>=A&&S<=B&&(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]=S+1),!(this._model.cells[_]===m&&this._model.cells[_+Vu]===this._cellColorResolver.result.bg&&this._model.cells[_+Yu]===this._cellColorResolver.result.fg&&this._model.cells[_+pp]===this._cellColorResolver.result.ext)&&(U=!0,w.length>1&&(m|=_M),this._model.cells[_]=m,this._model.cells[_+Vu]=this._cellColorResolver.result.bg,this._model.cells[_+Yu]=this._cellColorResolver.result.fg,this._model.cells[_+pp]=this._cellColorResolver.result.ext,b=s.getWidth(),this._glyphRenderer.value.updateCell(S,f,m,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,w,b,o),d)){for(s=this._workCell,S++;S<=x;S++)k=(f*i.cols+S)*ch,this._glyphRenderer.value.updateCell(S,f,0,0,0,0,CL,0,0),this._model.cells[k]=0,this._model.cells[k+Vu]=this._cellColorResolver.result.bg,this._model.cells[k+Yu]=this._cellColorResolver.result.fg,this._model.cells[k+pp]=this._cellColorResolver.result.ext;S--}}U&&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})}},$M=class extends to{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 Qb(e,t,i=0){return Math.max(Math.min(e,t),i)}var ey="di$target",ty="di$dependencies",bp=new Map;function hr(e){if(bp.has(e))return bp.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");UM(t,i,o)};return t._id=e,bp.set(e,t),t}function UM(e,t,i){t[ey]===t?t[ty].push({id:e,index:i}):(t[ty]=[{id:e,index:i}],t[ey]=t)}hr("BufferService");hr("CoreMouseService");hr("CoreService");hr("CharsetService");hr("InstantiationService");hr("LogService");var FM=hr("OptionsService");hr("OscLinkService");hr("UnicodeService");hr("DecorationService");var WM={trace:0,debug:1,info:2,warn:3,error:4,off:5},GM="xterm.js: ",ny=class extends Ji{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=WM[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?"":GM)+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)}};ny=dL([fL(0,FM)],ny);var qM=class extends Ji{constructor(e){if(cw&&wL()<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 $t),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new $t),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new $t),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new $t),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 v=o._themeService;this._renderer=this._register(new HM(e,p,c,h,i,d,s,v,this._preserveDrawingBuffer)),this._register(Pr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Pr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Pr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Pr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),f.setRenderer(this._renderer),this._register($n(()=>{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()}},yp={exports:{}},iy;function KM(){return iy||(iy=1,(function(e,t){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,c,h){var d=this&&this.__decorate||function(_,S,k,L){var R,N=arguments.length,A=N<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,S,k,L);else for(var B=_.length-1;B>=0;B--)(R=_[B])&&(A=(N<3?R(A):N>3?R(S,k,A):R(S,k))||A);return N>3&&A&&Object.defineProperty(S,k,A),A},v=this&&this.__param||function(_,S){return function(k,L){S(k,L,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const g=h(9042),x=h(9924),C=h(844),T=h(4725),w=h(2585),m=h(3656);let b=c.AccessibilityManager=class extends C.Disposable{constructor(_,S,k,L){super(),this._terminal=_,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 x.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(_){for(let S=0;S<_;S++)this._handleChar(" ")}_handleChar(_){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==_&&(this._charsToAnnounce+=_):this._charsToAnnounce+=_,_===`
|
|
76
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=g.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(_){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(_)||this._charsToConsume.push(_)}_refreshRows(_,S){this._liveRegionDebouncer.refresh(_,S,this._terminal.rows)}_renderRows(_,S){const k=this._terminal.buffer,L=k.lines.length.toString();for(let R=_;R<=S;R++){const N=k.lines.get(k.ydisp+R),A=[],B=N?.translateToString(!0,void 0,void 0,A)||"",V=(k.ydisp+R+1).toString(),U=this._rowElements[R];U&&(B.length===0?(U.innerText=" ",this._rowColumns.set(U,[0,1])):(U.textContent=B,this._rowColumns.set(U,A)),U.setAttribute("aria-posinset",V),U.setAttribute("aria-setsize",L))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(_,S){const k=_.target,L=this._rowElements[S===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||_.relatedTarget!==L)return;let R,N;if(S===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),S===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(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),_.preventDefault(),_.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const _=document.getSelection();if(!_)return;if(_.isCollapsed)return void(this._rowContainer.contains(_.anchorNode)&&this._terminal.clearSelection());if(!_.anchorNode||!_.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:_.anchorNode,offset:_.anchorOffset},k={node:_.focusNode,offset:_.focusOffset};if((S.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===k.node&&S.offset>k.offset)&&([S,k]=[k,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.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:B,offset:V})=>{const U=B instanceof Text?B.parentNode:B;let W=parseInt(U?.getAttribute("aria-posinset"),10)-1;if(isNaN(W))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(U);if(!I)return console.warn("columns is null. Race condition?"),null;let X=V<I.length?I[V]:I.slice(-1)[0]+1;return X>=this._terminal.cols&&(++W,X=0),{row:W,column:X}},N=R(S),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(_){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>_;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const _=this._coreBrowserService.mainDocument.createElement("div");return _.setAttribute("role","listitem"),_.tabIndex=-1,this._refreshRowDimensions(_),_}_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 _=0;_<this._terminal.rows;_++)this._refreshRowDimensions(this._rowElements[_])}}_refreshRowDimensions(_){_.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=d([v(1,w.IInstantiationService),v(2,T.ICoreBrowserService),v(3,T.IRenderService)],b)},3614:(p,c)=>{function h(x){return x.replace(/\r?\n/g,"\r")}function d(x,C){return C?"\x1B[200~"+x+"\x1B[201~":x}function v(x,C,T,w){x=d(x=h(x),T.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(x,!0),C.value=""}function g(x,C,T){const w=T.getBoundingClientRect(),m=x.clientX-w.left-10,b=x.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(x,C){x.clipboardData&&x.clipboardData.setData("text/plain",C.selectionText),x.preventDefault()},c.handlePasteEvent=function(x,C,T,w){x.stopPropagation(),x.clipboardData&&v(x.clipboardData.getData("text/plain"),C,T,w)},c.paste=v,c.moveTextAreaUnderMouseCursor=g,c.rightClickHandler=function(x,C,T,w,m){g(x,C,T),m&&w.rightClickSelect(x),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(v,g,x){this._css.set(v,g,x)}getCss(v,g){return this._css.get(v,g)}setColor(v,g,x){this._color.set(v,g,x)}getColor(v,g){return this._color.get(v,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,v,g){h.addEventListener(d,v,g);let x=!1;return{dispose:()=>{x||(x=!0,h.removeEventListener(d,v,g))}}}},3551:function(p,c,h){var d=this&&this.__decorate||function(b,_,S,k){var L,R=arguments.length,N=R<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,S,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(_,S,N):L(_,S))||N);return R>3&&N&&Object.defineProperty(_,S,N),N},v=this&&this.__param||function(b,_){return function(S,k){_(S,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const g=h(3656),x=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,_,S,k,L){super(),this._element=b,this._mouseService=_,this._renderService=S,this._bufferService=k,this._linkProviderService=L,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new x.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new x.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 _=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!_)return;this._isMouseOut=!1;const S=b.composedPath();for(let k=0;k<S.length;k++){const L=S[k];if(L.classList.contains("xterm"))break;if(L.classList.contains("xterm-hover"))return}this._lastBufferCell&&_.x===this._lastBufferCell.x&&_.y===this._lastBufferCell.y||(this._handleHover(_),this._lastBufferCell=_)}_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,_){this._activeProviderReplies&&_||(this._activeProviderReplies?.forEach((k=>{k?.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[k,L]of this._linkProviderService.linkProviders.entries())_?this._activeProviderReplies?.get(k)&&(S=this._checkLinkProviderResult(k,b,S)):L.provideLinks(b.y,(R=>{if(this._isMouseOut)return;const N=R?.map((A=>({link:A})));this._activeProviderReplies?.set(k,N),S=this._checkLinkProviderResult(k,b,S),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,_){const S=new Set;for(let k=0;k<_.size;k++){const L=_.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,B=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let V=A;V<=B;V++){if(S.has(V)){L.splice(R--,1);break}S.add(V)}}}}_checkLinkProviderResult(b,_,S){if(!this._activeProviderReplies)return S;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,_)));R&&(S=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let R=0;R<this._activeProviderReplies.size;R++){const N=this._activeProviderReplies.get(R)?.find((A=>this._linkAtPosition(A.link,_)));if(N){S=!0,this._handleNewLink(N);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const _=this._positionFromMouseEvent(b,this._element,this._mouseService);_&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,_)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,_){this._currentLink&&this._lastMouseEvent&&(!b||!_||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=_)&&(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 _=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);_&&this._linkAtPosition(b.link,_)&&(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:S=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:S=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const k=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,L=this._bufferService.buffer.ydisp+1+S.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,_,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),_.hover&&_.hover(S,_.text)}_fireUnderlineEvent(b,_){const S=b.range,k=this._bufferService.buffer.ydisp,L=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-k-1,S.end.x,S.end.y-k-1,void 0);(_?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(L)}_linkLeave(b,_,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(_,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),_.leave&&_.leave(S,_.text)}_linkAtPosition(b,_){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,L=_.y*this._bufferService.cols+_.x;return S<=L&&L<=k}_positionFromMouseEvent(b,_,S){const k=S.getCoords(b,_,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,_,S,k,L){return{x1:b,y1:_,x2:S,y2:k,cols:this._bufferService.cols,fg:L}}};c.Linkifier=m=d([v(1,w.IMouseService),v(2,w.IRenderService),v(3,T.IBufferService),v(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,_){var S,k=arguments.length,L=k<3?m:_===null?_=Object.getOwnPropertyDescriptor(m,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,_);else for(var R=w.length-1;R>=0;R--)(S=w[R])&&(L=(k<3?S(L):k>3?S(m,b,L):S(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},v=this&&this.__param||function(w,m){return function(b,_){m(b,_,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const g=h(511),x=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 _=[],S=this._optionsService.rawOptions.linkHandler,k=new g.CellData,L=b.getTrimmedLength();let R=-1,N=-1,A=!1;for(let B=0;B<L;B++)if(N!==-1||b.hasContent(B)){if(b.loadCell(B,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=B,R=k.extended.urlId;continue}A=k.extended.urlId!==R}else N!==-1&&(A=!0);if(A||N!==-1&&B===L-1){const V=this._oscLinkService.getLinkData(R)?.uri;if(V){const U={start:{x:N+1,y:w},end:{x:B+(A||B!==L-1?0:1),y:w}};let W=!1;if(!S?.allowNonHttpProtocols)try{const I=new URL(V);["http:","https:"].includes(I.protocol)||(W=!0)}catch{W=!0}W||_.push({text:V,range:U,activate:(I,X)=>S?S.activate(I,X,U):T(0,X),hover:(I,X)=>S?.hover?.(I,X,U),leave:(I,X)=>S?.leave?.(I,X,U)})}A=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=B,R=k.extended.urlId):(N=-1,R=-1)}}m(_)}};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([v(0,x.IBufferService),v(1,x.IOptionsService),v(2,x.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,v){this._rowCount=v,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),v=h(3656),g=h(3551),x=h(9042),C=h(3730),T=h(1680),w=h(3107),m=h(5744),b=h(2950),_=h(1296),S=h(428),k=h(4269),L=h(5114),R=h(8934),N=h(3230),A=h(9312),B=h(4725),V=h(6731),U=h(8055),W=h(8969),I=h(8460),X=h(844),Y=h(6114),P=h(8437),G=h(2584),K=h(7399),j=h(5941),z=h(9074),D=h(2585),F=h(5435),J=h(4567),ne=h(779);class Z extends W.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(q={}){super(q),this.browser=Y,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new X.MutableDisposable),this._onCursorMove=this.register(new I.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new I.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new I.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new I.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new I.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new I.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new I.EventEmitter),this._onBlur=this.register(new I.EventEmitter),this._onA11yCharEmitter=this.register(new I.EventEmitter),this._onA11yTabEmitter=this.register(new I.EventEmitter),this._onWillOpen=this.register(new I.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(z.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(B.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,se)=>this.refresh(H,se)))),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,I.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,I.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,I.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,I.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((H=>this._afterResize(H.cols,H.rows)))),this.register((0,X.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(q){if(this._themeService)for(const H of q){let se,de="";switch(H.index){case 256:se="foreground",de="10";break;case 257:se="background",de="11";break;case 258:se="cursor",de="12";break;default:se="ansi",de="4;"+H.index}switch(H.type){case 0:const xe=U.color.toColorRGB(se==="ansi"?this._themeService.colors.ansi[H.index]:this._themeService.colors[se]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${de};${(0,j.toRgbString)(xe)}${G.C1_ESCAPED.ST}`);break;case 1:if(se==="ansi")this._themeService.modifyColors((ye=>ye.ansi[H.index]=U.channels.toColor(...H.color)));else{const ye=se;this._themeService.modifyColors((Me=>Me[ye]=U.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(q){q?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(J.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(q){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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(G.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 q=this.buffer.ybase+this.buffer.y,H=this.buffer.lines.get(q);if(!H)return;const se=Math.min(this.buffer.x,this.cols-1),de=this._renderService.dimensions.css.cell.height,xe=H.getWidth(se),ye=this._renderService.dimensions.css.cell.width*xe,Me=this.buffer.y*this._renderService.dimensions.css.cell.height,Oe=se*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Oe+"px",this.textarea.style.top=Me+"px",this.textarea.style.width=ye+"px",this.textarea.style.height=de+"px",this.textarea.style.lineHeight=de+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(H=>{this.hasSelection()&&(0,d.copyHandler)(H,this._selectionService)})));const q=H=>(0,d.handlePasteEvent)(H,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",q)),this.register((0,v.addDisposableDomListener)(this.element,"paste",q)),Y.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(H=>{H.button===2&&(0,d.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(H=>{(0,d.rightClickHandler)(H,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),Y.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(H=>{H.button===1&&(0,d.moveTextAreaUnderMouseCursor)(H,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(q=>this._keyUp(q)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(q=>this._keyDown(q)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(q=>this._keyPress(q)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(q=>this._compositionHelper.compositionupdate(q)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(q=>this._inputEvent(q)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(q){if(!q)throw new Error("Terminal requires a parent element.");if(q.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=q.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"),q.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,v.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),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",x.promptLabel),Y.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,q.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(B.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(V.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.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(B.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((se=>this.scrollLines(se.amount,se.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(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),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(J.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(m.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&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(_.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const q=this,H=this.element;function se(ye){const Me=q._mouseService.getMouseReportCoords(ye,q.screenElement);if(!Me)return!1;let Oe,Fe;switch(ye.overrideType||ye.type){case"mousemove":Fe=32,ye.buttons===void 0?(Oe=3,ye.button!==void 0&&(Oe=ye.button<3?ye.button:3)):Oe=1&ye.buttons?0:4&ye.buttons?1:2&ye.buttons?2:3;break;case"mouseup":Fe=0,Oe=ye.button<3?ye.button:3;break;case"mousedown":Fe=1,Oe=ye.button<3?ye.button:3;break;case"wheel":if(q._customWheelEventHandler&&q._customWheelEventHandler(ye)===!1||q.viewport.getLinesScrolled(ye)===0)return!1;Fe=ye.deltaY<0?0:1,Oe=4;break;default:return!1}return!(Fe===void 0||Oe===void 0||Oe>4)&&q.coreMouseService.triggerMouseEvent({col:Me.col,row:Me.row,x:Me.x,y:Me.y,button:Oe,action:Fe,ctrl:ye.ctrlKey,alt:ye.altKey,shift:ye.shiftKey})}const de={mouseup:null,wheel:null,mousedrag:null,mousemove:null},xe={mouseup:ye=>(se(ye),ye.buttons||(this._document.removeEventListener("mouseup",de.mouseup),de.mousedrag&&this._document.removeEventListener("mousemove",de.mousedrag)),this.cancel(ye)),wheel:ye=>(se(ye),this.cancel(ye,!0)),mousedrag:ye=>{ye.buttons&&se(ye)},mousemove:ye=>{ye.buttons||se(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?de.mousemove||(H.addEventListener("mousemove",xe.mousemove),de.mousemove=xe.mousemove):(H.removeEventListener("mousemove",de.mousemove),de.mousemove=null),16&ye?de.wheel||(H.addEventListener("wheel",xe.wheel,{passive:!1}),de.wheel=xe.wheel):(H.removeEventListener("wheel",de.wheel),de.wheel=null),2&ye?de.mouseup||(de.mouseup=xe.mouseup):(this._document.removeEventListener("mouseup",de.mouseup),de.mouseup=null),4&ye?de.mousedrag||(de.mousedrag=xe.mousedrag):(this._document.removeEventListener("mousemove",de.mousedrag),de.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(H,"mousedown",(ye=>{if(ye.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ye))return se(ye),de.mouseup&&this._document.addEventListener("mouseup",de.mouseup),de.mousedrag&&this._document.addEventListener("mousemove",de.mousedrag),this.cancel(ye)}))),this.register((0,v.addDisposableDomListener)(H,"wheel",(ye=>{if(!de.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ye)===!1)return!1;if(!this.buffer.hasScrollback){const Me=this.viewport.getLinesScrolled(ye);if(Me===0)return;const Oe=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ye.deltaY<0?"A":"B");let Fe="";for(let ht=0;ht<Math.abs(Me);ht++)Fe+=Oe;return this.coreService.triggerDataEvent(Fe,!0),this.cancel(ye,!0)}return this.viewport.handleWheel(ye)?this.cancel(ye):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(H,"touchstart",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ye),this.cancel(ye)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(H,"touchmove",(ye=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ye)?void 0:this.cancel(ye)}),{passive:!1}))}refresh(q,H){this._renderService?.refreshRows(q,H)}updateCursorStyle(q){this._selectionService?.shouldColumnSelect(q)?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(q,H,se=0){se===1?(super.scrollLines(q,H,se),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(q)}paste(q){(0,d.paste)(q,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(q){this._customKeyEventHandler=q}attachCustomWheelEventHandler(q){this._customWheelEventHandler=q}registerLinkProvider(q){return this._linkProviderService.registerLinkProvider(q)}registerCharacterJoiner(q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const H=this._characterJoinerService.register(q);return this.refresh(0,this.rows-1),H}deregisterCharacterJoiner(q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(q)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(q){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+q)}registerDecoration(q){return this._decorationService.registerDecoration(q)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(q,H,se){this._selectionService.setSelection(q,H,se)}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(q,H){this._selectionService?.selectLines(q,H)}_keyDown(q){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(q)===!1)return!1;const H=this.browser.isMac&&this.options.macOptionIsMeta&&q.altKey;if(!H&&!this._compositionHelper.keydown(q))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;H||q.key!=="Dead"&&q.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const se=(0,K.evaluateKeyboardEvent)(q,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(q),se.type===3||se.type===2){const de=this.rows-1;return this.scrollLines(se.type===2?-de:de),this.cancel(q,!0)}return se.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,q)||(se.cancel&&this.cancel(q,!0),!se.key||!!(q.key&&!q.ctrlKey&&!q.altKey&&!q.metaKey&&q.key.length===1&&q.key.charCodeAt(0)>=65&&q.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(se.key!==G.C0.ETX&&se.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:se.key,domEvent:q}),this._showCursor(),this.coreService.triggerDataEvent(se.key,!0),!this.optionsService.rawOptions.screenReaderMode||q.altKey||q.ctrlKey?this.cancel(q,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(q,H){const se=q.isMac&&!this.options.macOptionIsMeta&&H.altKey&&!H.ctrlKey&&!H.metaKey||q.isWindows&&H.altKey&&H.ctrlKey&&!H.metaKey||q.isWindows&&H.getModifierState("AltGraph");return H.type==="keypress"?se:se&&(!H.keyCode||H.keyCode>47)}_keyUp(q){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(q)===!1||((function(H){return H.keyCode===16||H.keyCode===17||H.keyCode===18})(q)||this.focus(),this.updateCursorStyle(q),this._keyPressHandled=!1)}_keyPress(q){let H;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(q)===!1)return!1;if(this.cancel(q),q.charCode)H=q.charCode;else if(q.which===null||q.which===void 0)H=q.keyCode;else{if(q.which===0||q.charCode===0)return!1;H=q.which}return!(!H||(q.altKey||q.ctrlKey||q.metaKey)&&!this._isThirdLevelShift(this.browser,q)||(H=String.fromCharCode(H),this._onKey.fire({key:H,domEvent:q}),this._showCursor(),this.coreService.triggerDataEvent(H,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(q){if(q.data&&q.inputType==="insertText"&&(!q.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const H=q.data;return this.coreService.triggerDataEvent(H,!0),this.cancel(q),!0}return!1}resize(q,H){q!==this.cols||H!==this.rows?super.resize(q,H):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(q,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 q=1;q<this.rows;q++)this.buffer.lines.push(this.buffer.getBlankLine(P.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 q=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=q,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(q){if(this._renderService)switch(q){case F.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const H=this._renderService.dimensions.css.canvas.width.toFixed(0),se=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${se};${H}t`);break;case F.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const de=this._renderService.dimensions.css.cell.width.toFixed(0),xe=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${xe};${de}t`)}}cancel(q,H){if(this.options.cancelEvents||H)return q.preventDefault(),q.stopPropagation(),!1}}c.Terminal=Z},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,v){this._rowCount=v,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 x=g-this._lastRefreshMs,C=this._debounceThresholdMS-x;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,_,S,k){var L,R=arguments.length,N=R<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,S,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(_,S,N):L(_,S))||N);return R>3&&N&&Object.defineProperty(_,S,N),N},v=this&&this.__param||function(b,_){return function(S,k){_(S,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const g=h(3656),x=h(4725),C=h(8460),T=h(844),w=h(2585);let m=c.Viewport=class extends T.Disposable{constructor(b,_,S,k,L,R,N,A){super(),this._viewportElement=b,this._scrollArea=_,this._bufferService=S,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((B=>this._activeBuffer=B.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((B=>this._renderDimensions=B))),this._handleThemeChange(A.colors),this.register(A.onChangeColors((B=>this._handleThemeChange(B)))),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 _=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==_&&(this._lastRecordedBufferHeight=_,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 _=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:_,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,_){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(_<0&&this._viewportElement.scrollTop!==0||_>0&&S<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const _=this._getPixelsScrolled(b);return _!==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+_:this._smoothScrollState.target+=_,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=_,this._bubbleScroll(b,_))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const _=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+_,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 _=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?_*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._currentRowHeight*this._bufferService.rows),_}getBufferElements(b,_){let S,k="";const L=[],R=_??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let A=b;A<R;A++){const B=N.get(A);if(!B)continue;const V=N.get(A+1)?.isWrapped;if(k+=B.translateToString(!V),!V||A===N.length-1){const U=document.createElement("div");U.textContent=k,L.push(U),k.length>0&&(S=U),k=""}}return{bufferElements:L,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let _=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(_/=this._currentRowHeight+0,this._wheelPartialScroll+=_,_=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(_*=this._bufferService.rows),_}_applyScrollModifier(b,_){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&_.altKey||S==="ctrl"&&_.ctrlKey||S==="shift"&&_.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 _=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,_!==0&&(this._viewportElement.scrollTop+=_,this._bubbleScroll(b,_))}};c.Viewport=m=d([v(2,w.IBufferService),v(3,w.IOptionsService),v(4,x.ICharSizeService),v(5,x.IRenderService),v(6,x.ICoreBrowserService),v(7,x.IThemeService)],m)},3107:function(p,c,h){var d=this&&this.__decorate||function(w,m,b,_){var S,k=arguments.length,L=k<3?m:_===null?_=Object.getOwnPropertyDescriptor(m,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,_);else for(var R=w.length-1;R>=0;R--)(S=w[R])&&(L=(k<3?S(L):k>3?S(m,b,L):S(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},v=this&&this.__param||function(w,m){return function(b,_){m(b,_,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const g=h(4725),x=h(844),C=h(2585);let T=c.BufferDecorationRenderer=class extends x.Disposable{constructor(w,m,b,_,S){super(),this._screenElement=w,this._bufferService=m,this._coreBrowserService=b,this._decorationService=_,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((k=>this._removeDecoration(k)))),this.register((0,x.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([v(1,C.IBufferService),v(2,g.ICoreBrowserService),v(3,C.IDecorationService),v(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,v){return d>=h.startBufferLine-this._linePadding[v||"full"]&&d<=h.endBufferLine+this._linePadding[v||"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(S,k,L,R){var N,A=arguments.length,B=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,k,L,R);else for(var V=S.length-1;V>=0;V--)(N=S[V])&&(B=(A<3?N(B):A>3?N(k,L,B):N(k,L))||B);return A>3&&B&&Object.defineProperty(k,L,B),B},v=this&&this.__param||function(S,k){return function(L,R){k(L,R,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const g=h(5871),x=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 _=c.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,k,L,R,N,A,B){super(),this._viewportElement=S,this._screenElement=k,this._bufferService=L,this._decorationService=R,this._renderService=N,this._optionsService=A,this._coreBrowserService=B,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 V=this._canvas.getContext("2d");if(!V)throw new Error("Ctx cannot be null");this._ctx=V,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 S=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);m.full=this._canvas.width,m.left=S,m.center=k,m.right=S,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 S=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(S,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 S=this._colorZoneStore.zones;for(const k of S)k.position!=="full"&&this._renderColorZone(k);for(const k of S)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-w[S.position||"full"]/2),m[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[S.position||"full"]))}_queueRefresh(S,k){this._shouldUpdateDimensions=S||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=_=d([v(2,T.IBufferService),v(3,T.IDecorationService),v(4,x.IRenderService),v(5,T.IOptionsService),v(6,x.ICoreBrowserService)],_)},2950:function(p,c,h){var d=this&&this.__decorate||function(w,m,b,_){var S,k=arguments.length,L=k<3?m:_===null?_=Object.getOwnPropertyDescriptor(m,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(w,m,b,_);else for(var R=w.length-1;R>=0;R--)(S=w[R])&&(L=(k<3?S(L):k>3?S(m,b,L):S(m,b))||L);return k>3&&L&&Object.defineProperty(m,b,L),L},v=this&&this.__param||function(w,m){return function(b,_){m(b,_,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const g=h(4725),x=h(2585),C=h(2584);let T=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,m,b,_,S,k){this._textarea=w,this._compositionView=m,this._bufferService=b,this._optionsService=_,this._coreService=S,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,_=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,S=m*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=S+"px",this._compositionView.style.top=_+"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=S+"px",this._textarea.style.top=_+"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([v(2,x.IBufferService),v(3,x.IOptionsService),v(4,x.ICoreService),v(5,g.IRenderService)],T)},9806:(p,c)=>{function h(d,v,g){const x=g.getBoundingClientRect(),C=d.getComputedStyle(g),T=parseInt(C.getPropertyValue("padding-left")),w=parseInt(C.getPropertyValue("padding-top"));return[v.clientX-x.left-T,v.clientY-x.top-w]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(d,v,g,x,C,T,w,m,b){if(!T)return;const _=h(d,v,g);return _?(_[0]=Math.ceil((_[0]+(b?w/2:0))/w),_[1]=Math.ceil(_[1]/m),_[0]=Math.min(Math.max(_[0],1),x+(b?1:0)),_[1]=Math.min(Math.max(_[1],1),C),_):void 0}},9504:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const d=h(2584);function v(m,b,_,S){const k=m-g(m,_),L=b-g(b,_),R=Math.abs(k-L)-(function(N,A,B){let V=0;const U=N-g(N,B),W=A-g(A,B);for(let I=0;I<Math.abs(U-W);I++){const X=x(N,A)==="A"?-1:1;B.buffer.lines.get(U+X*I)?.isWrapped&&V++}return V})(m,b,_);return w(R,T(x(m,b),S))}function g(m,b){let _=0,S=b.buffer.lines.get(m),k=S?.isWrapped;for(;k&&m>=0&&m<b.rows;)_++,S=b.buffer.lines.get(--m),k=S?.isWrapped;return _}function x(m,b){return m>b?"A":"B"}function C(m,b,_,S,k,L){let R=m,N=b,A="";for(;R!==_||N!==S;)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 _=b?"O":"[";return d.C0.ESC+_+m}function w(m,b){m=Math.floor(m);let _="";for(let S=0;S<m;S++)_+=b;return _}c.moveToCellSequence=function(m,b,_,S){const k=_.buffer.x,L=_.buffer.y;if(!_.buffer.hasScrollback)return(function(A,B,V,U,W,I){return v(B,U,W,I).length===0?"":w(C(A,B,A,B-g(B,W),!1,W).length,T("D",I))})(k,L,0,b,_,S)+v(L,b,_,S)+(function(A,B,V,U,W,I){let X;X=v(B,U,W,I).length>0?U-g(U,W):B;const Y=U,P=(function(G,K,j,z,D,F){let J;return J=v(j,z,D,F).length>0?z-g(z,D):K,G<j&&J<=z||G>=j&&J<z?"C":"D"})(A,B,V,U,W,I);return w(C(A,X,V,Y,P==="C",W).length,T(P,I))})(k,L,m,b,_,S);let R;if(L===b)return R=k>m?"D":"C",w(Math.abs(k-m),T(R,S));R=L>b?"D":"C";const N=Math.abs(L-b);return w((function(A,B){return B.cols-A})(L>b?m:k,_)+(N-1)*_.cols+1+((L>b?k:m)-1),T(R,S))}},1296:function(p,c,h){var d=this&&this.__decorate||function(I,X,Y,P){var G,K=arguments.length,j=K<3?X:P===null?P=Object.getOwnPropertyDescriptor(X,Y):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(I,X,Y,P);else for(var z=I.length-1;z>=0;z--)(G=I[z])&&(j=(K<3?G(j):K>3?G(X,Y,j):G(X,Y))||j);return K>3&&j&&Object.defineProperty(X,Y,j),j},v=this&&this.__param||function(I,X){return function(Y,P){X(Y,P,I)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const g=h(3787),x=h(2550),C=h(2223),T=h(6171),w=h(6052),m=h(4725),b=h(8055),_=h(8460),S=h(844),k=h(2585),L="xterm-dom-renderer-owner-",R="xterm-rows",N="xterm-fg-",A="xterm-bg-",B="xterm-focus",V="xterm-selection";let U=1,W=c.DomRenderer=class extends S.Disposable{constructor(I,X,Y,P,G,K,j,z,D,F,J,ne,Z){super(),this._terminal=I,this._document=X,this._element=Y,this._screenElement=P,this._viewportElement=G,this._helperContainer=K,this._linkifier2=j,this._charSizeService=D,this._optionsService=F,this._bufferService=J,this._coreBrowserService=ne,this._themeService=Z,this._terminalClass=U++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new _.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(V),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((re=>this._injectCss(re)))),this._injectCss(this._themeService.colors),this._rowFactory=z.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((re=>this._handleLinkHover(re)))),this.register(this._linkifier2.onHideLinkUnderline((re=>this._handleLinkLeave(re)))),this.register((0,S.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 x.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 I=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*I,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*I),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/I),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/I),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 Y of this._rowElements)Y.style.width=`${this.dimensions.css.canvas.width}px`,Y.style.height=`${this.dimensions.css.cell.height}px`,Y.style.lineHeight=`${this.dimensions.css.cell.height}px`,Y.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const X=`${this._terminalSelector} .${R} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=X,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(I){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let X=`${this._terminalSelector} .${R} { color: ${I.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;X+=`${this._terminalSelector} .${R} .xterm-dim { color: ${b.color.multiplyOpacity(I.foreground,.5).css};}`,X+=`${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 Y=`blink_underline_${this._terminalClass}`,P=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;X+=`@keyframes ${Y} { 50% { border-bottom-style: hidden; }}`,X+=`@keyframes ${P} { 50% { box-shadow: none; }}`,X+=`@keyframes ${G} { 0% { background-color: ${I.cursor.css}; color: ${I.cursorAccent.css}; } 50% { background-color: inherit; color: ${I.cursor.css}; }}`,X+=`${this._terminalSelector} .${R}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${R}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${R}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block { background-color: ${I.cursor.css}; color: ${I.cursorAccent.css};}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${I.cursor.css} !important; color: ${I.cursorAccent.css} !important;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${I.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${I.cursor.css} inset;}${this._terminalSelector} .${R} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${I.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,X+=`${this._terminalSelector} .${V} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${V} div { position: absolute; background-color: ${I.selectionBackgroundOpaque.css};}${this._terminalSelector} .${V} div { position: absolute; background-color: ${I.selectionInactiveBackgroundOpaque.css};}`;for(const[K,j]of I.ansi.entries())X+=`${this._terminalSelector} .${N}${K} { color: ${j.css}; }${this._terminalSelector} .${N}${K}.xterm-dim { color: ${b.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${A}${K} { background-color: ${j.css}; }`;X+=`${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(I.background).css}; }${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(I.background),.5).css}; }${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR} { background-color: ${I.foreground.css}; }`,this._themeStyleElement.textContent=X}_setDefaultSpacing(){const I=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${I}px`,this._rowFactory.defaultSpacing=I}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(I,X){for(let Y=this._rowElements.length;Y<=X;Y++){const P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>X;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(I,X){this._refreshRowElements(I,X),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(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(I,X,Y){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(I,X,Y),this.renderRows(0,this._bufferService.rows-1),!I||!X)return;this._selectionRenderModel.update(this._terminal,I,X,Y);const P=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,K=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(K>=this._bufferService.rows||j<0)return;const z=this._document.createDocumentFragment();if(Y){const D=I[0]>X[0];z.appendChild(this._createSelectionElement(K,D?X[0]:I[0],D?I[0]:X[0],j-K+1))}else{const D=P===K?I[0]:0,F=K===G?X[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(K,D,F));const J=j-K-1;if(z.appendChild(this._createSelectionElement(K+1,0,this._bufferService.cols,J)),K!==j){const ne=G===j?X[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(j,0,ne))}}this._selectionContainer.appendChild(z)}_createSelectionElement(I,X,Y,P=1){const G=this._document.createElement("div"),K=X*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(Y-X);return K+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-K),G.style.height=P*this.dimensions.css.cell.height+"px",G.style.top=I*this.dimensions.css.cell.height+"px",G.style.left=`${K}px`,G.style.width=`${j}px`,G}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 I of this._rowElements)I.replaceChildren()}renderRows(I,X){const Y=this._bufferService.buffer,P=Y.ybase+Y.y,G=Math.min(Y.x,this._bufferService.cols-1),K=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,z=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=I;D<=X;D++){const F=D+Y.ydisp,J=this._rowElements[D],ne=Y.lines.get(F);if(!J||!ne)break;J.replaceChildren(...this._rowFactory.createRow(ne,F,F===P,j,z,G,K,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${L}${this._terminalClass}`}_handleLinkHover(I){this._setCellUnderline(I.x1,I.x2,I.y1,I.y2,I.cols,!0)}_handleLinkLeave(I){this._setCellUnderline(I.x1,I.x2,I.y1,I.y2,I.cols,!1)}_setCellUnderline(I,X,Y,P,G,K){Y<0&&(I=0),P<0&&(X=0);const j=this._bufferService.rows-1;Y=Math.max(Math.min(Y,j),0),P=Math.max(Math.min(P,j),0),G=Math.min(G,this._bufferService.cols);const z=this._bufferService.buffer,D=z.ybase+z.y,F=Math.min(z.x,G-1),J=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,Z=this._optionsService.rawOptions.cursorInactiveStyle;for(let re=Y;re<=P;++re){const q=re+z.ydisp,H=this._rowElements[re],se=z.lines.get(q);if(!H||!se)break;H.replaceChildren(...this._rowFactory.createRow(se,q,q===D,ne,Z,F,J,this.dimensions.css.cell.width,this._widthCache,K?re===Y?I:0:-1,K?(re===P?X:G)-1:-1))}}};c.DomRenderer=W=d([v(7,k.IInstantiationService),v(8,m.ICharSizeService),v(9,k.IOptionsService),v(10,k.IBufferService),v(11,m.ICoreBrowserService),v(12,m.IThemeService)],W)},3787:function(p,c,h){var d=this&&this.__decorate||function(R,N,A,B){var V,U=arguments.length,W=U<3?N:B===null?B=Object.getOwnPropertyDescriptor(N,A):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(R,N,A,B);else for(var I=R.length-1;I>=0;I--)(V=R[I])&&(W=(U<3?V(W):U>3?V(N,A,W):V(N,A))||W);return U>3&&W&&Object.defineProperty(N,A,W),W},v=this&&this.__param||function(R,N){return function(A,B){N(A,B,R)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const g=h(2223),x=h(643),C=h(511),T=h(2585),w=h(8055),m=h(4725),b=h(4269),_=h(6171),S=h(3734);let k=c.DomRendererRowFactory=class{constructor(R,N,A,B,V,U,W){this._document=R,this._characterJoinerService=N,this._optionsService=A,this._coreBrowserService=B,this._coreService=V,this._decorationService=U,this._themeService=W,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,B,V,U,W,I,X,Y,P){const G=[],K=this._characterJoinerService.getJoinedCharacters(N),j=this._themeService.colors;let z,D=R.getNoBgTrimmedLength();A&&D<U+1&&(D=U+1);let F=0,J="",ne=0,Z=0,re=0,q=!1,H=0,se=!1,de=0;const xe=[],ye=Y!==-1&&P!==-1;for(let Me=0;Me<D;Me++){R.loadCell(Me,this._workCell);let Oe=this._workCell.getWidth();if(Oe===0)continue;let Fe=!1,ht=Me,Ae=this._workCell;if(K.length>0&&Me===K[0][0]){Fe=!0;const dt=K.shift();Ae=new b.JoinedCellData(this._workCell,R.translateToString(!0,dt[0],dt[1]),dt[1]-dt[0]),ht=dt[1]-1,Oe=Ae.getWidth()}const Rt=this._isCellInSelection(Me,N),Xt=A&&Me===U,vn=ye&&Me>=Y&&Me<=P;let on=!1;this._decorationService.forEachDecorationAtCell(Me,N,void 0,(dt=>{on=!0}));let kn=Ae.getChars()||x.WHITESPACE_CELL_CHAR;if(kn===" "&&(Ae.isUnderline()||Ae.isOverline())&&(kn=" "),de=Oe*I-X.get(kn,Ae.isBold(),Ae.isItalic()),z){if(F&&(Rt&&se||!Rt&&!se&&Ae.bg===ne)&&(Rt&&se&&j.selectionForeground||Ae.fg===Z)&&Ae.extended.ext===re&&vn===q&&de===H&&!Xt&&!Fe&&!on){Ae.isInvisible()?J+=x.WHITESPACE_CELL_CHAR:J+=kn,F++;continue}F&&(z.textContent=J),z=this._document.createElement("span"),F=0,J=""}else z=this._document.createElement("span");if(ne=Ae.bg,Z=Ae.fg,re=Ae.extended.ext,q=vn,H=de,se=Rt,Fe&&U>=Me&&U<=ht&&(U=Me),!this._coreService.isCursorHidden&&Xt&&this._coreService.isCursorInitialized){if(xe.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&xe.push("xterm-cursor-blink"),xe.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(V)switch(V){case"outline":xe.push("xterm-cursor-outline");break;case"block":xe.push("xterm-cursor-block");break;case"bar":xe.push("xterm-cursor-bar");break;case"underline":xe.push("xterm-cursor-underline")}}if(Ae.isBold()&&xe.push("xterm-bold"),Ae.isItalic()&&xe.push("xterm-italic"),Ae.isDim()&&xe.push("xterm-dim"),J=Ae.isInvisible()?x.WHITESPACE_CELL_CHAR:Ae.getChars()||x.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(xe.push(`xterm-underline-${Ae.extended.underlineStyle}`),J===" "&&(J=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())z.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let dt=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&dt<8&&(dt+=8),z.style.textDecorationColor=j.ansi[dt].css}Ae.isOverline()&&(xe.push("xterm-overline"),J===" "&&(J=" ")),Ae.isStrikethrough()&&xe.push("xterm-strikethrough"),vn&&(z.style.textDecoration="underline");let Zt=Ae.getFgColor(),ct=Ae.getFgColorMode(),Lt=Ae.getBgColor(),Ct=Ae.getBgColorMode();const Ft=!!Ae.isInverse();if(Ft){const dt=Zt;Zt=Lt,Lt=dt;const Tn=ct;ct=Ct,Ct=Tn}let Kt,Jn,bn,Pn=!1;switch(this._decorationService.forEachDecorationAtCell(Me,N,void 0,(dt=>{dt.options.layer!=="top"&&Pn||(dt.backgroundColorRGB&&(Ct=50331648,Lt=dt.backgroundColorRGB.rgba>>8&16777215,Kt=dt.backgroundColorRGB),dt.foregroundColorRGB&&(ct=50331648,Zt=dt.foregroundColorRGB.rgba>>8&16777215,Jn=dt.foregroundColorRGB),Pn=dt.options.layer==="top")})),!Pn&&Rt&&(Kt=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,Lt=Kt.rgba>>8&16777215,Ct=50331648,Pn=!0,j.selectionForeground&&(ct=50331648,Zt=j.selectionForeground.rgba>>8&16777215,Jn=j.selectionForeground)),Pn&&xe.push("xterm-decoration-top"),Ct){case 16777216:case 33554432:bn=j.ansi[Lt],xe.push(`xterm-bg-${Lt}`);break;case 50331648:bn=w.channels.toColor(Lt>>16,Lt>>8&255,255&Lt),this._addStyle(z,`background-color:#${L((Lt>>>0).toString(16),"0",6)}`);break;default:Ft?(bn=j.foreground,xe.push(`xterm-bg-${g.INVERTED_DEFAULT_COLOR}`)):bn=j.background}switch(Kt||Ae.isDim()&&(Kt=w.color.multiplyOpacity(bn,.5)),ct){case 16777216:case 33554432:Ae.isBold()&&Zt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Zt+=8),this._applyMinimumContrast(z,bn,j.ansi[Zt],Ae,Kt,void 0)||xe.push(`xterm-fg-${Zt}`);break;case 50331648:const dt=w.channels.toColor(Zt>>16&255,Zt>>8&255,255&Zt);this._applyMinimumContrast(z,bn,dt,Ae,Kt,Jn)||this._addStyle(z,`color:#${L(Zt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(z,bn,j.foreground,Ae,Kt,Jn)||Ft&&xe.push(`xterm-fg-${g.INVERTED_DEFAULT_COLOR}`)}xe.length&&(z.className=xe.join(" "),xe.length=0),Xt||Fe||on?z.textContent=J:F++,de!==this.defaultSpacing&&(z.style.letterSpacing=`${de}px`),G.push(z),Me=ht}return z&&F&&(z.textContent=J),G}_applyMinimumContrast(R,N,A,B,V,U){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,_.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const W=this._getContrastCache(B);let I;if(V||U||(I=W.getColor(N.rgba,A.rgba)),I===void 0){const X=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);I=w.color.ensureContrastRatio(V||N,U||A,X),W.setColor((V||N).rgba,(U||A).rgba,I??null)}return!!I&&(this._addStyle(R,`color:${I.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,B=this._selectionEnd;return!(!A||!B)&&(this._columnSelectMode?A[0]<=B[0]?R>=A[0]&&N>=A[1]&&R<B[0]&&N<=B[1]:R<A[0]&&N>=A[1]&&R>=B[0]&&N<=B[1]:N>A[1]&&N<B[1]||A[1]===B[1]&&N===A[1]&&R>=A[0]&&R<B[0]||A[1]<B[1]&&N===B[1]&&R<B[0]||A[1]<B[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([v(1,m.ICharacterJoinerService),v(2,T.IOptionsService),v(3,m.ICoreBrowserService),v(4,T.ICoreService),v(5,T.IDecorationService),v(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 v=h.createElement("span");v.classList.add("xterm-char-measure-element");const g=h.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontWeight="bold";const x=h.createElement("span");x.classList.add("xterm-char-measure-element"),x.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=[v,g,x,C],this._container.appendChild(v),this._container.appendChild(g),this._container.appendChild(x),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,v,g){h===this._font&&d===this._fontSize&&v===this._weight&&g===this._weightBold||(this._font=h,this._fontSize=d,this._weight=v,this._weightBold=g,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${g}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${g}`,this.clear())}get(h,d,v){let g=0;if(!d&&!v&&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 x=h;d&&(x+="B"),v&&(x+="I");let C=this._holey.get(x);if(C===void 0){let T=0;d&&(T|=1),v&&(T|=2),C=this._measure(h,T),C>0&&this._holey.set(x,C)}return C}_measure(h,d){const v=this._measureElements[d];return v.textContent=h.repeat(32),v.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(v){return 57508<=v&&v<=57558}function d(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=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(v){if(!v)throw new Error("value must not be falsy");return v},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},c.isEmoji=d,c.allowRescaling=function(v,g,x,C){return g===1&&x>Math.ceil(1.5*C)&&v!==void 0&&v>255&&!d(v)&&!h(v)&&!(function(T){return 57344<=T&&T<=63743})(v)},c.treatGlyphAsBackgroundColor=function(v){return h(v)||(function(g){return 9472<=g&&g<=9631})(v)},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(v,g,x=0){return(v-(2*Math.round(g)-x))%(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(v,g,x,C=!1){if(this.selectionStart=g,this.selectionEnd=x,!g||!x||g[0]===x[0]&&g[1]===x[1])return void this.clear();const T=v.buffers.active.ydisp,w=g[1]-T,m=x[1]-T,b=Math.max(w,0),_=Math.min(m,v.rows-1);b>=v.rows||_<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=w,this.viewportEndRow=m,this.viewportCappedStartRow=b,this.viewportCappedEndRow=_,this.startCol=g[0],this.endCol=x[0])}isCellSelected(v,g,x){return!!this.hasSelection&&(x-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?g>=this.startCol&&x>=this.viewportCappedStartRow&&g<this.endCol&&x<=this.viewportCappedEndRow:g<this.startCol&&x>=this.viewportCappedStartRow&&g>=this.endCol&&x<=this.viewportCappedEndRow:x>this.viewportStartRow&&x<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&x===this.viewportStartRow&&g>=this.startCol&&g<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===this.viewportEndRow&&g<this.endCol||this.viewportStartRow<this.viewportEndRow&&x===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(_,S,k,L){var R,N=arguments.length,A=N<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,S,k,L);else for(var B=_.length-1;B>=0;B--)(R=_[B])&&(A=(N<3?R(A):N>3?R(S,k,A):R(S,k))||A);return N>3&&A&&Object.defineProperty(S,k,A),A},v=this&&this.__param||function(_,S){return function(k,L){S(k,L,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const g=h(2585),x=h(8460),C=h(844);let T=c.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(_,S,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new x.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new m(_,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const _=this._measureStrategy.measure();_.width===this.width&&_.height===this.height||(this.width=_.width,this.height=_.height,this._onCharSizeChange.fire())}};c.CharSizeService=T=d([v(2,g.IOptionsService)],T);class w extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,k){S!==void 0&&S>0&&k!==void 0&&k>0&&(this._result.width=S,this._result.height=k)}}class m extends w{constructor(S,k,L){super(),this._document=S,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(S){super(),this._optionsService=S,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 S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(p,c,h){var d=this&&this.__decorate||function(b,_,S,k){var L,R=arguments.length,N=R<3?_:k===null?k=Object.getOwnPropertyDescriptor(_,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,_,S,k);else for(var A=b.length-1;A>=0;A--)(L=b[A])&&(N=(R<3?L(N):R>3?L(_,S,N):L(_,S))||N);return R>3&&N&&Object.defineProperty(_,S,N),N},v=this&&this.__param||function(b,_){return function(S,k){_(S,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const g=h(3734),x=h(643),C=h(511),T=h(2585);class w extends g.AttributeData{constructor(_,S,k){super(),this.content=0,this.combinedData="",this.fg=_.fg,this.bg=_.bg,this.combinedData=S,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(_){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=w;let m=c.CharacterJoinerService=class Lw{constructor(_){this._bufferService=_,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(_){const S={id:this._nextCharacterJoinerId++,handler:_};return this._characterJoiners.push(S),S.id}deregister(_){for(let S=0;S<this._characterJoiners.length;S++)if(this._characterJoiners[S].id===_)return this._characterJoiners.splice(S,1),!0;return!1}getJoinedCharacters(_){if(this._characterJoiners.length===0)return[];const S=this._bufferService.buffer.lines.get(_);if(!S||S.length===0)return[];const k=[],L=S.translateToString(!0);let R=0,N=0,A=0,B=S.getFg(0),V=S.getBg(0);for(let U=0;U<S.getTrimmedLength();U++)if(S.loadCell(U,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==V){if(U-R>1){const W=this._getJoinedRanges(L,A,N,S,R);for(let I=0;I<W.length;I++)k.push(W[I])}R=U,A=N,B=this._workCell.fg,V=this._workCell.bg}N+=this._workCell.getChars().length||x.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-R>1){const U=this._getJoinedRanges(L,A,N,S,R);for(let W=0;W<U.length;W++)k.push(U[W])}return k}_getJoinedRanges(_,S,k,L,R){const N=_.substring(S,k);let A=[];try{A=this._characterJoiners[0].handler(N)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const V=this._characterJoiners[B].handler(N);for(let U=0;U<V.length;U++)Lw._mergeRanges(A,V[U])}catch(V){console.error(V)}return this._stringRangesToCellRanges(A,L,R),A}_stringRangesToCellRanges(_,S,k){let L=0,R=!1,N=0,A=_[L];if(A){for(let B=k;B<this._bufferService.cols;B++){const V=S.getWidth(B),U=S.getString(B).length||x.WHITESPACE_CELL_CHAR.length;if(V!==0){if(!R&&A[0]<=N&&(A[0]=B,R=!0),A[1]<=N){if(A[1]=B,A=_[++L],!A)break;A[0]<=N?(A[0]=B,R=!0):R=!1}N+=U}}A&&(A[1]=this._bufferService.cols)}}static _mergeRanges(_,S){let k=!1;for(let L=0;L<_.length;L++){const R=_[L];if(k){if(S[1]<=R[0])return _[L-1][1]=S[1],_;if(S[1]<=R[1])return _[L-1][1]=Math.max(S[1],R[1]),_.splice(L,1),_;_.splice(L,1),L--}else{if(S[1]<=R[0])return _.splice(L,0,S),_;if(S[1]<=R[1])return R[0]=Math.min(S[0],R[0]),_;S[0]<R[1]&&(R[0]=Math.min(S[0],R[0]),k=!0)}}return k?_[_.length-1][1]=S[1]:_.push(S),_}};c.CharacterJoinerService=m=d([v(0,T.IBufferService)],m)},5114:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const d=h(844),v=h(8460),g=h(3656);class x 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 v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((_=>this._screenDprMonitor.setWindow(_)))),this.register((0,v.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=x;class C extends d.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new d.MutableDisposable),this._onDprChange=this.register(new v.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 v extends d.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,d.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(x){return this.linkProviders.push(x),{dispose:()=>{const C=this.linkProviders.indexOf(x);C!==-1&&this.linkProviders.splice(C,1)}}}}c.LinkProviderService=v},8934:function(p,c,h){var d=this&&this.__decorate||function(T,w,m,b){var _,S=arguments.length,k=S<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--)(_=T[L])&&(k=(S<3?_(k):S>3?_(w,m,k):_(w,m))||k);return S>3&&k&&Object.defineProperty(w,m,k),k},v=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),x=h(9806);let C=c.MouseService=class{constructor(T,w){this._renderService=T,this._charSizeService=w}getCoords(T,w,m,b,_){return(0,x.getCoords)(window,T,w,m,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,_)}getMouseReportCoords(T,w){const m=(0,x.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([v(0,g.IRenderService),v(1,g.ICharSizeService)],C)},3230:function(p,c,h){var d=this&&this.__decorate||function(_,S,k,L){var R,N=arguments.length,A=N<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,S,k,L);else for(var B=_.length-1;B>=0;B--)(R=_[B])&&(A=(N<3?R(A):N>3?R(S,k,A):R(S,k))||A);return N>3&&A&&Object.defineProperty(S,k,A),A},v=this&&this.__param||function(_,S){return function(k,L){S(k,L,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const g=h(6193),x=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(_,S,k,L,R,N,A,B){super(),this._rowCount=_,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(((V,U)=>this._renderRows(V,U)),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(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(A.window,S),this.register(A.onWindowChange((V=>this._registerIntersectionObserver(V,S))))}_registerIntersectionObserver(_,S){if("IntersectionObserver"in _){const k=new _.IntersectionObserver((L=>this._handleIntersectionChange(L[L.length-1])),{threshold:0});k.observe(S),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(_){this._isPaused=_.isIntersecting===void 0?_.intersectionRatio===0:!_.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(_,S,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(_,S,this._rowCount))}_renderRows(_,S){this._renderer.value&&(_=Math.min(_,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(_,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:_,end:S}),this._onRender.fire({start:_,end:S}),this._isNextRenderRedrawOnly=!0)}resize(_,S){this._rowCount=S,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(_){this._renderer.value=_,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(_){return this._renderDebouncer.addRefreshCallback(_)}_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(_,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(_,S))):this._renderer.value.handleResize(_,S),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(_,S,k){this._selectionState.start=_,this._selectionState.end=S,this._selectionState.columnSelectMode=k,this._renderer.value?.handleSelectionChanged(_,S,k)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=d([v(2,m.IOptionsService),v(3,x.ICharSizeService),v(4,m.IDecorationService),v(5,m.IBufferService),v(6,x.ICoreBrowserService),v(7,x.IThemeService)],b)},9312:function(p,c,h){var d=this&&this.__decorate||function(A,B,V,U){var W,I=arguments.length,X=I<3?B:U===null?U=Object.getOwnPropertyDescriptor(B,V):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")X=Reflect.decorate(A,B,V,U);else for(var Y=A.length-1;Y>=0;Y--)(W=A[Y])&&(X=(I<3?W(X):I>3?W(B,V,X):W(B,V))||X);return I>3&&X&&Object.defineProperty(B,V,X),X},v=this&&this.__param||function(A,B){return function(V,U){B(V,U,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const g=h(9806),x=h(9504),C=h(456),T=h(4725),w=h(8460),m=h(844),b=h(6114),_=h(4841),S=h(511),k=h(2585),L=" ",R=new RegExp(L,"g");let N=c.SelectionService=class extends m.Disposable{constructor(A,B,V,U,W,I,X,Y,P){super(),this._element=A,this._screenElement=B,this._linkifier=V,this._bufferService=U,this._coreService=W,this._mouseService=I,this._optionsService=X,this._renderService=Y,this._coreBrowserService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.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=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((G=>this._handleTrim(G))),this.register(this._bufferService.buffers.onBufferActivate((G=>this._handleBufferActivate(G)))),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,B=this._model.finalSelectionEnd;return!(!A||!B||A[0]===B[0]&&A[1]===B[1])}get selectionText(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!A||!B)return"";const V=this._bufferService.buffer,U=[];if(this._activeSelectionMode===3){if(A[0]===B[0])return"";const W=A[0]<B[0]?A[0]:B[0],I=A[0]<B[0]?B[0]:A[0];for(let X=A[1];X<=B[1];X++){const Y=V.translateBufferLineToString(X,!0,W,I);U.push(Y)}}else{const W=A[1]===B[1]?B[0]:void 0;U.push(V.translateBufferLineToString(A[1],!0,A[0],W));for(let I=A[1]+1;I<=B[1]-1;I++){const X=V.lines.get(I),Y=V.translateBufferLineToString(I,!0);X?.isWrapped?U[U.length-1]+=Y:U.push(Y)}if(A[1]!==B[1]){const I=V.lines.get(B[1]),X=V.translateBufferLineToString(B[1],!0,0,B[0]);I&&I.isWrapped?U[U.length-1]+=X:U.push(X)}}return U.map((W=>W.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 B=this._getMouseBufferCoords(A),V=this._model.finalSelectionStart,U=this._model.finalSelectionEnd;return!!(V&&U&&B)&&this._areCoordsInSelection(B,V,U)}isCellInSelection(A,B){const V=this._model.finalSelectionStart,U=this._model.finalSelectionEnd;return!(!V||!U)&&this._areCoordsInSelection([A,B],V,U)}_areCoordsInSelection(A,B,V){return A[1]>B[1]&&A[1]<V[1]||B[1]===V[1]&&A[1]===B[1]&&A[0]>=B[0]&&A[0]<V[0]||B[1]<V[1]&&A[1]===V[1]&&A[0]<V[0]||B[1]<V[1]&&A[1]===B[1]&&A[0]>=B[0]}_selectWordAtCursor(A,B){const V=this._linkifier.currentLink?.link?.range;if(V)return this._model.selectionStart=[V.start.x-1,V.start.y-1],this._model.selectionStartLength=(0,_.getRangeLength)(V,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const U=this._getMouseBufferCoords(A);return!!U&&(this._selectWordAt(U,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(A,B){this._model.clearSelection(),A=Math.max(A,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,A],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(A){this._model.handleTrim(A)&&this.refresh()}_getMouseBufferCoords(A){const B=this._mouseService.getCoords(A,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(A){let B=(0,g.getCoordsRelativeToElement)(this._coreBrowserService.window,A,this._screenElement)[1];const V=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=V?0:(B>V&&(B-=V),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}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 B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(A){this._selectWordAtCursor(A,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(A){const B=this._getMouseBufferCoords(A);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(A){return A.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(A){if(A.stopImmediatePropagation(),!this._model.selectionStart)return;const B=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 V=this._bufferService.buffer;if(this._model.selectionEnd[1]<V.lines.length){const U=V.lines.get(this._model.selectionEnd[1]);U&&U.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}B&&B[0]===this._model.selectionEnd[0]&&B[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 B=A.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&A.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const V=this._mouseService.getCoords(A,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(V&&V[0]!==void 0&&V[1]!==void 0){const U=(0,x.moveToCellSequence)(V[0]-1,V[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(U,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const A=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,V=!(!A||!B||A[0]===B[0]&&A[1]===B[1]);V?A&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&A[0]===this._oldSelectionStart[0]&&A[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(A,B,V)):this._oldHasSelection&&this._fireOnSelectionChange(A,B,V)}_fireOnSelectionChange(A,B,V){this._oldSelectionStart=A,this._oldSelectionEnd=B,this._oldHasSelection=V,this._onSelectionChange.fire()}_handleBufferActivate(A){this.clearSelection(),this._trimListener.dispose(),this._trimListener=A.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(A,B){let V=B;for(let U=0;B>=U;U++){const W=A.loadCell(U,this._workCell).getChars().length;this._workCell.getWidth()===0?V--:W>1&&B!==U&&(V+=W-1)}return V}setSelection(A,B,V){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[A,B],this._model.selectionStartLength=V,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(A){this._isClickInSelection(A)||(this._selectWordAtCursor(A,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(A,B,V=!0,U=!0){if(A[0]>=this._bufferService.cols)return;const W=this._bufferService.buffer,I=W.lines.get(A[1]);if(!I)return;const X=W.translateBufferLineToString(A[1],!1);let Y=this._convertViewportColToCharacterIndex(I,A[0]),P=Y;const G=A[0]-Y;let K=0,j=0,z=0,D=0;if(X.charAt(Y)===" "){for(;Y>0&&X.charAt(Y-1)===" ";)Y--;for(;P<X.length&&X.charAt(P+1)===" ";)P++}else{let ne=A[0],Z=A[0];I.getWidth(ne)===0&&(K++,ne--),I.getWidth(Z)===2&&(j++,Z++);const re=I.getString(Z).length;for(re>1&&(D+=re-1,P+=re-1);ne>0&&Y>0&&!this._isCharWordSeparator(I.loadCell(ne-1,this._workCell));){I.loadCell(ne-1,this._workCell);const q=this._workCell.getChars().length;this._workCell.getWidth()===0?(K++,ne--):q>1&&(z+=q-1,Y-=q-1),Y--,ne--}for(;Z<I.length&&P+1<X.length&&!this._isCharWordSeparator(I.loadCell(Z+1,this._workCell));){I.loadCell(Z+1,this._workCell);const q=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,Z++):q>1&&(D+=q-1,P+=q-1),P++,Z++}}P++;let F=Y+G-K+z,J=Math.min(this._bufferService.cols,P-Y+K+j-z-D);if(B||X.slice(Y,P).trim()!==""){if(V&&F===0&&I.getCodePoint(0)!==32){const ne=W.lines.get(A[1]-1);if(ne&&I.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const Z=this._getWordAt([this._bufferService.cols-1,A[1]-1],!1,!0,!1);if(Z){const re=this._bufferService.cols-Z.start;F-=re,J+=re}}}if(U&&F+J===this._bufferService.cols&&I.getCodePoint(this._bufferService.cols-1)!==32){const ne=W.lines.get(A[1]+1);if(ne?.isWrapped&&ne.getCodePoint(0)!==32){const Z=this._getWordAt([0,A[1]+1],!1,!1,!0);Z&&(J+=Z.length)}}return{start:F,length:J}}}_selectWordAt(A,B){const V=this._getWordAt(A,B);if(V){for(;V.start<0;)V.start+=this._bufferService.cols,A[1]--;this._model.selectionStart=[V.start,A[1]],this._model.selectionStartLength=V.length}}_selectToWordAt(A){const B=this._getWordAt(A,!0);if(B){let V=A[1];for(;B.start<0;)B.start+=this._bufferService.cols,V--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,V++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,V]}}_isCharWordSeparator(A){return A.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(A.getChars())>=0}_selectLineAt(A){const B=this._bufferService.buffer.getWrappedRangeForLine(A),V={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,_.getRangeLength)(V,this._bufferService.cols)}};c.SelectionService=N=d([v(3,k.IBufferService),v(4,k.ICoreService),v(5,T.IMouseService),v(6,k.IOptionsService),v(7,T.IRenderService),v(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,B,V){var U,W=arguments.length,I=W<3?A:V===null?V=Object.getOwnPropertyDescriptor(A,B):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(N,A,B,V);else for(var X=N.length-1;X>=0;X--)(U=N[X])&&(I=(W<3?U(I):W>3?U(A,B,I):U(A,B))||I);return W>3&&I&&Object.defineProperty(A,B,I),I},v=this&&this.__param||function(N,A){return function(B,V){A(B,V,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const g=h(7239),x=h(8055),C=h(8460),T=h(844),w=h(2585),m=x.css.toColor("#ffffff"),b=x.css.toColor("#000000"),_=x.css.toColor("#ffffff"),S=x.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[x.css.toColor("#2e3436"),x.css.toColor("#cc0000"),x.css.toColor("#4e9a06"),x.css.toColor("#c4a000"),x.css.toColor("#3465a4"),x.css.toColor("#75507b"),x.css.toColor("#06989a"),x.css.toColor("#d3d7cf"),x.css.toColor("#555753"),x.css.toColor("#ef2929"),x.css.toColor("#8ae234"),x.css.toColor("#fce94f"),x.css.toColor("#729fcf"),x.css.toColor("#ad7fa8"),x.css.toColor("#34e2e2"),x.css.toColor("#eeeeec")],A=[0,95,135,175,215,255];for(let B=0;B<216;B++){const V=A[B/36%6|0],U=A[B/6%6|0],W=A[B%6];N.push({css:x.channels.toCss(V,U,W),rgba:x.channels.toRgba(V,U,W)})}for(let B=0;B<24;B++){const V=8+10*B;N.push({css:x.channels.toCss(V,V,V),rgba:x.channels.toRgba(V,V,V)})}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:_,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:x.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:x.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,_),A.cursorAccent=R(N.cursorAccent,S),A.selectionBackgroundTransparent=R(N.selectionBackground,k),A.selectionBackgroundOpaque=x.color.blend(A.background,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundTransparent=R(N.selectionInactiveBackground,A.selectionBackgroundTransparent),A.selectionInactiveBackgroundOpaque=x.color.blend(A.background,A.selectionInactiveBackgroundTransparent),A.selectionForeground=N.selectionForeground?R(N.selectionForeground,x.NULL_COLOR):void 0,A.selectionForeground===x.NULL_COLOR&&(A.selectionForeground=void 0),x.color.isOpaque(A.selectionBackgroundTransparent)&&(A.selectionBackgroundTransparent=x.color.opacity(A.selectionBackgroundTransparent,.3)),x.color.isOpaque(A.selectionInactiveBackgroundTransparent)&&(A.selectionInactiveBackgroundTransparent=x.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 B=Math.min(A.ansi.length-16,N.extendedAnsi.length);for(let V=0;V<B;V++)A.ansi[V+16]=R(N.extendedAnsi[V],c.DEFAULT_ANSI_COLORS[V+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 x.css.toColor(N)}catch{}return A}c.ThemeService=L=d([v(0,w.IOptionsService)],L)},6349:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const d=h(8460),v=h(844);class g extends v.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,v=5){if(typeof d!="object")return d;const g=Array.isArray(d)?[]:{};for(const x in d)g[x]=v<=1?d[x]:d[x]&&h(d[x],v-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,v=0,g=0;var x,C,T,w,m;function b(S){const k=S.toString(16);return k.length<2?"0"+k:k}function _(S,k){return S<k?(k+.05)/(S+.05):(S+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(S){S.toCss=function(k,L,R,N){return N!==void 0?`#${b(k)}${b(L)}${b(R)}${b(N)}`:`#${b(k)}${b(L)}${b(R)}`},S.toRgba=function(k,L,R,N=255){return(k<<24|L<<16|R<<8|N)>>>0},S.toColor=function(k,L,R,N){return{css:S.toCss(k,L,R,N),rgba:S.toRgba(k,L,R,N)}}})(x||(c.channels=x={})),(function(S){function k(L,R){return g=Math.round(255*R),[h,d,v]=m.toChannels(L.rgba),{css:x.toCss(h,d,v,g),rgba:x.toRgba(h,d,v,g)}}S.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,B=R.rgba>>8&255,V=L.rgba>>24&255,U=L.rgba>>16&255,W=L.rgba>>8&255;return h=V+Math.round((N-V)*g),d=U+Math.round((A-U)*g),v=W+Math.round((B-W)*g),{css:x.toCss(h,d,v),rgba:x.toRgba(h,d,v)}},S.isOpaque=function(L){return(255&L.rgba)==255},S.ensureContrastRatio=function(L,R,N){const A=m.ensureContrastRatio(L.rgba,R.rgba,N);if(A)return x.toColor(A>>24&255,A>>16&255,A>>8&255)},S.opaque=function(L){const R=(255|L.rgba)>>>0;return[h,d,v]=m.toChannels(R),{css:x.toCss(h,d,v),rgba:R}},S.opacity=k,S.multiplyOpacity=function(L,R){return g=255&L.rgba,k(L,g*R/255)},S.toColorRGB=function(L){return[L.rgba>>24&255,L.rgba>>16&255,L.rgba>>8&255]}})(C||(c.color=C={})),(function(S){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{}S.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),v=parseInt(R.slice(3,4).repeat(2),16),x.toColor(h,d,v);case 5:return h=parseInt(R.slice(1,2).repeat(2),16),d=parseInt(R.slice(2,3).repeat(2),16),v=parseInt(R.slice(3,4).repeat(2),16),g=parseInt(R.slice(4,5).repeat(2),16),x.toColor(h,d,v,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]),v=parseInt(N[3]),g=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),x.toColor(h,d,v,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,v,g]=k.getImageData(0,0,1,1).data,g!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:x.toRgba(h,d,v,g),css:R}}})(T||(c.css=T={})),(function(S){function k(L,R,N){const A=L/255,B=R/255,V=N/255;return .2126*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(V<=.03928?V/12.92:Math.pow((V+.055)/1.055,2.4))}S.relativeLuminance=function(L){return k(L>>16&255,L>>8&255,255&L)},S.relativeLuminance2=k})(w||(c.rgb=w={})),(function(S){function k(R,N,A){const B=R>>24&255,V=R>>16&255,U=R>>8&255;let W=N>>24&255,I=N>>16&255,X=N>>8&255,Y=_(w.relativeLuminance2(W,I,X),w.relativeLuminance2(B,V,U));for(;Y<A&&(W>0||I>0||X>0);)W-=Math.max(0,Math.ceil(.1*W)),I-=Math.max(0,Math.ceil(.1*I)),X-=Math.max(0,Math.ceil(.1*X)),Y=_(w.relativeLuminance2(W,I,X),w.relativeLuminance2(B,V,U));return(W<<24|I<<16|X<<8|255)>>>0}function L(R,N,A){const B=R>>24&255,V=R>>16&255,U=R>>8&255;let W=N>>24&255,I=N>>16&255,X=N>>8&255,Y=_(w.relativeLuminance2(W,I,X),w.relativeLuminance2(B,V,U));for(;Y<A&&(W<255||I<255||X<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),I=Math.min(255,I+Math.ceil(.1*(255-I))),X=Math.min(255,X+Math.ceil(.1*(255-X))),Y=_(w.relativeLuminance2(W,I,X),w.relativeLuminance2(B,V,U));return(W<<24|I<<16|X<<8|255)>>>0}S.blend=function(R,N){if(g=(255&N)/255,g===1)return N;const A=N>>24&255,B=N>>16&255,V=N>>8&255,U=R>>24&255,W=R>>16&255,I=R>>8&255;return h=U+Math.round((A-U)*g),d=W+Math.round((B-W)*g),v=I+Math.round((V-I)*g),x.toRgba(h,d,v)},S.ensureContrastRatio=function(R,N,A){const B=w.relativeLuminance(R>>8),V=w.relativeLuminance(N>>8);if(_(B,V)<A){if(V<B){const I=k(R,N,A),X=_(B,w.relativeLuminance(I>>8));if(X<A){const Y=L(R,N,A);return X>_(B,w.relativeLuminance(Y>>8))?I:Y}return I}const U=L(R,N,A),W=_(B,w.relativeLuminance(U>>8));if(W<A){const I=k(R,N,A);return W>_(B,w.relativeLuminance(I>>8))?U:I}return U}},S.reduceLuminance=k,S.increaseLuminance=L,S.toChannels=function(R){return[R>>24&255,R>>16&255,R>>8&255,255&R]}})(m||(c.rgba=m={})),c.toPaddedHex=b,c.contrastRatio=_},8969:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const d=h(844),v=h(2585),g=h(4348),x=h(7866),C=h(744),T=h(7302),w=h(6975),m=h(8460),b=h(1753),_=h(1480),S=h(7994),k=h(9282),L=h(5435),R=h(5981),N=h(2660);let A=!1;class B extends d.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new m.EventEmitter),this._onScroll.event((U=>{this._onScrollApi?.fire(U.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(U){for(const W in U)this.optionsService.options[W]=U[W]}constructor(U){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(U)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(x.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(_.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(v.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((W=>{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((W=>{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(((W,I)=>this._inputHandler.parse(W,I)))),this.register((0,m.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(U,W){this._writeBuffer.write(U,W)}writeSync(U,W){this._logService.logLevel<=v.LogLevelEnum.WARN&&!A&&(this._logService.warn("writeSync is unreliable and will be removed soon."),A=!0),this._writeBuffer.writeSync(U,W)}input(U,W=!0){this.coreService.triggerDataEvent(U,W)}resize(U,W){isNaN(U)||isNaN(W)||(U=Math.max(U,C.MINIMUM_COLS),W=Math.max(W,C.MINIMUM_ROWS),this._bufferService.resize(U,W))}scroll(U,W=!1){this._bufferService.scroll(U,W)}scrollLines(U,W,I){this._bufferService.scrollLines(U,W,I)}scrollPages(U){this.scrollLines(U*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(U){const W=U-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(U,W){return this._inputHandler.registerEscHandler(U,W)}registerDcsHandler(U,W){return this._inputHandler.registerDcsHandler(U,W)}registerCsiHandler(U,W){return this._inputHandler.registerCsiHandler(U,W)}registerOscHandler(U,W){return this._inputHandler.registerOscHandler(U,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let U=!1;const W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?U=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(U=!0),U?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const U=[];U.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),U.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,d.toDisposable)((()=>{for(const W of U)W.dispose()}))}}}c.CoreTerminal=B},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 v=[];for(let g=0;g<this._listeners.length;g++)v.push(this._listeners[g]);for(let g=0;g<v.length;g++)v[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((v=>d.fire(v)))},c.runAndSubscribe=function(h,d){return d(void 0),h((v=>d(v)))}},5435:function(p,c,h){var d=this&&this.__decorate||function(K,j,z,D){var F,J=arguments.length,ne=J<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,z):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(K,j,z,D);else for(var Z=K.length-1;Z>=0;Z--)(F=K[Z])&&(ne=(J<3?F(ne):J>3?F(j,z,ne):F(j,z))||ne);return J>3&&ne&&Object.defineProperty(j,z,ne),ne},v=this&&this.__param||function(K,j){return function(z,D){j(z,D,K)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const g=h(2584),x=h(7116),C=h(2015),T=h(844),w=h(482),m=h(8437),b=h(8460),_=h(643),S=h(511),k=h(3734),L=h(2585),R=h(1480),N=h(6242),A=h(6351),B=h(5941),V={"(":0,")":1,"*":2,"+":3,"-":1,".":2},U=131072;function W(K,j){if(K>24)return j.setWinLines||!1;switch(K){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 I;(function(K){K[K.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",K[K.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(I||(c.WindowsOptionsReportType=I={}));let X=0;class Y extends T.Disposable{getAttrData(){return this._curAttrData}constructor(j,z,D,F,J,ne,Z,re,q=new C.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=z,this._coreService=D,this._logService=F,this._optionsService=J,this._oscLinkService=ne,this._coreMouseService=Z,this._unicodeService=re,this._parser=q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new S.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 P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((H=>this._activeBuffer=H.activeBuffer))),this._parser.setCsiHandlerFallback(((H,se)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(H),params:se.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,se,de)=>{this._logService.debug("Unknown OSC code: ",{identifier:H,action:se,data:de})})),this._parser.setDcsHandlerFallback(((H,se,de)=>{se==="HOOK"&&(de=de.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(H),action:se,payload:de})})),this._parser.setPrintHandler(((H,se,de)=>this.print(H,se,de))),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 x.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,se)=>this.requestStatusString(H,se))))}_preserveStack(j,z,D,F){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=z,this._parseStack.decodedLength=D,this._parseStack.position=F}_logSlowResolvingAsync(j){this._logService.logLevel<=L.LogLevelEnum.WARN&&Promise.race([j,new Promise(((z,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((z=>{if(z!=="#SLOW_TIMEOUT")throw z;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(j,z){let D,F=this._activeBuffer.x,J=this._activeBuffer.y,ne=0;const Z=this._parseStack.paused;if(Z){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,z))return this._logSlowResolvingAsync(D),D;F=this._parseStack.cursorStartX,J=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>U&&(ne=this._parseStack.position+U)}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<U&&(this._parseBuffer=new Uint32Array(Math.min(j.length,U))),Z||this._dirtyRowTracker.clearRange(),j.length>U)for(let H=ne;H<j.length;H+=U){const se=H+U<j.length?H+U:j.length,de=typeof j=="string"?this._stringDecoder.decode(j.substring(H,se),this._parseBuffer):this._utf8Decoder.decode(j.subarray(H,se),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,de))return this._preserveStack(F,J,de,H),this._logSlowResolvingAsync(D),D}else if(!Z){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(F,J,H,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===F&&this._activeBuffer.y===J||this._onCursorMove.fire();const re=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);q<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(q,this._bufferService.rows-1),Math.min(re,this._bufferService.rows-1))}print(j,z,D){let F,J;const ne=this._charsetService.charset,Z=this._optionsService.rawOptions.screenReaderMode,re=this._bufferService.cols,q=this._coreService.decPrivateModes.wraparound,H=this._coreService.modes.insertMode,se=this._curAttrData;let de=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-z>0&&de.getWidth(this._activeBuffer.x-1)===2&&de.setCellFromCodepoint(this._activeBuffer.x-1,0,1,se);let xe=this._parser.precedingJoinState;for(let ye=z;ye<D;++ye){if(F=j[ye],F<127&&ne){const ht=ne[String.fromCharCode(F)];ht&&(F=ht.charCodeAt(0))}const Me=this._unicodeService.charProperties(F,xe);J=R.UnicodeService.extractWidth(Me);const Oe=R.UnicodeService.extractShouldJoin(Me),Fe=Oe?R.UnicodeService.extractWidth(xe):0;if(xe=Me,Z&&this._onA11yChar.fire((0,w.stringFromCodePoint)(F)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+J-Fe>re){if(q){const ht=de;let Ae=this._activeBuffer.x-Fe;for(this._activeBuffer.x=Fe,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),de=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Fe>0&&de instanceof m.BufferLine&&de.copyCellsFrom(ht,Ae,0,Fe,!1);Ae<re;)ht.setCellFromCodepoint(Ae++,0,1,se)}else if(this._activeBuffer.x=re-1,J===2)continue}if(Oe&&this._activeBuffer.x){const ht=de.getWidth(this._activeBuffer.x-1)?1:2;de.addCodepointToCell(this._activeBuffer.x-ht,F,J);for(let Ae=J-Fe;--Ae>=0;)de.setCellFromCodepoint(this._activeBuffer.x++,0,0,se)}else if(H&&(de.insertCells(this._activeBuffer.x,J-Fe,this._activeBuffer.getNullCell(se)),de.getWidth(re-1)===2&&de.setCellFromCodepoint(re-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,se)),de.setCellFromCodepoint(this._activeBuffer.x++,F,J,se),J>0)for(;--J;)de.setCellFromCodepoint(this._activeBuffer.x++,0,0,se)}this._parser.precedingJoinState=xe,this._activeBuffer.x<re&&D-z>0&&de.getWidth(this._activeBuffer.x)===0&&!de.hasContent(this._activeBuffer.x)&&de.setCellFromCodepoint(this._activeBuffer.x,0,1,se),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,z){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,z):this._parser.registerCsiHandler(j,(D=>!W(D.params[0],this._optionsService.rawOptions.windowOptions)||z(D)))}registerDcsHandler(j,z){return this._parser.registerDcsHandler(j,new A.DcsHandler(z))}registerEscHandler(j,z){return this._parser.registerEscHandler(j,z)}registerOscHandler(j,z){return this._parser.registerOscHandler(j,new N.OscHandler(z))}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,z){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+z):(this._activeBuffer.x=j,this._activeBuffer.y=z),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,z){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+z)}cursorUp(j){const z=this._activeBuffer.y-this._activeBuffer.scrollTop;return z>=0?this._moveCursor(0,-Math.min(z,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const z=this._activeBuffer.scrollBottom-this._activeBuffer.y;return z>=0?this._moveCursor(0,Math.min(z,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 z=j.params[0];return z===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:z===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=j.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=j.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const z=j.params[0];return z===1&&(this._curAttrData.bg|=536870912),z!==2&&z!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,z,D,F=!1,J=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);ne.replaceCells(z,D,this._activeBuffer.getNullCell(this._eraseAttrData()),J),F&&(ne.isWrapped=!1)}_resetBufferLine(j,z=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),z),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),D.isWrapped=!1)}eraseInDisplay(j,z=!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,z);D<this._bufferService.rows;D++)this._resetBufferLine(D,z);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,z),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,z);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,z);this._dirtyRowTracker.markDirty(0);break;case 3:const F=this._activeBuffer.lines.length-this._bufferService.rows;F>0&&(this._activeBuffer.lines.trimStart(F),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-F,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-F,0),this._onScroll.fire(0))}return!0}eraseInLine(j,z=!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,z);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,z);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,z)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(j){this._restrictCursor();let z=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,F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,J=this._bufferService.rows-1+this._activeBuffer.ybase-F+1;for(;z--;)this._activeBuffer.lines.splice(J-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 z=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 F;for(F=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-F;z--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(F,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 z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.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 z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let z=j.params[0]||1;for(;z--;)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 z=j.params[0]||1;for(;z--;)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 z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);F.deleteCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),F.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 z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);F.insertCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),F.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 z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);F.insertCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),F.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 z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);F.deleteCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),F.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.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 z=this._parser.precedingJoinState;if(!z)return!0;const D=j.params[0]||1,F=R.UnicodeService.extractWidth(z),J=this._activeBuffer.x-F,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(J),Z=new Uint32Array(ne.length*D);let re=0;for(let H=0;H<ne.length;){const se=ne.codePointAt(H)||0;Z[re++]=se,H+=se>65535?2:1}let q=re;for(let H=1;H<D;++H)Z.copyWithin(q,0,re),q+=re;return this.print(Z,0,q),!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 z=0;z<j.length;z++)switch(j.params[z]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let z=0;z<j.length;z++)switch(j.params[z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,x.DEFAULT_CHARSET),this._charsetService.setgCharset(1,x.DEFAULT_CHARSET),this._charsetService.setgCharset(2,x.DEFAULT_CHARSET),this._charsetService.setgCharset(3,x.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 z=0;z<j.length;z++)switch(j.params[z]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let z=0;z<j.length;z++)switch(j.params[z]){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[z]===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,z){const D=this._coreService.decPrivateModes,{activeProtocol:F,activeEncoding:J}=this._coreMouseService,ne=this._coreService,{buffers:Z,cols:re}=this._bufferService,{active:q,alt:H}=Z,se=this._optionsService.rawOptions,de=Oe=>Oe?1:2,xe=j.params[0];return ye=xe,Me=z?xe===2?4:xe===4?de(ne.modes.insertMode):xe===12?3:xe===20?de(se.convertEol):0:xe===1?de(D.applicationCursorKeys):xe===3?se.windowOptions.setWinLines?re===80?2:re===132?1:0:0:xe===6?de(D.origin):xe===7?de(D.wraparound):xe===8?3:xe===9?de(F==="X10"):xe===12?de(se.cursorBlink):xe===25?de(!ne.isCursorHidden):xe===45?de(D.reverseWraparound):xe===66?de(D.applicationKeypad):xe===67?4:xe===1e3?de(F==="VT200"):xe===1002?de(F==="DRAG"):xe===1003?de(F==="ANY"):xe===1004?de(D.sendFocus):xe===1005?4:xe===1006?de(J==="SGR"):xe===1015?4:xe===1016?de(J==="SGR_PIXELS"):xe===1048?1:xe===47||xe===1047||xe===1049?de(q===H):xe===2004?de(D.bracketedPasteMode):0,ne.triggerDataEvent(`${g.C0.ESC}[${z?"":"?"}${ye};${Me}$y`),!0;var ye,Me}_updateAttrColor(j,z,D,F,J){return z===2?(j|=50331648,j&=-16777216,j|=k.AttributeData.fromColorRGB([D,F,J])):z===5&&(j&=-50331904,j|=33554432|255&D),j}_extractColor(j,z,D){const F=[0,0,-1,0,0,0];let J=0,ne=0;do{if(F[ne+J]=j.params[z+ne],j.hasSubParams(z+ne)){const Z=j.getSubParams(z+ne);let re=0;do F[1]===5&&(J=1),F[ne+re+1+J]=Z[re];while(++re<Z.length&&re+ne+1+J<F.length);break}if(F[1]===5&&ne+J>=2||F[1]===2&&ne+J>=5)break;F[1]&&(J=1)}while(++ne+z<j.length&&ne+J<F.length);for(let Z=2;Z<F.length;++Z)F[Z]===-1&&(F[Z]=0);switch(F[0]){case 38:D.fg=this._updateAttrColor(D.fg,F[1],F[3],F[4],F[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,F[1],F[3],F[4],F[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,F[1],F[3],F[4],F[5])}return ne}_processUnderline(j,z){z.extended=z.extended.clone(),(!~j||j>5)&&(j=1),z.extended.underlineStyle=j,z.fg|=268435456,j===0&&(z.fg&=-268435457),z.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 z=j.length;let D;const F=this._curAttrData;for(let J=0;J<z;J++)D=j.params[J],D>=30&&D<=37?(F.fg&=-50331904,F.fg|=16777216|D-30):D>=40&&D<=47?(F.bg&=-50331904,F.bg|=16777216|D-40):D>=90&&D<=97?(F.fg&=-50331904,F.fg|=16777224|D-90):D>=100&&D<=107?(F.bg&=-50331904,F.bg|=16777224|D-100):D===0?this._processSGR0(F):D===1?F.fg|=134217728:D===3?F.bg|=67108864:D===4?(F.fg|=268435456,this._processUnderline(j.hasSubParams(J)?j.getSubParams(J)[0]:1,F)):D===5?F.fg|=536870912:D===7?F.fg|=67108864:D===8?F.fg|=1073741824:D===9?F.fg|=2147483648:D===2?F.bg|=134217728:D===21?this._processUnderline(2,F):D===22?(F.fg&=-134217729,F.bg&=-134217729):D===23?F.bg&=-67108865:D===24?(F.fg&=-268435457,this._processUnderline(0,F)):D===25?F.fg&=-536870913:D===27?F.fg&=-67108865:D===28?F.fg&=-1073741825:D===29?F.fg&=2147483647:D===39?(F.fg&=-67108864,F.fg|=16777215&m.DEFAULT_ATTR_DATA.fg):D===49?(F.bg&=-67108864,F.bg|=16777215&m.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?J+=this._extractColor(j,J,F):D===53?F.bg|=1073741824:D===55?F.bg&=-1073741825:D===59?(F.extended=F.extended.clone(),F.extended.underlineColor=-1,F.updateExtended()):D===100?(F.fg&=-67108864,F.fg|=16777215&m.DEFAULT_ATTR_DATA.fg,F.bg&=-67108864,F.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 z=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[${z};${D}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const z=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${g.C0.ESC}[?${z};${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 z=j.params[0]||1;switch(z){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=z%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(j){const z=j.params[0]||1;let D;return(j.length<2||(D=j.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>z&&(this._activeBuffer.scrollTop=z-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(j){if(!W(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const z=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:z!==2&&this._onRequestWindowsOptionsReport.fire(I.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(I.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:z!==0&&z!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),z!==0&&z!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:z!==0&&z!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),z!==0&&z!==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 z=[],D=j.split(";");for(;D.length>1;){const F=D.shift(),J=D.shift();if(/^\d+$/.exec(F)){const ne=parseInt(F);if(G(ne))if(J==="?")z.push({type:0,index:ne});else{const Z=(0,B.parseColor)(J);Z&&z.push({type:1,index:ne,color:Z})}}}return z.length&&this._onColor.fire(z),!0}setHyperlink(j){const z=j.split(";");return!(z.length<2)&&(z[1]?this._createHyperlink(z[0],z[1]):!z[0]&&this._finishHyperlink())}_createHyperlink(j,z){this._getCurrentLinkId()&&this._finishHyperlink();const D=j.split(":");let F;const J=D.findIndex((ne=>ne.startsWith("id=")));return J!==-1&&(F=D[J].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:F,uri:z}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(j,z){const D=j.split(";");for(let F=0;F<D.length&&!(z>=this._specialColors.length);++F,++z)if(D[F]==="?")this._onColor.fire([{type:0,index:this._specialColors[z]}]);else{const J=(0,B.parseColor)(D[F]);J&&this._onColor.fire([{type:1,index:this._specialColors[z],color:J}])}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 z=[],D=j.split(";");for(let F=0;F<D.length;++F)if(/^\d+$/.exec(D[F])){const J=parseInt(D[F]);G(J)&&z.push({type:2,index:J})}return z.length&&this._onColor.fire(z),!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,x.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(V[j[0]],x.CHARSETS[j[1]]||x.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 S.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let z=0;z<this._bufferService.rows;++z){const D=this._activeBuffer.ybase+this._activeBuffer.y+z,F=this._activeBuffer.lines.get(D);F&&(F.fill(j),F.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,z){const D=this._bufferService.buffer,F=this._optionsService.rawOptions;return(J=>(this._coreService.triggerDataEvent(`${g.C0.ESC}${J}${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}[F.cursorStyle]-(F.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,z){this._dirtyRowTracker.markRangeDirty(j,z)}}c.InputHandler=Y;let P=class{constructor(K){this._bufferService=K,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(K){K<this.start?this.start=K:K>this.end&&(this.end=K)}markRangeDirty(K,j){K>j&&(X=K,K=j,j=X),K<this.start&&(this.start=K),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(K){return 0<=K&&K<256}P=d([v(0,L.IBufferService)],P)},844:(p,c)=>{function h(d){for(const v of d)v.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 v=this._disposables.indexOf(d);v!==-1&&this._disposables.splice(v,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(v,g,x){this._data[v]||(this._data[v]={}),this._data[v][g]=x}get(v,g){return this._data[v]?this._data[v][g]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(d,v,g,x,C){this._data.get(d,v)||this._data.set(d,v,new h),this._data.get(d,v).set(g,x,C)}get(d,v,g,x){return this._data.get(d,v)?.get(g,x)}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 v=h.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[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 v=this._getKey(d);if(v===void 0||(h=this._search(v),h===-1)||this._getKey(this._array[h])!==v)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])===v);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,v){if(this._array.length!==0&&(h=this._search(d),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===d))do v(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===d)}values(){return[...this._array].values()}_search(d){let v=0,g=this._array.length-1;for(;g>=v;){let x=v+g>>1;const C=this._getKey(this._array[x]);if(C>d)g=x-1;else{if(!(C<d)){for(;x>0&&this._getKey(this._array[x-1])===d;)x--;return x}v=x+1}}return v}}},7226:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const d=h(6114);class v{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 v{_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 v{_requestCallback(x){return requestIdleCallback(x)}_cancelCallback(x){cancelIdleCallback(x)}}:g,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(x){this._queue.clear(),this._queue.enqueue(x)}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(v){const g=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),x=g?.get(v.cols-1),C=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);C&&x&&(C.isWrapped=x[d.CHAR_DATA_CODE_INDEX]!==d.NULL_CELL_CODE&&x[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,x=0){this._ext=0,this._urlId=0,this._ext=g,this._urlId=x}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),v=h(7226),g=h(3734),x=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(_,S,k){this._hasScrollback=_,this._optionsService=S,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=x.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 v.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(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg,this._nullCell.extended=_.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new g.ExtendedAttrs),this._nullCell}getWhitespaceCell(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg,this._whitespaceCell.extended=_.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new g.ExtendedAttrs),this._whitespaceCell}getBlankLine(_,S){return new x.BufferLine(this._bufferService.cols,this.getNullCell(_),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows}_getCorrectBufferLength(_){if(!this._hasScrollback)return _;const S=_+this._optionsService.rawOptions.scrollback;return S>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:S}fillViewportRows(_){if(this.lines.length===0){_===void 0&&(_=x.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(_))}}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(_,S){const k=this.getNullCell(x.DEFAULT_ATTR_DATA);let L=0;const R=this._getCorrectBufferLength(S);if(R>this.lines.maxLength&&(this.lines.maxLength=R),this.lines.length>0){if(this._cols<_)for(let A=0;A<this.lines.length;A++)L+=+this.lines.get(A).resize(_,k);let N=0;if(this._rows<S)for(let A=this._rows;A<S;A++)this.lines.length<S+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new x.BufferLine(_,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 x.BufferLine(_,k)));else for(let A=this._rows;A>S;A--)this.lines.length>S+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,_-1),this.y=Math.min(this.y,S-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(_,S),this._cols>_))for(let N=0;N<this.lines.length;N++)L+=+this.lines.get(N).resize(_,k);this._cols=_,this._rows=S,this._memoryCleanupQueue.clear(),L>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let _=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,_=!1);let S=0;for(;this._memoryCleanupPosition<this.lines.length;)if(S+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),S>100)return!0;return _}get _isReflowEnabled(){const _=this._optionsService.rawOptions.windowsPty;return _&&_.buildNumber?this._hasScrollback&&_.backend==="conpty"&&_.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(_,S){this._cols!==_&&(_>this._cols?this._reflowLarger(_,S):this._reflowSmaller(_,S))}_reflowLarger(_,S){const k=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(x.DEFAULT_ATTR_DATA));if(k.length>0){const L=(0,C.reflowLargerCreateNewLayout)(this.lines,k);(0,C.reflowLargerApplyNewLayout)(this.lines,L.layout),this._reflowLargerAdjustViewport(_,S,L.countRemoved)}}_reflowLargerAdjustViewport(_,S,k){const L=this.getNullCell(x.DEFAULT_ATTR_DATA);let R=k;for(;R-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<S&&this.lines.push(new x.BufferLine(_,L))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(_,S){const k=this.getNullCell(x.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()<=_)continue;const B=[A];for(;A.isWrapped&&N>0;)A=this.lines.get(--N),B.unshift(A);const V=this.ybase+this.y;if(V>=N&&V<N+B.length)continue;const U=B[B.length-1].getTrimmedLength(),W=(0,C.reflowSmallerGetNewLineLengths)(B,this._cols,_),I=W.length-B.length;let X;X=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+I):Math.max(0,this.lines.length-this.lines.maxLength+I);const Y=[];for(let D=0;D<I;D++){const F=this.getBlankLine(x.DEFAULT_ATTR_DATA,!0);Y.push(F)}Y.length>0&&(L.push({start:N+B.length+R,newLines:Y}),R+=Y.length),B.push(...Y);let P=W.length-1,G=W[P];G===0&&(P--,G=W[P]);let K=B.length-I-1,j=U;for(;K>=0;){const D=Math.min(j,G);if(B[P]===void 0)break;if(B[P].copyCellsFrom(B[K],j-D,G-D,D,!0),G-=D,G===0&&(P--,G=W[P]),j-=D,j===0){K--;const F=Math.max(K,0);j=(0,C.getWrappedLineTrimmedLength)(B,F,this._cols)}}for(let D=0;D<B.length;D++)W[D]<_&&B[D].setCell(W[D],k);let z=I-X;for(;z-- >0;)this.ybase===0?this.y<S-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+R)-S&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+I,this.ybase+S-1)}if(L.length>0){const N=[],A=[];for(let P=0;P<this.lines.length;P++)A.push(this.lines.get(P));const B=this.lines.length;let V=B-1,U=0,W=L[U];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+R);let I=0;for(let P=Math.min(this.lines.maxLength-1,B+R-1);P>=0;P--)if(W&&W.start>V+I){for(let G=W.newLines.length-1;G>=0;G--)this.lines.set(P--,W.newLines[G]);P++,N.push({index:V+1,amount:W.newLines.length}),I+=W.newLines.length,W=L[++U]}else this.lines.set(P,A[V--]);let X=0;for(let P=N.length-1;P>=0;P--)N[P].index+=X,this.lines.onInsertEmitter.fire(N[P]),X+=N[P].amount;const Y=Math.max(0,B+R-this.lines.maxLength);Y>0&&this.lines.onTrimEmitter.fire(Y)}}translateBufferLineToString(_,S,k=0,L){const R=this.lines.get(_);return R?R.translateToString(S,k,L):""}getWrappedRangeForLine(_){let S=_,k=_;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:S,last:k}}setupTabStops(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.rawOptions.tabStopWidth)this.tabs[_]=!0}prevStop(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_}nextStop(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_}clearMarkers(_){this._isClearing=!0;for(let S=0;S<this.markers.length;S++)this.markers[S].line===_&&(this.markers[S].dispose(),this.markers.splice(S--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].dispose(),this.markers.splice(_--,1);this._isClearing=!1}addMarker(_){const S=new m.Marker(_);return this.markers.push(S),S.register(this.lines.onTrim((k=>{S.line-=k,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((k=>{S.line>=k.index&&(S.line+=k.amount)}))),S.register(this.lines.onDelete((k=>{S.line>=k.index&&S.line<k.index+k.amount&&S.dispose(),S.line>k.index&&(S.line-=k.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(_){this._isClearing||this.markers.splice(this.markers.indexOf(_),1)}}},8437:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const d=h(3734),v=h(511),g=h(643),x=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new d.AttributeData);let C=0;class T{constructor(m,b,_=!1){this.isWrapped=_,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*m);const S=b||v.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,S);this.length=m}get(m){const b=this._data[3*m+0],_=2097151&b;return[this._data[3*m+1],2097152&b?this._combined[m]:_?(0,x.stringFromCodePoint)(_):"",b>>22,2097152&b?this._combined[m].charCodeAt(this._combined[m].length-1):_]}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,x.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,_,S){268435456&S.bg&&(this._extendedAttrs[m]=S.extended),this._data[3*m+0]=b|_<<22,this._data[3*m+1]=S.fg,this._data[3*m+2]=S.bg}addCodepointToCell(m,b,_){let S=this._data[3*m+0];2097152&S?this._combined[m]+=(0,x.stringFromCodePoint)(b):2097151&S?(this._combined[m]=(0,x.stringFromCodePoint)(2097151&S)+(0,x.stringFromCodePoint)(b),S&=-2097152,S|=2097152):S=b|4194304,_&&(S&=-12582913,S|=_<<22),this._data[3*m+0]=S}insertCells(m,b,_){if((m%=this.length)&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,_),b<this.length-m){const S=new v.CellData;for(let k=this.length-m-b-1;k>=0;--k)this.setCell(m+b+k,this.loadCell(m+k,S));for(let k=0;k<b;++k)this.setCell(m+k,_)}else for(let S=m;S<this.length;++S)this.setCell(S,_);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,_)}deleteCells(m,b,_){if(m%=this.length,b<this.length-m){const S=new v.CellData;for(let k=0;k<this.length-m-b;++k)this.setCell(m+k,this.loadCell(m+b+k,S));for(let k=this.length-b;k<this.length;++k)this.setCell(k,_)}else for(let S=m;S<this.length;++S)this.setCell(S,_);m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,_),this.getWidth(m)!==0||this.hasContent(m)||this.setCellFromCodepoint(m,0,1,_)}replaceCells(m,b,_,S=!1){if(S)for(m&&this.getWidth(m-1)===2&&!this.isProtected(m-1)&&this.setCellFromCodepoint(m-1,0,1,_),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,_);m<b&&m<this.length;)this.isProtected(m)||this.setCell(m,_),m++;else for(m&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m-1,0,1,_),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,_);m<b&&m<this.length;)this.setCell(m++,_)}resize(m,b){if(m===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const _=3*m;if(m>this.length){if(this._data.buffer.byteLength>=4*_)this._data=new Uint32Array(this._data.buffer,0,_);else{const S=new Uint32Array(_);S.set(this._data),this._data=S}for(let S=this.length;S<m;++S)this.setCell(S,b)}else{this._data=this._data.subarray(0,_);const S=Object.keys(this._combined);for(let L=0;L<S.length;L++){const R=parseInt(S[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*_*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 _=0;_<this.length;++_)this.isProtected(_)||this.setCell(_,m);else{this._combined={},this._extendedAttrs={};for(let _=0;_<this.length;++_)this.setCell(_,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,_,S,k){const L=m._data;if(k)for(let N=S-1;N>=0;N--){for(let A=0;A<3;A++)this._data[3*(_+N)+A]=L[3*(b+N)+A];268435456&L[3*(b+N)+2]&&(this._extendedAttrs[_+N]=m._extendedAttrs[b+N])}else for(let N=0;N<S;N++){for(let A=0;A<3;A++)this._data[3*(_+N)+A]=L[3*(b+N)+A];268435456&L[3*(b+N)+2]&&(this._extendedAttrs[_+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+_]=m._combined[A])}}translateToString(m,b,_,S){b=b??0,_=_??this.length,m&&(_=Math.min(_,this.getTrimmedLength())),S&&(S.length=0);let k="";for(;b<_;){const L=this._data[3*b+0],R=2097151&L,N=2097152&L?this._combined[b]:R?(0,x.stringFromCodePoint)(R):g.WHITESPACE_CELL_CHAR;if(k+=N,S)for(let A=0;A<N.length;++A)S.push(b);b+=L>>22||1}return S&&S.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,v,g){if(v===d.length-1)return d[v].getTrimmedLength();const x=!d[v].hasContent(g-1)&&d[v].getWidth(g-1)===1,C=d[v+1].getWidth(0)===2;return x&&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,v,g,x,C){const T=[];for(let w=0;w<d.length-1;w++){let m=w,b=d.get(++m);if(!b.isWrapped)continue;const _=[d.get(w)];for(;m<d.length&&b.isWrapped;)_.push(b),b=d.get(++m);if(x>=w&&x<m){w+=_.length-1;continue}let S=0,k=h(_,S,v),L=1,R=0;for(;L<_.length;){const A=h(_,L,v),B=A-R,V=g-k,U=Math.min(B,V);_[S].copyCellsFrom(_[L],R,k,U,!1),k+=U,k===g&&(S++,k=0),R+=U,R===A&&(L++,R=0),k===0&&S!==0&&_[S-1].getWidth(g-1)===2&&(_[S].copyCellsFrom(_[S-1],g-1,k++,1,!1),_[S-1].setCell(g-1,C))}_[S].replaceCells(k,g,C);let N=0;for(let A=_.length-1;A>0&&(A>S||_[A].getTrimmedLength()===0);A--)N++;N>0&&(T.push(w+_.length-N),T.push(N)),w+=_.length-1}return T},c.reflowLargerCreateNewLayout=function(d,v){const g=[];let x=0,C=v[x],T=0;for(let w=0;w<d.length;w++)if(C===w){const m=v[++x];d.onDeleteEmitter.fire({index:w-T,amount:m}),w+=m-1,T+=m,C=v[++x]}else g.push(w);return{layout:g,countRemoved:T}},c.reflowLargerApplyNewLayout=function(d,v){const g=[];for(let x=0;x<v.length;x++)g.push(d.get(v[x]));for(let x=0;x<g.length;x++)d.set(x,g[x]);d.length=v.length},c.reflowSmallerGetNewLineLengths=function(d,v,g){const x=[],C=d.map(((b,_)=>h(d,_,v))).reduce(((b,_)=>b+_));let T=0,w=0,m=0;for(;m<C;){if(C-m<g){x.push(C-m);break}T+=g;const b=h(d,w,v);T>b&&(T-=b,w++);const _=d[w].getWidth(T-1)===2;_&&T--;const S=_?g-1:g;x.push(S),m+=S}return x},c.getWrappedLineTrimmedLength=h},5295:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const d=h(8460),v=h(844),g=h(9092);class x extends v.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=x},511:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const d=h(482),v=h(643),g=h(3734);class x 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 x;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[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(T[v.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(T[v.CHAR_DATA_CHAR_INDEX].length===2){const m=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=m&&m<=56319){const b=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(m-55296)+b-56320+65536|T[v.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[v.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=T[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=x},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),v=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,v.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,v;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}\\`})(v||(c.C1_ESCAPED=v={}))},7399:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const d=h(2584),v={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,x,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=x?d.C0.ESC+"OA":d.C0.ESC+"[A":g.key==="UIKeyInputLeftArrow"?w.key=x?d.C0.ESC+"OD":d.C0.ESC+"[D":g.key==="UIKeyInputRightArrow"?w.key=x?d.C0.ESC+"OC":d.C0.ESC+"[C":g.key==="UIKeyInputDownArrow"&&(w.key=x?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=x?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=x?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=x?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=x?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":x?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:w.key=m?d.C0.ESC+"[1;"+(m+1)+"F":x?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=v[g.keyCode],_=b?.[g.shiftKey?1:0];if(_)w.key=d.C0.ESC+_;else if(g.keyCode>=65&&g.keyCode<=90){const S=g.ctrlKey?g.keyCode-64:g.keyCode+32;let k=String.fromCharCode(S);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 S=g.code.slice(3,4);g.shiftKey||(S=S.toLowerCase()),w.key=d.C0.ESC+S,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,v=h.length){let g="";for(let x=d;x<v;++x){let C=h[x];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 v=h.length;if(!v)return 0;let g=0,x=0;if(this._interim){const C=h.charCodeAt(x++);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=x;C<v;++C){const T=h.charCodeAt(C);if(55296<=T&&T<=56319){if(++C>=v)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 v=h.length;if(!v)return 0;let g,x,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,B=A-N;for(;b<B;){if(b>=v)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 S=b;for(;S<v;){for(;!(!(S<_)||128&(g=h[S])||128&(x=h[S+1])||128&(C=h[S+2])||128&(T=h[S+3]));)d[w++]=g,d[w++]=x,d[w++]=C,d[w++]=T,S+=4;if(g=h[S++],g<128)d[w++]=g;else if((224&g)==192){if(S>=v)return this.interim[0]=g,w;if(x=h[S++],(192&x)!=128){S--;continue}if(m=(31&g)<<6|63&x,m<128){S--;continue}d[w++]=m}else if((240&g)==224){if(S>=v)return this.interim[0]=g,w;if(x=h[S++],(192&x)!=128){S--;continue}if(S>=v)return this.interim[0]=g,this.interim[1]=x,w;if(C=h[S++],(192&C)!=128){S--;continue}if(m=(15&g)<<12|(63&x)<<6|63&C,m<2048||m>=55296&&m<=57343||m===65279)continue;d[w++]=m}else if((248&g)==240){if(S>=v)return this.interim[0]=g,w;if(x=h[S++],(192&x)!=128){S--;continue}if(S>=v)return this.interim[0]=g,this.interim[1]=x,w;if(C=h[S++],(192&C)!=128){S--;continue}if(S>=v)return this.interim[0]=g,this.interim[1]=x,this.interim[2]=C,w;if(T=h[S++],(192&T)!=128){S--;continue}if(m=(7&g)<<18|(63&x)<<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),v=[[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 x;c.UnicodeV6=class{constructor(){if(this.version="6",!x){x=new Uint8Array(65536),x.fill(1),x[0]=0,x.fill(0,1,32),x.fill(0,127,160),x.fill(2,4352,4448),x[9001]=2,x[9002]=2,x.fill(2,11904,42192),x[12351]=1,x.fill(2,44032,55204),x.fill(2,63744,64256),x.fill(2,65040,65050),x.fill(2,65072,65136),x.fill(2,65280,65377),x.fill(2,65504,65511);for(let C=0;C<v.length;++C)x.fill(0,v[C][0],v[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?x[C]:(function(T,w){let m,b=0,_=w.length-1;if(T<w[0][0]||T>w[_][1])return!1;for(;_>=b;)if(m=b+_>>1,T>w[m][1])b=m+1;else{if(!(T<w[m][0]))return!0;_=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),v=h(844);class g extends v.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 S=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(S)}const _=this._callbacks[this._bufferOffset];if(_&&_(),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 v(g,x){const C=g.toString(16),T=C.length<2?"0"+C:C;switch(x){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 x=g.toLowerCase();if(x.indexOf("rgb:")===0){x=x.slice(4);const C=h.exec(x);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(x.indexOf("#")===0&&(x=x.slice(1),d.exec(x)&&[3,6,9,12].includes(x.length))){const C=x.length/3,T=[0,0,0];for(let w=0;w<3;++w){const m=parseInt(x.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,x=16){const[C,T,w]=g;return`rgb:${v(C,x)}/${v(T,x)}/${v(w,x)}`}},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),v=h(8742),g=h(5770),x=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=x,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=x}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=x,this._ident=0}hook(T,w){if(this.reset(),this._ident=T,this._active=this._handlers[T]||x,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,_=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,m=w,_=this._stack.fallThrough,this._stack.paused=!1),!_&&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=x,this._ident=0}};const C=new v.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),v=h(8742),g=h(6242),x=h(6351);class C{constructor(b){this.table=new Uint8Array(b)}setDefault(b,_){this.table.fill(b<<4|_)}add(b,_,S,k){this.table[_<<8|b]=S<<4|k}addMany(b,_,S,k){for(let L=0;L<b.length;L++)this.table[_<<8|b[L]]=S<<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)),_=(N,A)=>b.slice(N,A),S=_(32,127),k=_(0,24);k.push(25),k.push.apply(k,_(28,32));const L=_(0,14);let R;for(R in m.setDefault(1,0),m.addMany(S,0,2,0),L)m.addMany([24,26,153,154],R,3,0),m.addMany(_(128,144),R,3,0),m.addMany(_(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(S,8,5,8),m.add(127,8,5,8),m.addMany([156,27,24,26,7],8,6,0),m.addMany(_(28,32),8,0,8),m.addMany([88,94,95],1,0,7),m.addMany(S,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(_(64,127),3,7,0),m.addMany(_(48,60),3,8,4),m.addMany([60,61,62,63],3,9,4),m.addMany(_(48,60),4,8,4),m.addMany(_(64,127),4,7,0),m.addMany([60,61,62,63],4,0,6),m.addMany(_(32,64),6,0,6),m.add(127,6,0,6),m.addMany(_(64,127),6,0,0),m.addMany(_(32,48),3,9,5),m.addMany(_(32,48),5,9,5),m.addMany(_(48,64),5,0,6),m.addMany(_(64,127),5,7,0),m.addMany(_(32,48),4,9,5),m.addMany(_(32,48),1,9,2),m.addMany(_(32,48),2,9,2),m.addMany(_(48,127),2,10,0),m.addMany(_(48,80),1,10,0),m.addMany(_(81,88),1,10,0),m.addMany([89,90,92],1,10,0),m.addMany(_(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(_(28,32),9,0,9),m.addMany(_(32,48),9,9,12),m.addMany(_(48,60),9,8,10),m.addMany([60,61,62,63],9,9,10),m.addMany(k,11,0,11),m.addMany(_(32,128),11,0,11),m.addMany(_(28,32),11,0,11),m.addMany(k,10,0,10),m.add(127,10,0,10),m.addMany(_(28,32),10,0,10),m.addMany(_(48,60),10,8,10),m.addMany([60,61,62,63],10,0,11),m.addMany(_(32,48),10,9,12),m.addMany(k,12,0,12),m.add(127,12,0,12),m.addMany(_(28,32),12,0,12),m.addMany(_(32,48),12,9,12),m.addMany(_(48,64),12,0,11),m.addMany(_(64,127),12,12,13),m.addMany(_(64,127),10,12,13),m.addMany(_(64,127),9,12,13),m.addMany(k,13,13,13),m.addMany(S,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 v.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(_,S,k)=>{},this._executeHandlerFb=_=>{},this._csiHandlerFb=(_,S)=>{},this._escHandlerFb=_=>{},this._errorHandlerFb=_=>_,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 x.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,_=[64,126]){let S=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=b.prefix.charCodeAt(0),S&&60>S||S>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");S<<=8,S|=R}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(_[0]>k||k>_[1])throw new Error(`final must be in range ${_[0]} .. ${_[1]}`);return S<<=8,S|=k,S}identToString(b){const _=[];for(;b;)_.push(String.fromCharCode(255&b)),b>>=8;return _.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,_){const S=this._identifier(b,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const k=this._escHandlers[S];return k.push(_),{dispose:()=>{const L=k.indexOf(_);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,_){this._executeHandlers[b.charCodeAt(0)]=_}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,_){const S=this._identifier(b);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const k=this._csiHandlers[S];return k.push(_),{dispose:()=>{const L=k.indexOf(_);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,_){return this._dcsParser.registerHandler(this._identifier(b),_)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,_){return this._oscParser.registerHandler(b,_)}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,_,S,k,L){this._parseStack.state=b,this._parseStack.handlers=_,this._parseStack.handlerPos=S,this._parseStack.transition=k,this._parseStack.chunkPos=L}parse(b,_,S){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(S===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 B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&B>-1){for(;B>=0&&(k=A[B](this._params),k!==!0);B--)if(k instanceof Promise)return this._parseStack.handlerPos=B,k}this._parseStack.handlers=[];break;case 4:if(S===!1&&B>-1){for(;B>=0&&(k=A[B](),k!==!0);B--)if(k instanceof Promise)return this._parseStack.handlerPos=B,k}this._parseStack.handlers=[];break;case 6:if(L=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(L!==24&&L!==26,S),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,S),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<_;++A){switch(L=b[A],R=this._transitions.table[this.currentState<<8|(L<160?L:T)],R>>4){case 2:for(let I=A+1;;++I){if(I>=_||(L=b[I])<32||L>126&&L<T){this._printHandler(b,A,I),A=I-1;break}if(++I>=_||(L=b[I])<32||L>126&&L<T){this._printHandler(b,A,I),A=I-1;break}if(++I>=_||(L=b[I])<32||L>126&&L<T){this._printHandler(b,A,I),A=I-1;break}if(++I>=_||(L=b[I])<32||L>126&&L<T){this._printHandler(b,A,I),A=I-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 B=this._csiHandlers[this._collect<<8|L];let V=B?B.length-1:-1;for(;V>=0&&(k=B[V](this._params),k!==!0);V--)if(k instanceof Promise)return this._preserveStack(3,B,V,R,A),k;V<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<_&&(L=b[A])>47&&L<60);A--;break;case 9:this._collect<<=8,this._collect|=L;break;case 10:const U=this._escHandlers[this._collect<<8|L];let W=U?U.length-1:-1;for(;W>=0&&(k=U[W](),k!==!0);W--)if(k instanceof Promise)return this._preserveStack(4,U,W,R,A),k;W<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 I=A+1;;++I)if(I>=_||(L=b[I])===24||L===26||L===27||L>127&&L<T){this._dcsParser.put(b,A,I),A=I-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 I=A+1;;I++)if(I>=_||(L=b[I])<32||L>127&&L<T){this._oscParser.put(b,A,I),A=I-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),v=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(x,C){this._handlers[x]===void 0&&(this._handlers[x]=[]);const T=this._handlers[x];return T.push(C),{dispose:()=>{const w=T.indexOf(C);w!==-1&&T.splice(w,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}reset(){if(this._state===2)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].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 x=this._active.length-1;x>=0;x--)this._active[x].start();else this._handlerFb(this._id,"START")}_put(x,C,T){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(x,C,T);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(x,C,T))}start(){this.reset(),this._state=1}put(x,C,T){if(this._state!==3){if(this._state===1)for(;C<T;){const w=x[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(x,C,T)}}end(x,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(x),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",x);this._active=g,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(x){this._handler=x,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(x,C,T){this._hitLimit||(this._data+=(0,v.utf32ToString)(x,C,T),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(x){let C=!1;if(this._hitLimit)C=!1;else if(x&&(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 x=new d;if(!g.length)return x;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)x.addSubParam(T[w]);else x.addParam(T)}return x}constructor(g=32,x=32){if(this.maxLength=g,this.maxSubParamsLength=x,x>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(g),this.length=0,this._subParams=new Int32Array(x),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 x=0;x<this.length;++x){g.push(this.params[x]);const C=this._subParamsIdx[x]>>8,T=255&this._subParamsIdx[x];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 x=this._subParamsIdx[g]>>8,C=255&this._subParamsIdx[g];return C-x>0?this._subParams.subarray(x,C):null}getSubParamsAll(){const g={};for(let x=0;x<this.length;++x){const C=this._subParamsIdx[x]>>8,T=255&this._subParamsIdx[x];T-C>0&&(g[x]=this._subParams.slice(C,T))}return g}addDigit(g){let x;if(this._rejectDigits||!(x=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,T=C[x-1];C[x-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 v={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(v),d.dispose=()=>this._wrappedAddonDispose(v),d.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let d=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===h){d=v;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),v=h(511);c.BufferApiView=class{constructor(g,x){this._buffer=g,this.type=x}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 x=this._buffer.lines.get(g);if(x)return new d.BufferLineApiView(x)}getNullCell(){return new v.CellData}}},3785:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const d=h(511);c.BufferLineApiView=class{constructor(v){this._line=v}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(v,g){if(!(v<0||v>=this._line.length))return g?(this._line.loadCell(v,g),g):this._line.loadCell(v,new d.CellData)}translateToString(v,g,x){return this._line.translateToString(v,g,x)}}},8285:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const d=h(8771),v=h(8460),g=h(844);class x extends g.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new v.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=x},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,(v=>d(v.toArray())))}addCsiHandler(h,d){return this.registerCsiHandler(h,d)}registerDcsHandler(h,d){return this._core.registerDcsHandler(h,((v,g)=>d(v,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,_,S){var k,L=arguments.length,R=L<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,b,_,S);else for(var N=m.length-1;N>=0;N--)(k=m[N])&&(R=(L<3?k(R):L>3?k(b,_,R):k(b,_))||R);return L>3&&R&&Object.defineProperty(b,_,R),R},v=this&&this.__param||function(m,b){return function(_,S){b(_,S,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const g=h(8460),x=h(844),C=h(5295),T=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let w=c.BufferService=class extends x.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 _=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===m.fg&&S.getBg(0)===m.bg||(S=_.getBlankLine(m,b),this._cachedBlankLine=S),S.isWrapped=b;const k=_.ybase+_.scrollTop,L=_.ybase+_.scrollBottom;if(_.scrollTop===0){const R=_.lines.isFull;L===_.lines.length-1?R?_.lines.recycle().copyFrom(S):_.lines.push(S.clone()):_.lines.splice(L+1,0,S.clone()),R?this.isUserScrolling&&(_.ydisp=Math.max(_.ydisp-1,0)):(_.ybase++,this.isUserScrolling||_.ydisp++)}else{const R=L-k+1;_.lines.shiftElements(k+1,R-1,-1),_.lines.set(L,S.clone())}this.isUserScrolling||(_.ydisp=_.ybase),this._onScroll.fire(_.ydisp)}scrollLines(m,b,_){const S=this.buffer;if(m<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else m+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const k=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+m,S.ybase),0),k!==S.ydisp&&(b||this._onScroll.fire(S.ydisp))}};c.BufferService=w=d([v(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(S,k,L,R){var N,A=arguments.length,B=A<3?k:R===null?R=Object.getOwnPropertyDescriptor(k,L):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(S,k,L,R);else for(var V=S.length-1;V>=0;V--)(N=S[V])&&(B=(A<3?N(B):A>3?N(k,L,B):N(k,L))||B);return A>3&&B&&Object.defineProperty(k,L,B),B},v=this&&this.__param||function(S,k){return function(L,R){k(L,R,S)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const g=h(2585),x=h(8460),C=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function w(S,k){let L=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(L|=64,L|=S.action):(L|=3&S.button,4&S.button&&(L|=64),8&S.button&&(L|=128),S.action===32?L|=32:S.action!==0||k||(L|=3)),L}const m=String.fromCharCode,b={DEFAULT:S=>{const k=[w(S,!1)+32,S.col+32,S.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${m(k[0])}${m(k[1])}${m(k[2])}`},SGR:S=>{const k=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.col};${S.row}${k}`},SGR_PIXELS:S=>{const k=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.x};${S.y}${k}`}};let _=c.CoreMouseService=class extends C.Disposable{constructor(S,k){super(),this._bufferService=S,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new x.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(S,k){this._protocols[S]=k}addEncoding(S,k){this._encodings[S]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const k=this._encodings[this._activeEncoding](S);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,k,L){if(L){if(S.x!==k.x||S.y!==k.y)return!1}else if(S.col!==k.col||S.row!==k.row)return!1;return S.button===k.button&&S.action===k.action&&S.ctrl===k.ctrl&&S.alt===k.alt&&S.shift===k.shift}};c.CoreMouseService=_=d([v(0,g.IBufferService),v(1,g.ICoreService)],_)},6975:function(p,c,h){var d=this&&this.__decorate||function(_,S,k,L){var R,N=arguments.length,A=N<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,k):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,S,k,L);else for(var B=_.length-1;B>=0;B--)(R=_[B])&&(A=(N<3?R(A):N>3?R(S,k,A):R(S,k))||A);return N>3&&A&&Object.defineProperty(S,k,A),A},v=this&&this.__param||function(_,S){return function(k,L){S(k,L,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const g=h(1439),x=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(_,S,k){super(),this._bufferService=_,this._logService=S,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new x.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new x.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new x.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new x.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(_,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${_}"`,(()=>_.split("").map((L=>L.charCodeAt(0))))),this._onData.fire(_)}triggerBinaryEvent(_){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${_}"`,(()=>_.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(_))}};c.CoreService=b=d([v(0,T.IBufferService),v(1,T.ILogService),v(2,T.IOptionsService)],b)},9074:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const d=h(8055),v=h(8460),g=h(844),x=h(6106);let C=0,T=0;class w extends g.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new x.SortedList((_=>_?.marker.line)),this._onDecorationRegistered=this.register(new v.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new v.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,g.toDisposable)((()=>this.reset())))}registerDecoration(_){if(_.marker.isDisposed)return;const S=new m(_);if(S){const k=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),k.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const _ of this._decorations.values())_.dispose();this._decorations.clear()}*getDecorationsAtCell(_,S,k){let L=0,R=0;for(const N of this._decorations.getKeyIterator(S))L=N.options.x??0,R=L+(N.options.width??1),_>=L&&_<R&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(_,S,k,L){this._decorations.forEachByKey(S,(R=>{C=R.options.x??0,T=C+(R.options.width??1),_>=C&&_<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(_){super(),this.options=_,this.onRenderEmitter=this.register(new v.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=_.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),v=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(x,C){this._services.set(x,C)}getService(x){return this._services.get(x)}createInstance(x,...C){const T=(0,v.getServiceDependencies)(x).sort(((b,_)=>b.index-_.index)),w=[];for(const b of T){const _=this._services.get(b.id);if(!_)throw new Error(`[createInstance] ${x.name} depends on UNKNOWN service ${b.id}.`);w.push(_)}const m=T.length>0?T[0].index:C.length;if(C.length!==m)throw new Error(`[createInstance] First service dependency of ${x.name} at position ${m+1} conflicts with ${C.length} static arguments`);return new x(...C,...w)}}},7866:function(p,c,h){var d=this&&this.__decorate||function(m,b,_,S){var k,L=arguments.length,R=L<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,_):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,b,_,S);else for(var N=m.length-1;N>=0;N--)(k=m[N])&&(R=(L<3?k(R):L>3?k(b,_,R):k(b,_))||R);return L>3&&R&&Object.defineProperty(b,_,R),R},v=this&&this.__param||function(m,b){return function(_,S){b(_,S,m)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const g=h(844),x=h(2585),C={trace:x.LogLevelEnum.TRACE,debug:x.LogLevelEnum.DEBUG,info:x.LogLevelEnum.INFO,warn:x.LogLevelEnum.WARN,error:x.LogLevelEnum.ERROR,off:x.LogLevelEnum.OFF};let T,w=c.LogService=class extends g.Disposable{get logLevel(){return this._logLevel}constructor(m){super(),this._optionsService=m,this._logLevel=x.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,_){this._evalLazyOptionalParams(_),m.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,..._)}trace(m,...b){this._logLevel<=x.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,m,b)}debug(m,...b){this._logLevel<=x.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,m,b)}info(m,...b){this._logLevel<=x.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,m,b)}warn(m,...b){this._logLevel<=x.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,m,b)}error(m,...b){this._logLevel<=x.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,m,b)}};c.LogService=w=d([v(0,x.IOptionsService)],w),c.setTraceLogger=function(m){T=m},c.traceCall=function(m,b,_){if(typeof _.value!="function")throw new Error("not supported");const S=_.value;_.value=function(...k){if(T.logLevel!==x.LogLevelEnum.TRACE)return S.apply(this,k);T.trace(`GlyphRenderer#${S.name}(${k.map((R=>JSON.stringify(R))).join(", ")})`);const L=S.apply(this,k);return T.trace(`GlyphRenderer#${S.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),v=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 x=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends v.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 _=w[b];m[b]=this._sanitizeAndValidateOption(b,_)}catch(_){console.error(_)}this.rawOptions=m,this.options={...m},this._setupOptions(),this.register((0,v.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,_)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);_=this._sanitizeAndValidateOption(b,_),this.rawOptions[b]!==_&&(this.rawOptions[b]=_,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const _={get:w.bind(this,b),set:m.bind(this,b)};Object.defineProperty(this.options,b,_)}}_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=x.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,_=arguments.length,S=_<3?T:m===null?m=Object.getOwnPropertyDescriptor(T,w):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(C,T,w,m);else for(var k=C.length-1;k>=0;k--)(b=C[k])&&(S=(_<3?b(S):_>3?b(T,w,S):b(T,w))||S);return _>3&&S&&Object.defineProperty(T,w,S),S},v=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 x=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 _=T.addMarker(T.ybase+T.y),S={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(S,_))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.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=x=d([v(0,g.IBufferService)],x)},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(v){return v[d]||[]},c.createDecorator=function(v){if(c.serviceRegistry.has(v))return c.serviceRegistry.get(v);const g=function(x,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,x,T)};return g.toString=()=>v,c.serviceRegistry.set(v,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 v;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"})(v||(c.LogLevelEnum=v={})),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),v=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 v.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 _=C.charCodeAt(b);if(55296<=_&&_<=56319){if(++b>=m)return T+this.wcwidth(_);const L=C.charCodeAt(b);56320<=L&&L<=57343?_=1024*(_-55296)+L-56320+65536:T+=this.wcwidth(L)}const S=this.charProperties(_,w);let k=g.extractWidth(S);g.extractShouldJoin(S)&&(k-=g.extractWidth(w)),T+=k,w=S}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),v=o(5741),g=o(8285),x=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 v.AddonManager),this._publicOptions={...this._core.options};const _=k=>this._core.options[k],S=(k,L)=>{this._checkReadonlyOptions(k),this._core.options[k]=L};for(const k in this._core.options){const L={get:_.bind(this,k),set:S.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 x.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 _="none";switch(this._core.coreMouseService.activeProtocol){case"X10":_="x10";break;case"VT200":_="vt200";break;case"DRAG":_="drag";break;case"ANY":_="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:_,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const _ in b)this._publicOptions[_]=b[_]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,_=!0){this._core.input(b,_)}resize(b,_){this._verifyIntegers(b,_),this._core.resize(b,_)}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,_,S){this._verifyIntegers(b,_,S),this._core.select(b,_,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,_){this._verifyIntegers(b,_),this._core.selectLines(b,_)}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,_){this._core.write(b,_)}writeln(b,_){this._core.write(b),this._core.write(`\r
|
|
82
|
+
`,_)}paste(b){this._core.paste(b)}refresh(b,_){this._verifyIntegers(b,_),this._core.refresh(b,_)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const _ of b)if(_===1/0||isNaN(_)||_%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const _ of b)if(_&&(_===1/0||isNaN(_)||_%1!=0||_<0))throw new Error("This API only accepts positive integers")}}p.Terminal=w})(),f})()))})(yp)),yp.exports}var VM=KM();function YM(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)},v=()=>{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)},x=()=>{t=!1,o=!1,h(),c()},C=T=>{if(f===null){if(t||i||ZM(T)){s=!0,i&&!t?v():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,d(),s&&v()},onCompositionCancel:g,handleKeyEvent(T){return XM(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:x}}function XM(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function ZM(e){return e.isComposing===!0||e.keyCode===229||e.which===229}const JM={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",lineHeight:1},QM="Symbols Nerd Font Mono",Au=`ui-monospace, "SF Mono", Menlo, "${QM}", monospace`,jm=14,Mw=10,Nw=22,e4=128,t4=.5,n4="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",i4=/[\x00-\x1F\x7F]/g,ry={min:Mw,max:Nw},r4="cascadia",Ph=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Au}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Au}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Au}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Au}`,meta:"Variable · Adobe mono"}],ta=Ph[0];function uh(e){return Ph.find(t=>t.id===e)??ta}function Xl(){return{source:"curated",id:r4,customName:"",family:ta.family,size:jm}}function Im(e,t){const i=uh(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:zm(t)}}function Bm(e,t){const i=l4(e);return{source:"custom",id:null,customName:i,family:i?`"${jw(i)}", ${ta.family}`:ta.family,size:zm(t)}}function Ow(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=zm(typeof t.size=="number"?t.size:jm);return t.source==="custom"&&typeof t.customName=="string"?Bm(t.customName,i):typeof t.id=="string"&&o4(t.id)?Im(t.id,i):null}function Pm(e){if(!e)return Xl();try{const t=Ow(JSON.parse(e));if(t!==null)return t}catch{}return Xl()}function s4(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function zm(e){return Number.isFinite(e)?Math.min(Nw,Math.max(Mw,Math.round(e))):jm}function Dw(e){return e.source==="curated"?{status:"self-hosted",fallbackName:ta.name}:e.customName?{status:a4(e.customName)?"resolved":"fallback",fallbackName:ta.name}:{status:"fallback",fallbackName:ta.name}}function a4(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=sy(t,`"${jw(e)}", ${i}`),o=sy(t,i);if(Math.abs(s-o)>t4)return!0}return!1}function sy(e,t){return e.font=`28px ${t}`,e.measureText(n4).width}function o4(e){return Ph.some(t=>t.id===e)}function l4(e){return e.replace(i4,"").trim().slice(0,e4)}function jw(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}const hh="fleet-plugin.terminal.renderer",uo="fleet-plugin.terminal.font",ay="fleet-console.terminalRenderer",oy="fleet-console.terminalFont",Ag=new Set;let Ts=c4(),Zl=null,na=0;function c4(){return typeof window>"u"?{renderer:"webgl",font:Xl()}:(u4(),{renderer:g4(),font:m4()})}function u4(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(hh)!==null||window.localStorage.getItem(uo)!==null)return;const e=window.localStorage.getItem(ay),t=window.localStorage.getItem(oy),i=e==="webgl"||e==="dom"?e:"webgl",s=Pm(t);window.localStorage.setItem(hh,i),window.localStorage.setItem(uo,s4(s)),window.localStorage.removeItem(ay),window.localStorage.removeItem(oy)}catch{}}function h4(e){na+=1,Zl=e,p4()}function Iw(){return M.useSyncExternalStore(b4,uy,uy)}function d4(e){_4(e),_o({renderer:e})}function f4(e){const t=Im(e,Ts.font.size);na+=1,_o({font:t}),zh(t)}function ly(e){const t=Bm(e,Ts.font.size);na+=1,_o({font:t}),zh(t)}function cy(e){const t=Ts.font.source==="custom"?Bm(Ts.font.customName,e):Im(Ts.font.id,e);na+=1,_o({font:t}),zh(t)}async function p4(){if(!Zl)return;const e=na;try{const t=await Zl.read("terminal");if(t!==null){const i=Ow(t.font);if(i!==null){if(e!==na)return;_o({font:i});try{window.localStorage.removeItem(uo)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(uo)}catch{}if(i!==null){const s=Pm(i);if(e!==na)return;_o({font:s}),zh(s);try{window.localStorage.removeItem(uo)}catch{}}}}catch{}}async function zh(e){if(Zl)try{await Zl.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function g4(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(hh);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function m4(){if(typeof window>"u")return Xl();try{return Pm(window.localStorage.getItem(uo))}catch{return Xl()}}function _4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hh,e)}catch{}}function v4(){for(const e of Ag)e()}function _o(e){Ts={...Ts,...e},v4()}function b4(e){return Ag.add(e),()=>{Ag.delete(e)}}function uy(){return Ts}const y4="Symbols Nerd Font Mono",S4=`1em "${y4}"`,x4=650;let Ru=null;function Bw(){return Ru||(Ru=C4(),Ru)}async function w4(){await E4(Bw(),x4)}async function C4(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(S4)}catch{}}async function E4(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 k4=80,T4=16,A4=250,R4=1024*1024,L4=120,M4={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)"},N4={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 Hm({operationId:e,ticketPath:t,wsPath:i,theme:s="maritime",onExit:o,active:f,zoom:p=1}){const c=s,{renderer:h,font:d}=Iw(),v=M.useRef(null),g=M.useRef(null),x=M.useRef(null),C=M.useRef(null),T=M.useRef(null),w=M.useRef(null),[m,b]=M.useState(p),_=M.useRef(o);_.current=o;const S=M.useRef(f);S.current=f;const[k,L]=M.useState("connecting"),[R,N]=M.useState(0);M.useEffect(()=>{const V=v.current;if(!V)return;let U=!1,W=null,I=null,X=null;return(async()=>{if(await w4(),U)return;const P=new VM.Terminal({...JM,fontFamily:d.family,fontSize:d.size*m,theme:hy(c)});g.current=P;const G=new lL.FitAddon;w.current=G,P.loadAddon(G),P.open(V),P.loadAddon(new hL.Unicode11Addon),P.unicode.activeVersion="11";const K=YM(()=>P.input(`
|
|
83
|
+
`)),j=V.querySelector("textarea.xterm-helper-textarea, textarea")??V;j.addEventListener("compositionstart",K.onCompositionStart),j.addEventListener("compositionend",K.onCompositionEnd),j.addEventListener("focusout",K.onCompositionCancel),P.attachCustomKeyEventHandler(K.handleKeyEvent);const z=D4(P,S.current!==!1);T.current=z;const D=nL({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:re=>P.onData(re),write:z.write},onExit:()=>_.current?.(),onStatus:(re,q)=>{L(q?`${re}: ${q}`:re)}});x.current=D;const F=()=>{G.fit(),D.resize(P.cols,P.rows)},J=()=>{F(),P.refresh(0,P.rows-1)},ne=()=>{I&&clearTimeout(I),I=setTimeout(()=>{I=null,U||J()},k4)},Z=async()=>{await document.fonts?.ready,!U&&(J(),D.start(),S.current!==!1&&P.focus())};W=new ResizeObserver(ne),W.observe(V),Z(),X=()=>{I&&clearTimeout(I),j.removeEventListener("compositionstart",K.onCompositionStart),j.removeEventListener("compositionend",K.onCompositionEnd),j.removeEventListener("focusout",K.onCompositionCancel),K.dispose(),D.dispose(),z.dispose(),g.current=null,x.current=null,T.current=null,w.current=null;try{P.dispose()}catch{}},N(re=>re+1)})(),()=>{U=!0,W?.disconnect(),X?.()}},[e,t,i]),M.useEffect(()=>{if(T.current?.setActive(f!==!1),!f)return;O4(g.current);const V=window.requestAnimationFrame(()=>{S.current===!0&&Pw(g.current)});return()=>window.cancelAnimationFrame(V)},[f]),M.useEffect(()=>{const V=g.current;if(!V)return;let U=!1;if(h==="webgl")try{const W=new qM;C.current=W,W.onContextLoss(()=>{if(!U){try{W.dispose()}catch{}C.current===W&&(C.current=null)}}),V.loadAddon(W)}catch{try{C.current?.dispose()}catch{}C.current=null}return()=>{U=!0;const W=C.current;if(W){C.current=null;try{W.dispose()}catch{}}}},[h,e,R]),M.useEffect(()=>{const V=g.current;V&&(V.options.theme=hy(c))},[c,R]),M.useEffect(()=>{const V=g.current;V&&(V.options.fontFamily=d.family,dy(V,w.current,x.current))},[d.family,R]),M.useEffect(()=>{if(p===m)return;const V=setTimeout(()=>b(p),L4);return()=>clearTimeout(V)},[p,m]),M.useEffect(()=>{const V=g.current;V&&(V.options.fontSize=d.size*m,dy(V,w.current,x.current))},[m,d.size,R]);const A=k.startsWith("live"),B=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:v,style:B})})]})})}function hy(e){return e==="carbon"?N4:M4}function O4(e){e&&(e.focus(),Pw(e))}function Pw(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function D4(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 v=j4(p,f);p=[],f=0,e.write(v)},d=()=>{s||o||f===0||(o=setTimeout(h,i?T4:A4))};return{write:v=>{if(!(s||v.byteLength===0)){if(p.push(v),f+=v.byteLength,f>=R4){h();return}d()}},setActive:v=>{if(i!==v){if(i=v,c(),i){h();return}d()}},dispose:()=>{h(),s=!0,p=[],f=0,c()}}}function j4(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 dy(e,t,i){t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)}const I4=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class Qi extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function B4(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new Qi(t.status,"Invalid agent state response");return i.agentClis.map(s=>q4(s,t.status))}async function P4(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.clis))throw new Qi(t.status,"Invalid Agent CLI state response");return i}async function z4(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new Qi(t.status,"Invalid tenants response");return i.tenants.map(s=>K4(s,t.status))}async function H4(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new Qi(t.status,"Invalid jobs response");return i.tenants}async function $4(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new Qi(t.status,"Invalid agent sessions response");return i.sessions.map(s=>Hh(s,t.status))}async function U4(e){const t=await fetch("/api/v1/operations",{signal:e});await Ur(t);const i=await t.json();if(!Array.isArray(i.operations))throw new Qi(t.status,"Invalid operations response");return{operations:i.operations.map(s=>V4(s,t.status))}}async function F4(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 Ur(s),Hh(await s.json(),s.status)}async function W4(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Ur(i),Hh(await i.json(),i.status)}async function G4(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Ur(i)}function Hh(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||Rg(i))throw new Qi(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 Ur(e){if(!e.ok)throw new Qi(e.status,`Agent plugin request failed: ${e.status}`)}function q4(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new Qi(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function K4(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 Qi(t,"Invalid tenant response");return i}function V4(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"||Rg(i)||Rg(i.payload))throw new Qi(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 Rg(e){return Lg(e,new Set(I4))}function Lg(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>Lg(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||Lg(s,t))}const Y4="active",Mg=new Set(["done","error","aborted"]);function X4(e,t){let i=Ng(e,t.jobId,t.updatedAt);for(const s of t.events)i=zw(i,s);return Mg.has(t.status)&&!Mg.has(i.status)&&(i={...i,status:t.status}),i}function zw(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,s={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:Q4(e.recentEvents,t)};switch(t.type){case"job:registered":return Z4(s,i);case"job:finalized":return{...s,status:sn(i.status)??"done",finishedAt:ys(i.finishedAt)??t.at,summary:sn(i.summary),error:sn(i.error)};case"track:begin":return qa(s,i,t.id,o=>({...o,startedAt:ys(i.startedAt)??t.at,requestPreview:sn(i.requestPreview)}));case"track:status":return qa(s,i,t.id,o=>({...o,status:sn(i.status)??o.status}));case"track:text":return qa(s,i,t.id,o=>{const f=o.text+(sn(i.text)??"");return{...o,status:"stream",text:f,sentTextLength:o.sentTextLength+(ys(i.textLength)??sn(i.text)?.length??0),latestLine:py(f)||o.latestLine}});case"track:thought":return qa(s,i,t.id,o=>{const f=o.thought+(sn(i.text)??"");return{...o,thought:f,sentThoughtLength:o.sentThoughtLength+(ys(i.textLength)??sn(i.text)?.length??0),latestLine:py(f)||o.latestLine}});case"track:tool":return qa(s,i,t.id,o=>({...o,status:"stream",tools:J4(o.tools,i)}));case"track:finalized":return qa(s,i,t.id,o=>{const f=fy(o.text,o.sentTextLength,sn(i.fallbackText),ys(i.fallbackTextLength)),p=fy(o.thought,o.sentThoughtLength,sn(i.fallbackThought),ys(i.fallbackThoughtLength));return{...o,status:sn(i.status)??"done",finishedAt:ys(i.finishedAt)??t.at,error:sn(i.error),text:f.text,sentTextLength:f.sentLength,thought:p.text,sentThoughtLength:p.sentLength}});default:return s}}function Ng(e,t,i){return{jobId:t,tenantId:e,status:Y4,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Hw(e){return Mg.has(e)}function Z4(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??$w(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:sn(t.label)??e.label,ownerCarrierId:sn(t.ownerCarrierId)??e.ownerCarrierId,kind:sn(t.kind)??e.kind,signatureCli:sn(t.signatureCli)??e.signatureCli,startedAt:ys(t.startedAt)??e.startedAt,trackOrder:s,tracks:o}}function qa(e,t,i,s){const o=sn(t.trackId);if(!o)return e;const f=e.tracks[o],p={...s(f??$w(o)),lastEventId:i};return{...e,trackOrder:f?e.trackOrder:[...e.trackOrder,o],tracks:{...e.tracks,[o]:p}}}function $w(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function J4(e,t){const i=sn(t.toolId)??sn(t.id);if(!i)return e;const s={id:i,name:sn(t.name),input:t.input,output:t.output,status:sn(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 fy(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 Q4(e,t){return[...e,t].slice(-120)}function py(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
84
|
+
`);return i[i.length-1]?.trim()??""}function sn(e){return typeof e=="string"?e:void 0}function ys(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const e6=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function t6(){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=i6(o);f&&i.push(f),s=e.indexOf(`
|
|
87
|
+
|
|
88
|
+
`)}return i}}function n6(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=my(t.session);return s?{kind:"session",tenantId:s.tenantId??s.sessionId,session:s}:null}if(e.event==="session:attention"){const s=my(t.session);return s?{kind:"attention",tenantId:s.tenantId??s.sessionId,session:s,reason:r6(t.reason)}:null}const i=gy(t.event)??gy(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function i6(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 gy(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 my(e){try{return Hh(e,200)}catch{return null}}function r6(e){return typeof e=="string"&&e6.has(e)?e:void 0}const $m={droppedCount:0},Og=new Set;let Ut={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function s6(){return ZS(a6,Uw)}function Uw(){return Ut}function a6(e){return Og.add(e),()=>{Og.delete(e)}}function wi(e){Ut={...Ut,...e},f6()}function o6(e){wi({agentClis:e})}function l6(e){const t={};for(const i of e)t[i.sessionId]=i;wi({sessions:t,sessionOrder:[...e].sort((i,s)=>s.createdAt-i.createdAt).map(i=>i.sessionId)})}function dh(e){const t=!!Ut.sessions[e.sessionId];wi({sessions:{...Ut.sessions,[e.sessionId]:e},sessionOrder:t?Ut.sessionOrder:[e.sessionId,...Ut.sessionOrder],turnState:{...Ut.turnState,[e.sessionId]:e.turnState}})}function Fw(e){const{[e]:t,...i}=Ut.sessions,{[e]:s,...o}=Ut.turnState;wi({sessions:i,sessionOrder:Ut.sessionOrder.filter(f=>f!==e),activeTerminalSessionId:Ut.activeTerminalSessionId===e?null:Ut.activeTerminalSessionId,turnState:o})}function Ww(e){wi({activeTerminalSessionId:e})}function c6(e){wi({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Ut.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&Ut.tenantJobs[t])]})}function u6(e){const t={};for(const i of e){const s={};for(const o of i.jobs)s[o.jobId]=X4(i.tenantId,o);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(o=>o.jobId),jobs:s,truncation:i.truncation??$m}}wi({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...Ut.tenantOrder.filter(i=>t[i])]})}function h6(e,t){const i=e.tenantId,s=e.jobId??p6(e),o=Ut.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:$m},f=s?o.jobs[s]??Ng(i,s,e.at):Ng(i,"__unknown__",e.at),p=zw(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 wi({tenantJobs:{...Ut.tenantJobs,[i]:h},tenantOrder:Ut.tenantOrder.includes(i)?Ut.tenantOrder:[i,...Ut.tenantOrder]}),{job:p,unknownTenant:!Ut.tenantJobs[i]}}function d6(e,t,i){const s=Ut.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:$m};wi({tenantJobs:{...Ut.tenantJobs,[e]:{...s,tenantLabel:t??s.tenantLabel,truncation:i}}})}function Gw(e){const t=e.tenantId;if(!t)return[];const i=Ut.tenantJobs[t];return i?i.jobOrder.map(s=>i.jobs[s]).filter(s=>!!s):[]}function f6(){for(const e of Og)e()}function p6(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const _y=250,g6=5e3,Dg=new Map;function m6(e){const t=new AbortController;return _6(t.signal,e),()=>t.abort()}async function _6(e,t){let i=_y;for(;!e.aborted;){wi({connection:"connecting"});try{await S6(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}`);wi({connection:"live",connectionError:null}),i=_y,await v6(s.body.getReader(),e,t),e.aborted||wi({connection:"connecting",connectionError:null})}catch(s){if(e.aborted)return;wi({connection:"connecting",connectionError:s instanceof Error?s.message:String(s)})}if(e.aborted)return;await w6(i,e),i=Math.min(i*2,g6)}}async function v6(e,t,i){const s=new TextDecoder,o=t6();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=n6(p);if(c){if(c.kind==="truncation"&&c.truncation){d6(c.tenantId,c.tenantLabel,c.truncation);continue}if(c.kind==="session"&&c.session){dh(c.session),fh(i,c.session.sessionId,Um(c.session));continue}if(c.kind==="attention"&&c.session){dh(c.session),c.reason!=="idle_prompt"&&fh(i,c.session.sessionId,"awaiting");continue}c.event&&(h6(c.event,c.tenantLabel),y6(i,c.event.tenantId))}}}}function Um(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&b6(e)?"running":"idle"}function b6(e){return Gw(e).some(t=>!Hw(t.status))}function fh(e,t,i){const s=Dg.get(t);e.status.set(t,i),Dg.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 y6(e,t){const{sessions:i}=Uw();for(const s of Object.values(i))s.tenantId===t&&Dg.get(s.sessionId)!=="awaiting"&&fh(e,s.sessionId,Um(s))}async function S6(e,t){const[i,s,o,f,p]=await Promise.all([B4(e),$4(e),z4(e),H4(e),U4(e)]);o6(i),l6(s),c6(o),u6(f);for(const c of s)fh(t,c.sessionId,Um(c));x6(p.operations,t)}function x6(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function w6(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}const C6=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]),E6=new Set(["claude","codex","opencode-go","cursor"]);function k6(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 T6(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function A6(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 R6(e){if(e.kind==="taskforce")return"taskforce";const t=e.signatureCli;return t&&E6.has(t)?t:void 0}function qw(e){if(e)return C6.has(e)?e:void 0}class Kw extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function L6(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await Vw(t),Yw(await t.json(),t.status)}async function M6(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await Vw(i),Yw(await i.json(),i.status)}async function Vw(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 Kw(e.status,t)}function Yw(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean")throw new Kw(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor}}const jg=new Set;let ph={loading:!1,state:null,savingField:null,error:null},Zu=0;function N6(){return M.useSyncExternalStore(O6,vy,vy)}function vy(){return ph}function O6(e){return jg.add(e),()=>{jg.delete(e)}}async function D6(e){const t=++Zu;ho({loading:!0,error:null});try{const i=await L6(e);if(t!==Zu)return;ho({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==Zu)return;ho({loading:!1,error:Xw(i)})}}async function j6(e,t){const i=ph.state;if(!i)return!1;Zu+=1;const s={...i,[e]:t};ho({state:s,savingField:e,error:null});try{const o=await M6(s);return ho({state:o,savingField:null,error:null}),!0}catch(o){return ho({state:i,savingField:null,error:Xw(o)}),!1}}function ho(e){ph={...ph,...e};for(const t of jg)t()}function Xw(e){return e instanceof Error?e.message:String(e)}const I6=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],B6="/plugins/terminal/agent/ticket",P6="/plugins/terminal/ws",Sp="fleet-plugin.terminal.stream-dock-expanded",z6="fleet-plugin.terminal.stream-dock-collapsed",H6=56,Zw={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>jl(e.payload,"cliLabel")??void 0,render:e=>u.jsx(q6,{context:e})},Jw={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(Y6,{})},Qw={id:"agent.attention",title:"Agent input waiting"},$6={id:"agent.ended",title:"Agent turn ended"},Lu={id:"terminal",operationKinds:[Zw],settingsSections:[Jw],notificationKinds:[Qw,$6],install:e=>U6(e),closeOperation:async e=>{try{await G4(e)}finally{Fw(e)}},launch:async({theaterId:e,kind:t})=>{const i=await F4(e,t.id);return dh(i),Ww(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?u.jsx(dN,{}):e.id==="codex"?u.jsx(pN,{}):e.id==="cursor"?u.jsx(fN,{}):u.jsx(hN,{})};function U6(e){return m6({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function F6(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 v=h.scrollHeight-h.scrollTop-h.clientHeight;p(v<=H6)};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 W6(){const[e,t]=M.useState(()=>{try{return localStorage.removeItem(z6),localStorage.getItem(Sp)==="true"}catch{return!1}}),i=M.useCallback(s=>{try{s?localStorage.setItem(Sp,"true"):localStorage.removeItem(Sp)}catch{}t(s)},[]);return[e,i]}function G6(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?"":k6(t-e)}function q6({context:e}){const i=s6().sessions[e.operationId]??nN(e),[s,o]=M.useState(!1),f=M.useRef(null),p=M.useRef(null),c=M.useRef(null),d=Gw(i).filter(g=>!Hw(g.status)),v=M.useCallback(()=>{o(!1),c.current?.focus()},[]);return M.useLayoutEffect(()=>{s&&f.current?.focus()},[s]),M.useEffect(()=>{if(!s)return;const g=x=>{if(x.key==="Escape"){x.stopPropagation(),v();return}if(x.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];x.shiftKey&&document.activeElement===w?(x.preventDefault(),m?.focus()):!x.shiftKey&&document.activeElement===m&&(x.preventDefault(),w?.focus())}};return document.addEventListener("keydown",g,!0),()=>document.removeEventListener("keydown",g,!0)},[s,v]),i.status==="dormant"?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{tN(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(Hm,{operationId:i.sessionId,ticketPath:B6,wsPath:P6,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>Fw(i.sessionId)}),d.length>0?u.jsx(K6,{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:v}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:v,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(Q6,{job:g},g.jobId))})]})]}):null]})}function K6({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[s,o]=W6(),f=e[0],p=G6(f?.startedAt),c=e.reduce((k,L)=>k+A6(L),0),h=T6(c),d=e.length===1&&f?R6(f):void 0,v=e.length===1&&f?qw(f.ownerCarrierId):void 0,g=e.length===1&&f?f.label:void 0,x=e.length>1?`${e.length} carriers`:f?.ownerCarrierId??"Carrier",C=rN(e),T=e.map(k=>`${k.jobId}:${k.lastEventId}`).join(","),w=`${s}:${e.map(k=>k.jobId).join(",")}`,{containerRef:m,pinned:b,jumpToLatest:_}=F6(w,T),S=e.some(k=>k.trackOrder.some(L=>{const R=k.tracks[L];return R?Fm(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":v,title:g,children:x}),u.jsxs("span",{className:"job-dock-strip-line",style:s?{display:"none"}:void 0,"aria-hidden":"true",children:[C,!s&&S&&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(V6,{track:A,job:k,multiJob:L,singleTrack:R},`${k.jobId}:${N}`):null})})]}),b?null:u.jsx("button",{type:"button",className:"follow-button",onClick:_,children:"↓ Follow"})]})]})}function V6({track:e,job:t,multiJob:i,singleTrack:s}){const o=Fm(e.status),f=by(e.text),p=by(e.thought),c=f||p,h=!f&&!!p,d=o?iN(e):void 0,v=i||!s,g=i?qw(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[v?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 Y6(){const[e,t]=M.useState([]),[i,s]=M.useState(null),{renderer:o,font:f}=Iw();return M.useEffect(()=>{const p=new AbortController;return P4(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(X6,{}),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(J6,{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(sN,{terminalFont:f}),u.jsx(aN,{terminalRenderer:o})]})}function X6(){const e=N6(),t=e.state,i=e.savingField!==null;return M.useEffect(()=>{const s=new AbortController;return D6(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(Z6,{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:()=>{j6("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 Z6({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 J6({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 Q6({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(eN,{track:i},i.trackId):null})})]})}function eN({track:e}){const t=uN(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 tN(e){dh(await W4(e)),Ww(e)}function nN(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 Fm(e){return e==="stream"||e==="live"||e==="running"||e==="active"}function iN(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 rN(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 by(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
91
|
+
`);return i[i.length-1]?.trim()??""}function sN({terminalFont:e}){const t=Dw(e),i=lN(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:[Ph.map(s=>u.jsx(oN,{font:s,active:e.source==="curated"&&e.id===s.id,onSelect:()=>f4(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"&&ly("")},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=>ly(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:cN(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<=ry.min,onClick:()=>cy(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>=ry.max,onClick:()=>cy(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 aN({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:I6.map(t=>{const i=t.id===e;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>d4(t.id),children:t.label},t.id)})})]})})}function oN({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 lN(e){return e.source==="custom"?e.customName||`${uh(null).name} (default)`:uh(e.id).name}function cN(e){if(!e.customName)return`Empty — using default ${uh(null).name}`;const t=Dw(e);return t.status==="resolved"?`"${e.customName}" resolves on this machine`:`"${e.customName}" not found — falls back to ${t.fallbackName}`}function uN(e){return Fm(e)?"track-card--live":e==="error"?"track-card--bad":e==="done"||e==="aborted"?"track-card--idle":""}function hN(){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 dN(){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 fN(){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 pN(){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 gN="global-shell",mN="/plugins/terminal/global/ticket",_N="/plugins/terminal/ws",vN=168,bN={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},yN={id:"global-shell",title:"Shell",icon:SN,preferredExtraWidth:vN,render:e=>u.jsx("div",{style:bN,children:u.jsx(Hm,{operationId:gN,ticketPath:mN,wsPath:_N,theme:"carbon",active:!0})})};function SN(){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 xN="/plugins/terminal/shell/ticket",wN="/plugins/terminal/ws",eC={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>M.createElement(CN,{context:e})},xp={id:"terminal",operationKinds:[eC],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(EN,{})};function CN({context:e}){return u.jsx(Hm,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:xN,wsPath:wN,theme:e.theme,onExit:e.onClose})}function EN(){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 kN=new Set(["agent"]),TN={id:"terminal",operationKinds:[eC,Zw],settingsSections:[Jw],notificationKinds:[Qw],railPanels:[yN],install:e=>(Bw(),h4(e.settings),Lu.install?.(e)),closeOperation:async e=>{const t=await RN(e);if(t?.type==="shell"){await xp.closeOperation?.(e);return}t&&kN.has(t.type)&&await Lu.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?xp.launch?.(e)??{id:""}:Lu.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?xp.renderLaunchIcon?.(e):Lu.renderLaunchIcon?.(e)},AN=[TN];async function RN(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 oe={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"},LN={src:oe.ts,lib:oe.ts,app:oe.ts,test:oe.shell,tests:oe.shell,__tests__:oe.shell,spec:oe.shell,specs:oe.shell,node_modules:oe.binary,vendor:oe.binary,dist:oe.config,build:oe.config,out:oe.config,target:oe.config,docs:oe.md,doc:oe.md,public:oe.data,assets:oe.data,static:oe.data,components:oe.image,scripts:oe.js,styles:oe.css,".git":oe.html,".github":oe.config,".vscode":oe.css},yy={ts:{shape:"angle",tone:oe.ts},tsx:{shape:"angle",tone:oe.ts},mts:{shape:"angle",tone:oe.ts},cts:{shape:"angle",tone:oe.ts},"d.ts":{shape:"angle",tone:oe.ts},js:{shape:"angle",tone:oe.js},jsx:{shape:"angle",tone:oe.js},mjs:{shape:"angle",tone:oe.js},cjs:{shape:"angle",tone:oe.js},json:{shape:"braces",tone:oe.json},jsonc:{shape:"braces",tone:oe.json},json5:{shape:"braces",tone:oe.json},jsonl:{shape:"braces",tone:oe.json},graphql:{shape:"braces",tone:oe.image},gql:{shape:"braces",tone:oe.image},proto:{shape:"braces",tone:oe.go},css:{shape:"hash",tone:oe.css},scss:{shape:"hash",tone:oe.css},sass:{shape:"hash",tone:oe.css},less:{shape:"hash",tone:oe.css},styl:{shape:"hash",tone:oe.css},html:{shape:"markup",tone:oe.html},htm:{shape:"markup",tone:oe.html},xml:{shape:"markup",tone:oe.html},xhtml:{shape:"markup",tone:oe.html},vue:{shape:"markup",tone:oe.shell},svelte:{shape:"markup",tone:oe.rust},astro:{shape:"markup",tone:oe.image},md:{shape:"doc",tone:oe.md},mdx:{shape:"doc",tone:oe.md},markdown:{shape:"doc",tone:oe.md},rst:{shape:"doc",tone:oe.md},txt:{shape:"doc",tone:oe.default},text:{shape:"doc",tone:oe.default},log:{shape:"doc",tone:oe.default},adoc:{shape:"doc",tone:oe.md},pdf:{shape:"doc",tone:oe.ruby},py:{shape:"angle",tone:oe.py},pyi:{shape:"angle",tone:oe.py},pyw:{shape:"angle",tone:oe.py},go:{shape:"angle",tone:oe.go},rs:{shape:"angle",tone:oe.rust},rb:{shape:"angle",tone:oe.ruby},rake:{shape:"angle",tone:oe.ruby},gemspec:{shape:"angle",tone:oe.ruby},java:{shape:"angle",tone:oe.html},kt:{shape:"angle",tone:oe.config},kts:{shape:"angle",tone:oe.config},scala:{shape:"angle",tone:oe.ruby},c:{shape:"angle",tone:oe.ts},h:{shape:"angle",tone:oe.ts},cpp:{shape:"angle",tone:oe.css},cc:{shape:"angle",tone:oe.css},cxx:{shape:"angle",tone:oe.css},hpp:{shape:"angle",tone:oe.css},cs:{shape:"angle",tone:oe.config},php:{shape:"angle",tone:oe.config},swift:{shape:"angle",tone:oe.html},lua:{shape:"angle",tone:oe.ts},dart:{shape:"angle",tone:oe.go},sh:{shape:"terminal",tone:oe.shell},bash:{shape:"terminal",tone:oe.shell},zsh:{shape:"terminal",tone:oe.shell},fish:{shape:"terminal",tone:oe.shell},ps1:{shape:"terminal",tone:oe.css},bat:{shape:"terminal",tone:oe.shell},cmd:{shape:"terminal",tone:oe.shell},yaml:{shape:"gear",tone:oe.config},yml:{shape:"gear",tone:oe.config},toml:{shape:"gear",tone:oe.config},ini:{shape:"gear",tone:oe.config},conf:{shape:"gear",tone:oe.config},cfg:{shape:"gear",tone:oe.config},properties:{shape:"gear",tone:oe.config},env:{shape:"gear",tone:oe.config},editorconfig:{shape:"gear",tone:oe.config},png:{shape:"image",tone:oe.image},jpg:{shape:"image",tone:oe.image},jpeg:{shape:"image",tone:oe.image},gif:{shape:"image",tone:oe.image},webp:{shape:"image",tone:oe.image},svg:{shape:"image",tone:oe.image},ico:{shape:"image",tone:oe.image},bmp:{shape:"image",tone:oe.image},avif:{shape:"image",tone:oe.image},tiff:{shape:"image",tone:oe.image},heic:{shape:"image",tone:oe.image},mp4:{shape:"image",tone:oe.data},mov:{shape:"image",tone:oe.data},webm:{shape:"image",tone:oe.data},mkv:{shape:"image",tone:oe.data},mp3:{shape:"chip",tone:oe.shell},wav:{shape:"chip",tone:oe.shell},flac:{shape:"chip",tone:oe.shell},ogg:{shape:"chip",tone:oe.shell},sql:{shape:"database",tone:oe.data},csv:{shape:"database",tone:oe.data},tsv:{shape:"database",tone:oe.data},db:{shape:"database",tone:oe.data},sqlite:{shape:"database",tone:oe.data},sqlite3:{shape:"database",tone:oe.data},parquet:{shape:"database",tone:oe.data},zip:{shape:"archive",tone:oe.archive},tar:{shape:"archive",tone:oe.archive},gz:{shape:"archive",tone:oe.archive},tgz:{shape:"archive",tone:oe.archive},bz2:{shape:"archive",tone:oe.archive},xz:{shape:"archive",tone:oe.archive},rar:{shape:"archive",tone:oe.archive},"7z":{shape:"archive",tone:oe.archive},zst:{shape:"archive",tone:oe.archive},bin:{shape:"chip",tone:oe.binary},exe:{shape:"chip",tone:oe.binary},dll:{shape:"chip",tone:oe.binary},so:{shape:"chip",tone:oe.binary},dylib:{shape:"chip",tone:oe.binary},wasm:{shape:"chip",tone:oe.config},class:{shape:"chip",tone:oe.binary},lock:{shape:"chip",tone:oe.binary},woff:{shape:"chip",tone:oe.config},woff2:{shape:"chip",tone:oe.config},ttf:{shape:"chip",tone:oe.config},otf:{shape:"chip",tone:oe.config}},MN={dockerfile:{shape:"chip",tone:oe.css},"docker-compose.yml":{shape:"gear",tone:oe.css},"docker-compose.yaml":{shape:"gear",tone:oe.css},makefile:{shape:"gear",tone:oe.html},"cmakelists.txt":{shape:"gear",tone:oe.html},".gitignore":{shape:"gear",tone:oe.html},".gitattributes":{shape:"gear",tone:oe.html},".dockerignore":{shape:"gear",tone:oe.html},".npmignore":{shape:"gear",tone:oe.html},".npmrc":{shape:"gear",tone:oe.ruby},"package.json":{shape:"braces",tone:oe.shell},"tsconfig.json":{shape:"braces",tone:oe.ts},license:{shape:"doc",tone:oe.json},"license.md":{shape:"doc",tone:oe.json},licence:{shape:"doc",tone:oe.json}},NN={shape:"default",tone:oe.default},Ig={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 ON({name:e}){const t=jN(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:Ig[t.shape]})}function DN({name:e,open:t}){const i=LN[e.toLowerCase()]??oe.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?Ig.folderOpen:Ig.folderClosed})}function jN(e){const t=e.toLowerCase(),i=MN[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:oe.config};if(t.startsWith("readme"))return{shape:"doc",tone:oe.md};if(t.endsWith(".d.ts"))return yy["d.ts"];const s=t.lastIndexOf(".");if(s>0&&s<t.length-1){const o=t.slice(s+1),f=yy[o];if(f)return f}return NN}const IN=200,Mu=30,Sy=5,tC="fleet-console.fileExplorer.showHidden";function nC(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&&nC(f,t,i,s))return!0}}return!1}function iC(e,t,i,s,o,f,p,c){const h=[];for(const d of e)if(!(!c&&d.name.startsWith("."))){if(p){const v=d.name.toLowerCase().includes(p),g=d.kind==="dir"&&nC(f.get(d.relativePath)?.entries??[],f,p,c);if(!v&&!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 v=f.get(d.relativePath)?.entries;v&&h.push(...iC(v,t+1,i,s,o,f,p,c))}}return h}function BN({files:e,theaterId:t,selectedPath:i,onSelect:s}){const[o,f]=M.useState(null),[p,c]=M.useState(null),[h,d]=M.useState(""),[v,g]=M.useState(new Set),[x,C]=M.useState(new Set),[T,w]=M.useState(new Map),[m,b]=M.useState(""),[_,S]=M.useState(0),[k,L]=M.useState(600),[R,N]=M.useState(()=>PN()),A=M.useRef(null),B=M.useRef(v);B.current=v;const V=M.useRef(h);V.current=h;const U=M.useRef(e);U.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(re=>{f(re),c(null)}).catch(re=>{c(re instanceof Error?re.message:"Unable to load folder")})},[t,h,e]),M.useEffect(()=>{const re=A.current;if(!re)return;const q=new ResizeObserver(()=>L(re.clientHeight));return q.observe(re),L(re.clientHeight),()=>q.disconnect()},[]),M.useEffect(()=>{if(!t)return;let re=!0;const q=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(t)}`,H=new EventSource(q),se=()=>{U.current.listFolder(V.current||void 0).then(xe=>{f(xe),c(null)}).catch(()=>{})},de=()=>{se();for(const xe of B.current)U.current.listFolder(xe).then(ye=>{w(Me=>new Map(Me).set(xe,ye))}).catch(()=>{})};return H.addEventListener("change",xe=>{let ye;try{ye=JSON.parse(xe.data)}catch{return}typeof ye=="string"&&((ye===""||ye===V.current)&&se(),ye!==""&&B.current.has(ye)&&U.current.listFolder(ye).then(Me=>{w(Oe=>new Map(Oe).set(ye,Me))}).catch(()=>{}))}),H.onopen=()=>{if(re){re=!1;return}de()},()=>{H.close()}},[t,e]);const W=M.useCallback(re=>{const q=re.relativePath,H=!v.has(q);g(se=>{const de=new Set(se);return de.has(q)?(de.delete(q),de):(de.add(q),de)}),H&&(C(se=>new Set(se).add(q)),e.listFolder(q).then(se=>{w(de=>new Map(de).set(q,se)),C(de=>{const xe=new Set(de);return xe.delete(q),xe})}).catch(()=>{C(se=>{const de=new Set(se);return de.delete(q),de})}))},[e,v]),I=M.useCallback(re=>{re.kind==="dir"?W(re):s(re)},[W,s]),X=M.useCallback(re=>{S(re.currentTarget.scrollTop)},[]),Y=M.useCallback(()=>{N(re=>{const q=!re;try{localStorage.setItem(tC,q?"1":"0")}catch{}return q})},[]),P=M.useCallback(()=>{if(t){e.listFolder(h||void 0).then(re=>{f(re),c(null)}).catch(re=>{c(re instanceof Error?re.message:"Unable to load folder")});for(const re of v)e.listFolder(re).then(q=>{w(H=>new Map(H).set(re,q))}).catch(()=>{})}},[e,h,v,t]),G=m.toLowerCase(),K=M.useMemo(()=>o?iC(o.entries,0,i,v,x,T,G,R):[],[o,i,v,x,T,G,R]),j=!R&&o!==null&&o.entries.length>0&&K.length===0&&!m,z=K.length>IN,D=z?Math.max(0,Math.floor(_/Mu)-Sy):0,F=z?Math.min(K.length,Math.ceil((_+k)/Mu)+Sy):K.length,J=K.slice(D,F),ne=K.length*Mu,Z=D*Mu;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:re=>b(re.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:P,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${R?" is-active":""}`,onClick:Y,"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:z?X: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:"↑ .."}),z?u.jsx("div",{style:{height:ne,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${Z}px)`},children:J.map(re=>u.jsx(xy,{row:re,onEntryClick:I},re.entry.relativePath))})}):J.map(re=>u.jsx(xy,{row:re,onEntryClick:I},re.entry.relativePath)),K.length===0&&m&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),K.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 xy({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(DN,{name:i.name,open:f}):u.jsx(ON,{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 PN(){try{return localStorage.getItem(tC)==="1"}catch{return!1}}function zN({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 HN(e,t){switch(t){case"typescript":case"javascript":return UN(e);case"json":return FN(e);case"python":return GN(e);case"css":case"scss":case"sass":case"less":return qN(e);case"html":case"xml":return KN(e);case"bash":case"shell":return VN(e);case"yaml":return YN(e);default:return[{kind:"text",value:e}]}}const $N=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 UN(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}=As(e,i,"`","`");t.push({kind:"str",value:s}),i+=o;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=As(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*\(/);$N.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 FN(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:s,length:o}=As(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 WN=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 GN(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}=As(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*\(/);WN.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 qN(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}=As(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 KN(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}=As(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 VN(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}=As(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 YN(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}=As(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 As(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 XN({content:e,lang:t,truncated:i}){const s=M.useMemo(()=>ZN(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 ZN(e,t){return e.split(`
|
|
98
|
+
`).map(s=>JN(s,t))}function JN(e,t){return t==="plaintext"||t==="markdown"?wy(e)||" ":HN(e,t).map(s=>{const o=wy(s.value);return s.kind==="text"?o:`<span class="syn-${s.kind}">${o}</span>`}).join("")||" "}function wy(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function QN({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 Wm(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var aa=Wm();function rC(e){aa=e}var Ul={exec:()=>null};function mt(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(Vn.caret,"$1"),i=i.replace(o,p),s},getRegex:()=>new RegExp(i,t)};return s}var eO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Vn={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")},tO=/^(?:[ \t]*(?:\n|$))+/,nO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,iO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ac=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Gm=/(?:[*+-]|\d{1,9}[.)])/,sC=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,aC=mt(sC).replace(/bull/g,Gm).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(),sO=mt(sC).replace(/bull/g,Gm).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(),qm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,aO=/^[^\n]+/,Km=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,oO=mt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Km).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lO=mt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Gm).getRegex(),$h="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",Vm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cO=mt("^ {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",Vm).replace("tag",$h).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oC=mt(qm).replace("hr",ac).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",$h).getRegex(),uO=mt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",oC).getRegex(),Ym={blockquote:uO,code:nO,def:oO,fences:iO,heading:rO,hr:ac,html:cO,lheading:aC,list:lO,newline:tO,paragraph:oC,table:Ul,text:aO},Cy=mt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ac).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",$h).getRegex(),hO={...Ym,lheading:sO,table:Cy,paragraph:mt(qm).replace("hr",ac).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cy).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",$h).getRegex()},dO={...Ym,html:mt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Vm).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:Ul,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:mt(qm).replace("hr",ac).replace("heading",` *#{1,6} *[^
|
|
99
|
+
]`).replace("lheading",aC).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fO=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pO=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lC=/^( {2,}|\\)\n(?!\s*$)/,gO=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Uh=/[\p{P}\p{S}]/u,Xm=/[\s\p{P}\p{S}]/u,cC=/[^\s\p{P}\p{S}]/u,mO=mt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xm).getRegex(),uC=/(?!~)[\p{P}\p{S}]/u,_O=/(?!~)[\s\p{P}\p{S}]/u,vO=/(?:[^\s\p{P}\p{S}]|~)/u,bO=mt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",eO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),hC=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,yO=mt(hC,"u").replace(/punct/g,Uh).getRegex(),SO=mt(hC,"u").replace(/punct/g,uC).getRegex(),dC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xO=mt(dC,"gu").replace(/notPunctSpace/g,cC).replace(/punctSpace/g,Xm).replace(/punct/g,Uh).getRegex(),wO=mt(dC,"gu").replace(/notPunctSpace/g,vO).replace(/punctSpace/g,_O).replace(/punct/g,uC).getRegex(),CO=mt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cC).replace(/punctSpace/g,Xm).replace(/punct/g,Uh).getRegex(),EO=mt(/\\(punct)/,"gu").replace(/punct/g,Uh).getRegex(),kO=mt(/^<(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(),TO=mt(Vm).replace("(?:-->|$)","-->").getRegex(),AO=mt("^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",TO).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,RO=mt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",gh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fC=mt(/^!?\[(label)\]\[(ref)\]/).replace("label",gh).replace("ref",Km).getRegex(),pC=mt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Km).getRegex(),LO=mt("reflink|nolink(?!\\()","g").replace("reflink",fC).replace("nolink",pC).getRegex(),Ey=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Zm={_backpedal:Ul,anyPunctuation:EO,autolink:kO,blockSkip:bO,br:lC,code:pO,del:Ul,emStrongLDelim:yO,emStrongRDelimAst:xO,emStrongRDelimUnd:CO,escape:fO,link:RO,nolink:pC,punctuation:mO,reflink:fC,reflinkSearch:LO,tag:AO,text:gO,url:Ul},MO={...Zm,link:mt(/^!?\[(label)\]\((.*?)\)/).replace("label",gh).getRegex(),reflink:mt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",gh).getRegex()},Bg={...Zm,emStrongRDelimAst:wO,emStrongLDelim:SO,url:mt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ey).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:mt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ey).getRegex()},NO={...Bg,br:mt(lC).replace("{2,}","*").getRegex(),text:mt(Bg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Nu={normal:Ym,gfm:hO,pedantic:dO},Cl={normal:Zm,gfm:Bg,breaks:NO,pedantic:MO},OO={"&":"&","<":"<",">":">",'"':""","'":"'"},ky=e=>OO[e];function ar(e,t){if(t){if(Vn.escapeTest.test(e))return e.replace(Vn.escapeReplace,ky)}else if(Vn.escapeTestNoEncode.test(e))return e.replace(Vn.escapeReplaceNoEncode,ky);return e}function Ty(e){try{e=encodeURI(e).replace(Vn.percentDecode,"%")}catch{return null}return e}function Ay(e,t){let i=e.replace(Vn.findPipe,(f,p,c)=>{let h=!1,d=p;for(;--d>=0&&c[d]==="\\";)h=!h;return h?"|":" |"}),s=i.split(Vn.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(Vn.slashPipe,"|");return s}function El(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 DO(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 Ry(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 jO(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 mh=class{options;rules;lexer;constructor(e){this.options=e||aa}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:El(i,`
|
|
102
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],s=jO(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=El(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:El(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=El(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
|
+
`),v=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
108
|
+
${d}`:d,o=o?`${o}
|
|
109
|
+
${v}`:v;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,f,!0),this.lexer.state.top=g,i.length===0)break;let x=f.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let C=x,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(x?.type==="list"){let C=x,T=C.raw+`
|
|
112
|
+
`+i.join(`
|
|
113
|
+
`),w=this.list(T);f[f.length-1]=w,s=s.substring(0,s.length-x.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="",v="";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)),x=e.split(`
|
|
116
|
+
`,1)[0],C=!g.trim(),T=0;if(this.options.pedantic?(T=2,v=g.trimStart()):C?T=t[1].length+1:(T=t[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,v=g.slice(T),T+=t[1].length),C&&this.rules.other.blankLine.test(x)&&(d+=x+`
|
|
117
|
+
`,e=e.substring(x.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(T),_=this.rules.other.hrRegex(T),S=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(x=R,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),N=x):N=x.replace(this.rules.other.tabCharGlobal," "),S.test(x)||k.test(x)||L.test(x)||b.test(x)||_.test(x))break;if(N.search(this.rules.other.nonSpaceChar)>=T||!x.trim())v+=`
|
|
119
|
+
`+N.slice(T);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(g)||k.test(g)||_.test(g))break;v+=`
|
|
120
|
+
`+x}!C&&!x.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(v),w&&(m=w[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:d,task:!!w,checked:m,loose:!1,text:v,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"),v=d.length>0&&d.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=v}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=Ay(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(Ay(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=El(i.slice(0,-1),"\\");if((i.length-f.length)%2===0)return}else{let f=DO(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)),Ry(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 Ry(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 v=[...s[0]][0].length,g=e.slice(0,o+s.index+v+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 x=g.slice(2,-2);return{type:"strong",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}}}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}}}},Ki=class Pg{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||aa,this.options.tokenizer=this.options.tokenizer||new mh,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:Vn,block:Nu.normal,inline:Cl.normal};this.options.pedantic?(i.block=Nu.pedantic,i.inline=Cl.pedantic):this.options.gfm&&(i.block=Nu.gfm,this.options.breaks?i.inline=Cl.breaks:i.inline=Cl.gfm),this.tokenizer.rules=i}static get rules(){return{block:Nu,inline:Cl}}static lex(t,i){return new Pg(i).lex(t)}static lexInline(t,i){return new Pg(i).inlineTokens(t)}lex(t){t=t.replace(Vn.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(Vn.tabCharGlobal," ").replace(Vn.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(v=>(h=v.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 v=i.at(-1);h.type==="text"&&v?.type==="text"?(v.raw+=h.raw,v.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 v=1/0,g=t.slice(1),x;this.options.extensions.startInline.forEach(C=>{x=C.call({lexer:this},g),typeof x=="number"&&x>=0&&(v=Math.min(v,x))}),v<1/0&&v>=0&&(d=t.substring(0,v+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 v=i.at(-1);v?.type==="text"?(v.raw+=h.raw,v.text+=h.text):i.push(h);continue}if(t){let v="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(v);break}else throw new Error(v)}}return i}},_h=class{options;parser;constructor(e){this.options=e||aa}space(e){return""}code({text:e,lang:t,escaped:i}){let s=(t||"").match(Vn.notSpaceStart)?.[0],o=e.replace(Vn.endingNewline,"")+`
|
|
138
|
+
`;return s?'<pre><code class="language-'+ar(s)+'">'+(i?o:ar(o,!0))+`</code></pre>
|
|
139
|
+
`:"<pre><code>"+(i?o:ar(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+" "+ar(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>${ar(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=Ty(e);if(o===null)return s;e=o;let f='<a href="'+e+'"';return t&&(f+=' title="'+ar(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=Ty(e);if(o===null)return ar(i);e=o;let f=`<img src="${e}" alt="${i}"`;return t&&(f+=` title="${ar(t)}"`),f+=">",f}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ar(e.text)}},Jm=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""}},Vi=class zg{options;renderer;textRenderer;constructor(t){this.options=t||aa,this.options.renderer=this.options.renderer||new _h,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Jm}static parse(t,i){return new zg(i).parse(t)}static parseInline(t,i){return new zg(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||aa}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?Ki.lex:Ki.lexInline}provideParser(){return this.block?Vi.parse:Vi.parseInline}},gC=class{defaults=Wm();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Vi;Renderer=_h;TextRenderer=Jm;Lexer=Ki;Tokenizer=mh;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 _h(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 v=c.apply(o,d);return v===!1&&(v=h.apply(o,d)),v||""}}s.renderer=o}if(i.tokenizer){let o=this.defaults.tokenizer||new mh(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 v=c.apply(o,d);return v===!1&&(v=h.apply(o,d)),v}}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 v=c.call(o,d);return h.call(o,v)}: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 v=c.apply(o,d);return v===!1&&(v=h.apply(o,d)),v}}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 Ki.lex(e,t??this.defaults)}parser(e,t){return Vi.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?Ki.lex:Ki.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?Vi.parse:Vi.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?Ki.lex:Ki.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?Vi.parse:Vi.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>"+ar(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},ra=new gC;function At(e,t){return ra.parse(e,t)}At.options=At.setOptions=function(e){return ra.setOptions(e),At.defaults=ra.defaults,rC(At.defaults),At};At.getDefaults=Wm;At.defaults=aa;At.use=function(...e){return ra.use(...e),At.defaults=ra.defaults,rC(At.defaults),At};At.walkTokens=function(e,t){return ra.walkTokens(e,t)};At.parseInline=ra.parseInline;At.Parser=Vi;At.parser=Vi.parse;At.Renderer=_h;At.TextRenderer=Jm;At.Lexer=Ki;At.lexer=Ki.lex;At.Tokenizer=mh;At.Hooks=Il;At.parse=At;At.options;At.setOptions;At.use;At.walkTokens;At.parseInline;Vi.parse;Ki.lex;const{entries:mC,setPrototypeOf:Ly,isFrozen:IO,getPrototypeOf:BO,getOwnPropertyDescriptor:PO}=Object;let{freeze:Xn,seal:$i,create:Za}=Object,{apply:Hg,construct:$g}=typeof Reflect<"u"&&Reflect;Xn||(Xn=function(t){return t});$i||($i=function(t){return t});Hg||(Hg=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)});$g||($g=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 kl=_n(Array.prototype.forEach),zO=_n(Array.prototype.lastIndexOf),My=_n(Array.prototype.pop),Tl=_n(Array.prototype.push),HO=_n(Array.prototype.splice),Gn=Array.isArray,Bl=_n(String.prototype.toLowerCase),wp=_n(String.prototype.toString),Ny=_n(String.prototype.match),Ka=_n(String.prototype.replace),Oy=_n(String.prototype.indexOf),$O=_n(String.prototype.trim),UO=_n(Number.prototype.toString),FO=_n(Boolean.prototype.toString),Dy=typeof BigInt>"u"?null:_n(BigInt.prototype.toString),jy=typeof Symbol>"u"?null:_n(Symbol.prototype.toString),rn=_n(Object.prototype.hasOwnProperty),Al=_n(Object.prototype.toString),In=_n(RegExp.prototype.test),Ou=WO(TypeError);function _n(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 Hg(e,t,s)}}function WO(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return $g(e,i)}}function Xe(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bl;if(Ly&&Ly(e,null),!Gn(t))return e;let s=t.length;for(;s--;){let o=t[s];if(typeof o=="string"){const f=i(o);f!==o&&(IO(t)||(t[s]=f),o=f)}e[o]=!0}return e}function GO(e){for(let t=0;t<e.length;t++)rn(e,t)||(e[t]=null);return e}function ci(e){const t=Za(null);for(const[i,s]of mC(e))rn(e,i)&&(Gn(s)?t[i]=GO(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=ci(s):t[i]=s);return t}function qO(e){switch(typeof e){case"string":return e;case"number":return UO(e);case"boolean":return FO(e);case"bigint":return Dy?Dy(e):"0";case"symbol":return jy?jy(e):"Symbol()";case"undefined":return Al(e);case"function":case"object":{if(e===null)return Al(e);const t=e,i=Ja(t,"toString");if(typeof i=="function"){const s=i(t);return typeof s=="string"?s:Al(s)}return Al(e)}default:return Al(e)}}function Ja(e,t){for(;e!==null;){const s=PO(e,t);if(s){if(s.get)return _n(s.get);if(typeof s.value=="function")return _n(s.value)}e=BO(e)}function i(){return null}return i}function KO(e){try{return In(e,""),!0}catch{return!1}}const Iy=Xn(["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"]),Cp=Xn(["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"]),Ep=Xn(["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"]),VO=Xn(["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"]),kp=Xn(["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"]),YO=Xn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),By=Xn(["#text"]),Py=Xn(["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"]),Tp=Xn(["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"]),zy=Xn(["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"]),Du=Xn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),XO=$i(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ZO=$i(/<%[\w\W]*|[\w\W]*%>/gm),JO=$i(/\$\{[\w\W]*/gm),QO=$i(/^data-[\-\w.\u00B7-\uFFFF]+$/),eD=$i(/^aria-[\-\w]+$/),_C=$i(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tD=$i(/^(?:\w+script|data):/i),nD=$i(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vC=$i(/^html$/i),iD=$i(/^[a-z][.\w]*(-[.\w]+)+$/i);var Hy=Object.freeze({__proto__:null,ARIA_ATTR:eD,ATTR_WHITESPACE:nD,CUSTOM_ELEMENT:iD,DATA_ATTR:QO,DOCTYPE_NAME:vC,ERB_EXPR:ZO,IS_ALLOWED_URI:_C,IS_SCRIPT_OR_DATA:tD,MUSTACHE_EXPR:XO,TMPLIT_EXPR:JO});const Rl={element:1,text:3,progressingInstruction:7,comment:8,document:9},rD=function(){return typeof window>"u"?null:window},sD=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}},$y=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function bC(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rD();const t=De=>bC(De);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Rl.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:v=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:x,trustedTypes:C}=e,T=h.prototype,w=Ja(T,"cloneNode"),m=Ja(T,"remove"),b=Ja(T,"nextSibling"),_=Ja(T,"childNodes"),S=Ja(T,"parentNode");if(typeof p=="function"){const De=i.createElement("template");De.content&&De.content.ownerDocument&&(i=De.content.ownerDocument)}let k,L="";const{implementation:R,createNodeIterator:N,createDocumentFragment:A,getElementsByTagName:B}=i,{importNode:V}=s;let U=$y();t.isSupported=typeof mC=="function"&&typeof S=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:I,TMPLIT_EXPR:X,DATA_ATTR:Y,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:G,ATTR_WHITESPACE:K,CUSTOM_ELEMENT:j}=Hy;let{IS_ALLOWED_URI:z}=Hy,D=null;const F=Xe({},[...Iy,...Cp,...Ep,...kp,...By]);let J=null;const ne=Xe({},[...Py,...Tp,...zy,...Du]);let Z=Object.seal(Za(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}})),re=null,q=null;const H=Object.seal(Za(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let se=!0,de=!0,xe=!1,ye=!0,Me=!1,Oe=!0,Fe=!1,ht=!1,Ae=!1,Rt=!1,Xt=!1,vn=!1,on=!0,kn=!1;const Zt="user-content-";let ct=!0,Lt=!1,Ct={},Ft=null;const Kt=Xe({},["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 Jn=null;const bn=Xe({},["audio","video","img","source","image","track"]);let Pn=null;const dt=Xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Tn="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",$e="http://www.w3.org/1999/xhtml";let Je=$e,_t=!1,Ve=null;const ln=Xe({},[Tn,ve,$e],wp);let Dt=Xe({},["mi","mo","mn","ms","mtext"]),An=Xe({},["annotation-xml"]);const Un=Xe({},["title","style","font","a","script"]);let jt=null;const ee=["application/xhtml+xml","text/html"],pe="text/html";let Se=null,je=null;const bt=i.createElement("form"),ut=function(Q){return Q instanceof RegExp||Q instanceof Function},ke=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(je&&je===Q)return;(!Q||typeof Q!="object")&&(Q={}),Q=ci(Q),jt=ee.indexOf(Q.PARSER_MEDIA_TYPE)===-1?pe:Q.PARSER_MEDIA_TYPE,Se=jt==="application/xhtml+xml"?wp:Bl,D=rn(Q,"ALLOWED_TAGS")&&Gn(Q.ALLOWED_TAGS)?Xe({},Q.ALLOWED_TAGS,Se):F,J=rn(Q,"ALLOWED_ATTR")&&Gn(Q.ALLOWED_ATTR)?Xe({},Q.ALLOWED_ATTR,Se):ne,Ve=rn(Q,"ALLOWED_NAMESPACES")&&Gn(Q.ALLOWED_NAMESPACES)?Xe({},Q.ALLOWED_NAMESPACES,wp):ln,Pn=rn(Q,"ADD_URI_SAFE_ATTR")&&Gn(Q.ADD_URI_SAFE_ATTR)?Xe(ci(dt),Q.ADD_URI_SAFE_ATTR,Se):dt,Jn=rn(Q,"ADD_DATA_URI_TAGS")&&Gn(Q.ADD_DATA_URI_TAGS)?Xe(ci(bn),Q.ADD_DATA_URI_TAGS,Se):bn,Ft=rn(Q,"FORBID_CONTENTS")&&Gn(Q.FORBID_CONTENTS)?Xe({},Q.FORBID_CONTENTS,Se):Kt,re=rn(Q,"FORBID_TAGS")&&Gn(Q.FORBID_TAGS)?Xe({},Q.FORBID_TAGS,Se):ci({}),q=rn(Q,"FORBID_ATTR")&&Gn(Q.FORBID_ATTR)?Xe({},Q.FORBID_ATTR,Se):ci({}),Ct=rn(Q,"USE_PROFILES")?Q.USE_PROFILES&&typeof Q.USE_PROFILES=="object"?ci(Q.USE_PROFILES):Q.USE_PROFILES:!1,se=Q.ALLOW_ARIA_ATTR!==!1,de=Q.ALLOW_DATA_ATTR!==!1,xe=Q.ALLOW_UNKNOWN_PROTOCOLS||!1,ye=Q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=Q.SAFE_FOR_TEMPLATES||!1,Oe=Q.SAFE_FOR_XML!==!1,Fe=Q.WHOLE_DOCUMENT||!1,Rt=Q.RETURN_DOM||!1,Xt=Q.RETURN_DOM_FRAGMENT||!1,vn=Q.RETURN_TRUSTED_TYPE||!1,Ae=Q.FORCE_BODY||!1,on=Q.SANITIZE_DOM!==!1,kn=Q.SANITIZE_NAMED_PROPS||!1,ct=Q.KEEP_CONTENT!==!1,Lt=Q.IN_PLACE||!1,z=KO(Q.ALLOWED_URI_REGEXP)?Q.ALLOWED_URI_REGEXP:_C,Je=typeof Q.NAMESPACE=="string"?Q.NAMESPACE:$e,Dt=rn(Q,"MATHML_TEXT_INTEGRATION_POINTS")&&Q.MATHML_TEXT_INTEGRATION_POINTS&&typeof Q.MATHML_TEXT_INTEGRATION_POINTS=="object"?ci(Q.MATHML_TEXT_INTEGRATION_POINTS):Xe({},["mi","mo","mn","ms","mtext"]),An=rn(Q,"HTML_INTEGRATION_POINTS")&&Q.HTML_INTEGRATION_POINTS&&typeof Q.HTML_INTEGRATION_POINTS=="object"?ci(Q.HTML_INTEGRATION_POINTS):Xe({},["annotation-xml"]);const _e=rn(Q,"CUSTOM_ELEMENT_HANDLING")&&Q.CUSTOM_ELEMENT_HANDLING&&typeof Q.CUSTOM_ELEMENT_HANDLING=="object"?ci(Q.CUSTOM_ELEMENT_HANDLING):Za(null);if(Z=Za(null),rn(_e,"tagNameCheck")&&ut(_e.tagNameCheck)&&(Z.tagNameCheck=_e.tagNameCheck),rn(_e,"attributeNameCheck")&&ut(_e.attributeNameCheck)&&(Z.attributeNameCheck=_e.attributeNameCheck),rn(_e,"allowCustomizedBuiltInElements")&&typeof _e.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=_e.allowCustomizedBuiltInElements),Me&&(de=!1),Xt&&(Rt=!0),Ct&&(D=Xe({},By),J=Za(null),Ct.html===!0&&(Xe(D,Iy),Xe(J,Py)),Ct.svg===!0&&(Xe(D,Cp),Xe(J,Tp),Xe(J,Du)),Ct.svgFilters===!0&&(Xe(D,Ep),Xe(J,Tp),Xe(J,Du)),Ct.mathMl===!0&&(Xe(D,kp),Xe(J,zy),Xe(J,Du))),H.tagCheck=null,H.attributeCheck=null,rn(Q,"ADD_TAGS")&&(typeof Q.ADD_TAGS=="function"?H.tagCheck=Q.ADD_TAGS:Gn(Q.ADD_TAGS)&&(D===F&&(D=ci(D)),Xe(D,Q.ADD_TAGS,Se))),rn(Q,"ADD_ATTR")&&(typeof Q.ADD_ATTR=="function"?H.attributeCheck=Q.ADD_ATTR:Gn(Q.ADD_ATTR)&&(J===ne&&(J=ci(J)),Xe(J,Q.ADD_ATTR,Se))),rn(Q,"ADD_URI_SAFE_ATTR")&&Gn(Q.ADD_URI_SAFE_ATTR)&&Xe(Pn,Q.ADD_URI_SAFE_ATTR,Se),rn(Q,"FORBID_CONTENTS")&&Gn(Q.FORBID_CONTENTS)&&(Ft===Kt&&(Ft=ci(Ft)),Xe(Ft,Q.FORBID_CONTENTS,Se)),rn(Q,"ADD_FORBID_CONTENTS")&&Gn(Q.ADD_FORBID_CONTENTS)&&(Ft===Kt&&(Ft=ci(Ft)),Xe(Ft,Q.ADD_FORBID_CONTENTS,Se)),ct&&(D["#text"]=!0),Fe&&Xe(D,["html","head","body"]),D.table&&(Xe(D,["tbody"]),delete re.tbody),Q.TRUSTED_TYPES_POLICY){if(typeof Q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ou('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ou('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Q.TRUSTED_TYPES_POLICY,L=k.createHTML("")}else k===void 0&&(k=sD(C,o)),k!==null&&typeof L=="string"&&(L=k.createHTML(""));Xn&&Xn(Q),je=Q},Ce=Xe({},[...Cp,...Ep,...VO]),Pe=Xe({},[...kp,...YO]),Vt=function(Q){let _e=S(Q);(!_e||!_e.tagName)&&(_e={namespaceURI:Je,tagName:"template"});const Ee=Bl(Q.tagName),at=Bl(_e.tagName);return Ve[Q.namespaceURI]?Q.namespaceURI===ve?_e.namespaceURI===$e?Ee==="svg":_e.namespaceURI===Tn?Ee==="svg"&&(at==="annotation-xml"||Dt[at]):!!Ce[Ee]:Q.namespaceURI===Tn?_e.namespaceURI===$e?Ee==="math":_e.namespaceURI===ve?Ee==="math"&&An[at]:!!Pe[Ee]:Q.namespaceURI===$e?_e.namespaceURI===ve&&!An[at]||_e.namespaceURI===Tn&&!Dt[at]?!1:!Pe[Ee]&&(Un[Ee]||!Ce[Ee]):!!(jt==="application/xhtml+xml"&&Ve[Q.namespaceURI]):!1},nt=function(Q){Tl(t.removed,{element:Q});try{S(Q).removeChild(Q)}catch{m(Q)}},Rn=function(Q,_e){try{Tl(t.removed,{attribute:_e.getAttributeNode(Q),from:_e})}catch{Tl(t.removed,{attribute:null,from:_e})}if(_e.removeAttribute(Q),Q==="is")if(Rt||Xt)try{nt(_e)}catch{}else try{_e.setAttribute(Q,"")}catch{}},dr=function(Q){let _e=null,Ee=null;if(Ae)Q="<remove></remove>"+Q;else{const Bt=Ny(Q,/^[\r\n\t ]+/);Ee=Bt&&Bt[0]}jt==="application/xhtml+xml"&&Je===$e&&(Q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Q+"</body></html>");const at=k?k.createHTML(Q):Q;if(Je===$e)try{_e=new x().parseFromString(at,jt)}catch{}if(!_e||!_e.documentElement){_e=R.createDocument(Je,"template",null);try{_e.documentElement.innerHTML=_t?L:at}catch{}}const Qe=_e.body||_e.documentElement;return Q&&Ee&&Qe.insertBefore(i.createTextNode(Ee),Qe.childNodes[0]||null),Je===$e?B.call(_e,Fe?"html":"body")[0]:Fe?_e.documentElement:Qe},fr=function(Q){return N.call(Q.ownerDocument||Q,Q,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Qn=function(Q){return Q instanceof g&&(typeof Q.nodeName!="string"||typeof Q.textContent!="string"||typeof Q.removeChild!="function"||!(Q.attributes instanceof v)||typeof Q.removeAttribute!="function"||typeof Q.setAttribute!="function"||typeof Q.namespaceURI!="string"||typeof Q.insertBefore!="function"||typeof Q.hasChildNodes!="function")},It=function(Q){return typeof c=="function"&&Q instanceof c};function Nt(De,Q,_e){kl(De,Ee=>{Ee.call(t,Q,_e,je)})}const Fi=function(Q){let _e=null;if(Nt(U.beforeSanitizeElements,Q,null),Qn(Q))return nt(Q),!0;const Ee=Se(Q.nodeName);if(Nt(U.uponSanitizeElement,Q,{tagName:Ee,allowedTags:D}),Oe&&Q.hasChildNodes()&&!It(Q.firstElementChild)&&In(/<[/\w!]/g,Q.innerHTML)&&In(/<[/\w!]/g,Q.textContent)||Oe&&Q.namespaceURI===$e&&Ee==="style"&&It(Q.firstElementChild)||Q.nodeType===Rl.progressingInstruction||Oe&&Q.nodeType===Rl.comment&&In(/<[/\w]/g,Q.data))return nt(Q),!0;if(re[Ee]||!(H.tagCheck instanceof Function&&H.tagCheck(Ee))&&!D[Ee]){if(!re[Ee]&&pr(Ee)&&(Z.tagNameCheck instanceof RegExp&&In(Z.tagNameCheck,Ee)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Ee)))return!1;if(ct&&!Ft[Ee]){const at=S(Q)||Q.parentNode,Qe=_(Q)||Q.childNodes;if(Qe&&at){const Bt=Qe.length;for(let Jt=Bt-1;Jt>=0;--Jt){const Qt=w(Qe[Jt],!0);at.insertBefore(Qt,b(Q))}}}return nt(Q),!0}return Q instanceof h&&!Vt(Q)||(Ee==="noscript"||Ee==="noembed"||Ee==="noframes")&&In(/<\/no(script|embed|frames)/i,Q.innerHTML)?(nt(Q),!0):(Me&&Q.nodeType===Rl.text&&(_e=Q.textContent,kl([W,I,X],at=>{_e=Ka(_e,at," ")}),Q.textContent!==_e&&(Tl(t.removed,{element:Q.cloneNode()}),Q.textContent=_e)),Nt(U.afterSanitizeElements,Q,null),!1)},Fr=function(Q,_e,Ee){if(q[_e]||on&&(_e==="id"||_e==="name")&&(Ee in i||Ee in bt))return!1;const at=J[_e]||H.attributeCheck instanceof Function&&H.attributeCheck(_e,Q);if(!(de&&!q[_e]&&In(Y,_e))){if(!(se&&In(P,_e))){if(!at||q[_e]){if(!(pr(Q)&&(Z.tagNameCheck instanceof RegExp&&In(Z.tagNameCheck,Q)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Q))&&(Z.attributeNameCheck instanceof RegExp&&In(Z.attributeNameCheck,_e)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(_e,Q))||_e==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&In(Z.tagNameCheck,Ee)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(Ee))))return!1}else if(!Pn[_e]){if(!In(z,Ka(Ee,K,""))){if(!((_e==="src"||_e==="xlink:href"||_e==="href")&&Q!=="script"&&Oy(Ee,"data:")===0&&Jn[Q])){if(!(xe&&!In(G,Ka(Ee,K,"")))){if(Ee)return!1}}}}}}return!0},ca=Xe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),pr=function(Q){return!ca[Bl(Q)]&&In(j,Q)},Rs=function(Q){Nt(U.beforeSanitizeAttributes,Q,null);const{attributes:_e}=Q;if(!_e||Qn(Q))return;const Ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let at=_e.length;for(;at--;){const Qe=_e[at],{name:Bt,namespaceURI:Jt,value:Qt}=Qe,be=Se(Bt),Ne=Qt;let Ie=Bt==="value"?Ne:$O(Ne);if(Ee.attrName=be,Ee.attrValue=Ie,Ee.keepAttr=!0,Ee.forceKeepAttr=void 0,Nt(U.uponSanitizeAttribute,Q,Ee),Ie=Ee.attrValue,kn&&(be==="id"||be==="name")&&Oy(Ie,Zt)!==0&&(Rn(Bt,Q),Ie=Zt+Ie),Oe&&In(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ie)){Rn(Bt,Q);continue}if(be==="attributename"&&Ny(Ie,"href")){Rn(Bt,Q);continue}if(Ee.forceKeepAttr)continue;if(!Ee.keepAttr){Rn(Bt,Q);continue}if(!ye&&In(/\/>/i,Ie)){Rn(Bt,Q);continue}Me&&kl([W,I,X],Wt=>{Ie=Ka(Ie,Wt," ")});const ft=Se(Q.nodeName);if(!Fr(ft,be,Ie)){Rn(Bt,Q);continue}if(k&&typeof C=="object"&&typeof C.getAttributeType=="function"&&!Jt)switch(C.getAttributeType(ft,be)){case"TrustedHTML":{Ie=k.createHTML(Ie);break}case"TrustedScriptURL":{Ie=k.createScriptURL(Ie);break}}if(Ie!==Ne)try{Jt?Q.setAttributeNS(Jt,Bt,Ie):Q.setAttribute(Bt,Ie),Qn(Q)?nt(Q):My(t.removed)}catch{Rn(Bt,Q)}}Nt(U.afterSanitizeAttributes,Q,null)},er=function(Q){let _e=null;const Ee=fr(Q);for(Nt(U.beforeSanitizeShadowDOM,Q,null);_e=Ee.nextNode();)Nt(U.uponSanitizeShadowNode,_e,null),Fi(_e),Rs(_e),_e.content instanceof f&&er(_e.content);Nt(U.afterSanitizeShadowDOM,Q,null)};return t.sanitize=function(De){let Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_e=null,Ee=null,at=null,Qe=null;if(_t=!De,_t&&(De="<!-->"),typeof De!="string"&&!It(De)&&(De=qO(De),typeof De!="string"))throw Ou("dirty is not a string, aborting");if(!t.isSupported)return De;if(ht||ke(Q),t.removed=[],typeof De=="string"&&(Lt=!1),Lt){const Qt=De.nodeName;if(typeof Qt=="string"){const be=Se(Qt);if(!D[be]||re[be])throw Ou("root node is forbidden and cannot be sanitized in-place")}}else if(De instanceof c)_e=dr("<!---->"),Ee=_e.ownerDocument.importNode(De,!0),Ee.nodeType===Rl.element&&Ee.nodeName==="BODY"||Ee.nodeName==="HTML"?_e=Ee:_e.appendChild(Ee);else{if(!Rt&&!Me&&!Fe&&De.indexOf("<")===-1)return k&&vn?k.createHTML(De):De;if(_e=dr(De),!_e)return Rt?null:vn?L:""}_e&&Ae&&nt(_e.firstChild);const Bt=fr(Lt?De:_e);for(;at=Bt.nextNode();)Fi(at),Rs(at),at.content instanceof f&&er(at.content);if(Lt)return De;if(Rt){if(Me){_e.normalize();let Qt=_e.innerHTML;kl([W,I,X],be=>{Qt=Ka(Qt,be," ")}),_e.innerHTML=Qt}if(Xt)for(Qe=A.call(_e.ownerDocument);_e.firstChild;)Qe.appendChild(_e.firstChild);else Qe=_e;return(J.shadowroot||J.shadowrootmode)&&(Qe=V.call(s,Qe,!0)),Qe}let Jt=Fe?_e.outerHTML:_e.innerHTML;return Fe&&D["!doctype"]&&_e.ownerDocument&&_e.ownerDocument.doctype&&_e.ownerDocument.doctype.name&&In(vC,_e.ownerDocument.doctype.name)&&(Jt="<!DOCTYPE "+_e.ownerDocument.doctype.name+`>
|
|
158
|
+
`+Jt),Me&&kl([W,I,X],Qt=>{Jt=Ka(Jt,Qt," ")}),k&&vn?k.createHTML(Jt):Jt},t.setConfig=function(){let De=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ke(De),ht=!0},t.clearConfig=function(){je=null,ht=!1},t.isValidAttribute=function(De,Q,_e){je||ke({});const Ee=Se(De),at=Se(Q);return Fr(Ee,at,_e)},t.addHook=function(De,Q){typeof Q=="function"&&Tl(U[De],Q)},t.removeHook=function(De,Q){if(Q!==void 0){const _e=zO(U[De],Q);return _e===-1?void 0:HO(U[De],_e,1)[0]}return My(U[De])},t.removeHooks=function(De){U[De]=[]},t.removeAllHooks=function(){U=$y()},t}var Fl=bC(),Ap,Uy;function aD(){if(Uy)return Ap;Uy=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 Se=ee[pe],je=typeof Se;(je==="object"||je==="function")&&!Object.isFrozen(Se)&&e(Se)}),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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(ee,...pe){const Se=Object.create(null);for(const je in ee)Se[je]=ee[je];return pe.forEach(function(je){for(const bt in je)Se[bt]=je[bt]}),Se}const o="</span>",f=ee=>!!ee.scope,p=(ee,{prefix:pe})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const Se=ee.split(".");return[`${pe}${Se.shift()}`,...Se.map((je,bt)=>`${je}${"_".repeat(bt+1)}`)].join(" ")}return`${pe}${ee}`};class c{constructor(pe,Se){this.buffer="",this.classPrefix=Se.classPrefix,pe.walk(this)}addText(pe){this.buffer+=i(pe)}openNode(pe){if(!f(pe))return;const Se=p(pe.scope,{prefix:this.classPrefix});this.span(Se)}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 Se=h({scope:pe});this.add(Se),this.stack.push(Se)}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,Se){return typeof Se=="string"?pe.addText(Se):Se.children&&(pe.openNode(Se),Se.children.forEach(je=>this._walk(pe,je)),pe.closeNode(Se)),pe}static _collapse(pe){typeof pe!="string"&&pe.children&&(pe.children.every(Se=>typeof Se=="string")?pe.children=[pe.children.join("")]:pe.children.forEach(Se=>{d._collapse(Se)}))}}class v extends d{constructor(pe){super(),this.options=pe}addText(pe){pe!==""&&this.add(pe)}startScope(pe){this.openNode(pe)}endScope(){this.closeNode()}__addSublanguage(pe,Se){const je=pe.root;Se&&(je.scope=`language:${Se}`),this.add(je)}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 x(ee){return w("(?=",ee,")")}function C(ee){return w("(?:",ee,")*")}function T(ee){return w("(?:",ee,")?")}function w(...ee){return ee.map(Se=>g(Se)).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(je=>g(je)).join("|")+")"}function _(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function S(ee,pe){const Se=ee&&ee.exec(pe);return Se&&Se.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function L(ee,{joinWith:pe}){let Se=0;return ee.map(je=>{Se+=1;const bt=Se;let ut=g(je),ke="";for(;ut.length>0;){const Ce=k.exec(ut);if(!Ce){ke+=ut;break}ke+=ut.substring(0,Ce.index),ut=ut.substring(Ce.index+Ce[0].length),Ce[0][0]==="\\"&&Ce[1]?ke+="\\"+String(Number(Ce[1])+bt):(ke+=Ce[0],Ce[0]==="("&&Se++)}return ke}).map(je=>`(${je})`).join(pe)}const R=/\b\B/,N="[a-zA-Z]\\w*",A="[a-zA-Z_]\\w*",B="\\b\\d+(\\.\\d+)?",V="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",U="\\b(0b[01]+)",W="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",I=(ee={})=>{const pe=/^#![ ]*\//;return ee.binary&&(ee.begin=w(pe,/.*\b/,ee.binary,/\b.*/)),s({scope:"meta",begin:pe,end:/$/,relevance:0,"on:begin":(Se,je)=>{Se.index!==0&&je.ignoreMatch()}},ee)},X={begin:"\\\\[\\s\\S]",relevance:0},Y={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[X]},P={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[X]},G={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/},K=function(ee,pe,Se={}){const je=s({scope:"comment",begin:ee,end:pe,contains:[]},Se);je.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 bt=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 je.contains.push({begin:w(/[ ]+/,"(",bt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),je},j=K("//","$"),z=K("/\\*","\\*/"),D=K("#","$"),F={scope:"number",begin:B,relevance:0},J={scope:"number",begin:V,relevance:0},ne={scope:"number",begin:U,relevance:0},Z={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[X,{begin:/\[/,end:/\]/,relevance:0,contains:[X]}]},re={scope:"title",begin:N,relevance:0},q={scope:"title",begin:A,relevance:0},H={begin:"\\.\\s*"+A,relevance:0};var de=Object.freeze({__proto__:null,APOS_STRING_MODE:Y,BACKSLASH_ESCAPE:X,BINARY_NUMBER_MODE:ne,BINARY_NUMBER_RE:U,COMMENT:K,C_BLOCK_COMMENT_MODE:z,C_LINE_COMMENT_MODE:j,C_NUMBER_MODE:J,C_NUMBER_RE:V,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(pe,Se)=>{Se.data._beginMatch=pe[1]},"on:end":(pe,Se)=>{Se.data._beginMatch!==pe[1]&&Se.ignoreMatch()}})},HASH_COMMENT_MODE:D,IDENT_RE:N,MATCH_NOTHING_RE:R,METHOD_GUARD:H,NUMBER_MODE:F,NUMBER_RE:B,PHRASAL_WORDS_MODE:G,QUOTE_STRING_MODE:P,REGEXP_MODE:Z,RE_STARTERS_RE:W,SHEBANG:I,TITLE_MODE:re,UNDERSCORE_IDENT_RE:A,UNDERSCORE_TITLE_MODE:q});function xe(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 Me(ee,pe){pe&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=xe,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function Oe(ee,pe){Array.isArray(ee.illegal)&&(ee.illegal=b(...ee.illegal))}function Fe(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 ht(ee,pe){ee.relevance===void 0&&(ee.relevance=1)}const Ae=(ee,pe)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const Se=Object.assign({},ee);Object.keys(ee).forEach(je=>{delete ee[je]}),ee.keywords=Se.keywords,ee.begin=w(Se.beforeMatch,x(Se.begin)),ee.starts={relevance:0,contains:[Object.assign(Se,{endsParent:!0})]},ee.relevance=0,delete Se.beforeMatch},Rt=["of","and","for","in","not","or","if","then","parent","list","value"],Xt="keyword";function vn(ee,pe,Se=Xt){const je=Object.create(null);return typeof ee=="string"?bt(Se,ee.split(" ")):Array.isArray(ee)?bt(Se,ee):Object.keys(ee).forEach(function(ut){Object.assign(je,vn(ee[ut],pe,ut))}),je;function bt(ut,ke){pe&&(ke=ke.map(Ce=>Ce.toLowerCase())),ke.forEach(function(Ce){const Pe=Ce.split("|");je[Pe[0]]=[ut,on(Pe[0],Pe[1])]})}}function on(ee,pe){return pe?Number(pe):kn(ee)?0:1}function kn(ee){return Rt.includes(ee.toLowerCase())}const Zt={},ct=ee=>{console.error(ee)},Lt=(ee,...pe)=>{console.log(`WARN: ${ee}`,...pe)},Ct=(ee,pe)=>{Zt[`${ee}/${pe}`]||(console.log(`Deprecated as of ${ee}. ${pe}`),Zt[`${ee}/${pe}`]=!0)},Ft=new Error;function Kt(ee,pe,{key:Se}){let je=0;const bt=ee[Se],ut={},ke={};for(let Ce=1;Ce<=pe.length;Ce++)ke[Ce+je]=bt[Ce],ut[Ce+je]=!0,je+=_(pe[Ce-1]);ee[Se]=ke,ee[Se]._emit=ut,ee[Se]._multi=!0}function Jn(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw ct("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ft;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw ct("beginScope must be object"),Ft;Kt(ee,ee.begin,{key:"beginScope"}),ee.begin=L(ee.begin,{joinWith:""})}}function bn(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw ct("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ft;if(typeof ee.endScope!="object"||ee.endScope===null)throw ct("endScope must be object"),Ft;Kt(ee,ee.end,{key:"endScope"}),ee.end=L(ee.end,{joinWith:""})}}function Pn(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function dt(ee){Pn(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),Jn(ee),bn(ee)}function Tn(ee){function pe(ke,Ce){return new RegExp(g(ke),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Ce?"g":""))}class Se{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ce,Pe){Pe.position=this.position++,this.matchIndexes[this.matchAt]=Pe,this.regexes.push([Pe,Ce]),this.matchAt+=_(Ce)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ce=this.regexes.map(Pe=>Pe[1]);this.matcherRe=pe(L(Ce,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ce){this.matcherRe.lastIndex=this.lastIndex;const Pe=this.matcherRe.exec(Ce);if(!Pe)return null;const Vt=Pe.findIndex((Rn,dr)=>dr>0&&Rn!==void 0),nt=this.matchIndexes[Vt];return Pe.splice(0,Vt),Object.assign(Pe,nt)}}class je{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 Pe=new Se;return this.rules.slice(Ce).forEach(([Vt,nt])=>Pe.addRule(Vt,nt)),Pe.compile(),this.multiRegexes[Ce]=Pe,Pe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ce,Pe){this.rules.push([Ce,Pe]),Pe.type==="begin"&&this.count++}exec(Ce){const Pe=this.getMatcher(this.regexIndex);Pe.lastIndex=this.lastIndex;let Vt=Pe.exec(Ce);if(this.resumingScanAtSamePosition()&&!(Vt&&Vt.index===this.lastIndex)){const nt=this.getMatcher(0);nt.lastIndex=this.lastIndex+1,Vt=nt.exec(Ce)}return Vt&&(this.regexIndex+=Vt.position+1,this.regexIndex===this.count&&this.considerAll()),Vt}}function bt(ke){const Ce=new je;return ke.contains.forEach(Pe=>Ce.addRule(Pe.begin,{rule:Pe,type:"begin"})),ke.terminatorEnd&&Ce.addRule(ke.terminatorEnd,{type:"end"}),ke.illegal&&Ce.addRule(ke.illegal,{type:"illegal"}),Ce}function ut(ke,Ce){const Pe=ke;if(ke.isCompiled)return Pe;[ye,Fe,dt,Ae].forEach(nt=>nt(ke,Ce)),ee.compilerExtensions.forEach(nt=>nt(ke,Ce)),ke.__beforeBegin=null,[Me,Oe,ht].forEach(nt=>nt(ke,Ce)),ke.isCompiled=!0;let Vt=null;return typeof ke.keywords=="object"&&ke.keywords.$pattern&&(ke.keywords=Object.assign({},ke.keywords),Vt=ke.keywords.$pattern,delete ke.keywords.$pattern),Vt=Vt||/\w+/,ke.keywords&&(ke.keywords=vn(ke.keywords,ee.case_insensitive)),Pe.keywordPatternRe=pe(Vt,!0),Ce&&(ke.begin||(ke.begin=/\B|\b/),Pe.beginRe=pe(Pe.begin),!ke.end&&!ke.endsWithParent&&(ke.end=/\B|\b/),ke.end&&(Pe.endRe=pe(Pe.end)),Pe.terminatorEnd=g(Pe.end)||"",ke.endsWithParent&&Ce.terminatorEnd&&(Pe.terminatorEnd+=(ke.end?"|":"")+Ce.terminatorEnd)),ke.illegal&&(Pe.illegalRe=pe(ke.illegal)),ke.contains||(ke.contains=[]),ke.contains=[].concat(...ke.contains.map(function(nt){return $e(nt==="self"?ke:nt)})),ke.contains.forEach(function(nt){ut(nt,Pe)}),ke.starts&&ut(ke.starts,Ce),Pe.matcher=bt(Pe),Pe}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||{}),ut(ee)}function ve(ee){return ee?ee.endsWithParent||ve(ee.starts):!1}function $e(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(pe){return s(ee,{variants:null},pe)})),ee.cachedVariants?ee.cachedVariants:ve(ee)?s(ee,{starts:ee.starts?s(ee.starts):null}):Object.isFrozen(ee)?s(ee):ee}var Je="11.11.1";class _t extends Error{constructor(pe,Se){super(pe),this.name="HTMLInjectionError",this.html=Se}}const Ve=i,ln=s,Dt=Symbol("nomatch"),An=7,Un=function(ee){const pe=Object.create(null),Se=Object.create(null),je=[];let bt=!0;const ut="Could not find the language '{}', did you forget to load/include a language module?",ke={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:v};function Pe(be){return Ce.noHighlightRe.test(be)}function Vt(be){let Ne=be.className+" ";Ne+=be.parentNode?be.parentNode.className:"";const Ie=Ce.languageDetectRe.exec(Ne);if(Ie){const ft=Q(Ie[1]);return ft||(Lt(ut.replace("{}",Ie[1])),Lt("Falling back to no-highlight mode for this block.",be)),ft?Ie[1]:"no-highlight"}return Ne.split(/\s+/).find(ft=>Pe(ft)||Q(ft))}function nt(be,Ne,Ie){let ft="",Wt="";typeof Ne=="object"?(ft=be,Ie=Ne.ignoreIllegals,Wt=Ne.language):(Ct("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ct("10.7.0",`Please use highlight(code, options) instead.
|
|
159
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Wt=be,ft=Ne),Ie===void 0&&(Ie=!0);const zn={code:ft,language:Wt};Jt("before:highlight",zn);const hi=zn.result?zn.result:Rn(zn.language,zn.code,Ie);return hi.code=zn.code,Jt("after:highlight",hi),hi}function Rn(be,Ne,Ie,ft){const Wt=Object.create(null);function zn(we,Re){return we.keywords[Re]}function hi(){if(!Ue.keywords){hn.addText(yt);return}let we=0;Ue.keywordPatternRe.lastIndex=0;let Re=Ue.keywordPatternRe.exec(yt),Ge="";for(;Re;){Ge+=yt.substring(we,Re.index);const it=Ln.case_insensitive?Re[0].toLowerCase():Re[0],Yt=zn(Ue,it);if(Yt){const[Ti,To]=Yt;if(hn.addText(Ge),Ge="",Wt[it]=(Wt[it]||0)+1,Wt[it]<=An&&(Wr+=To),Ti.startsWith("_"))Ge+=Re[0];else{const hc=Ln.classNameAliases[Ti]||Ti;di(Re[0],hc)}}else Ge+=Re[0];we=Ue.keywordPatternRe.lastIndex,Re=Ue.keywordPatternRe.exec(yt)}Ge+=yt.substring(we),hn.addText(Ge)}function ei(){if(yt==="")return;let we=null;if(typeof Ue.subLanguage=="string"){if(!pe[Ue.subLanguage]){hn.addText(yt);return}we=Rn(Ue.subLanguage,yt,!0,uc[Ue.subLanguage]),uc[Ue.subLanguage]=we._top}else we=fr(yt,Ue.subLanguage.length?Ue.subLanguage:null);Ue.relevance>0&&(Wr+=we.relevance),hn.__addSublanguage(we._emitter,we.language)}function Ot(){Ue.subLanguage!=null?ei():hi(),yt=""}function di(we,Re){we!==""&&(hn.startScope(Re),hn.addText(we),hn.endScope())}function lc(we,Re){let Ge=1;const it=Re.length-1;for(;Ge<=it;){if(!we._emit[Ge]){Ge++;continue}const Yt=Ln.classNameAliases[we[Ge]]||we[Ge],Ti=Re[Ge];Yt?di(Ti,Yt):(yt=Ti,hi(),yt=""),Ge++}}function ua(we,Re){return we.scope&&typeof we.scope=="string"&&hn.openNode(Ln.classNameAliases[we.scope]||we.scope),we.beginScope&&(we.beginScope._wrap?(di(yt,Ln.classNameAliases[we.beginScope._wrap]||we.beginScope._wrap),yt=""):we.beginScope._multi&&(lc(we.beginScope,Re),yt="")),Ue=Object.create(we,{parent:{value:Ue}}),Ue}function Co(we,Re,Ge){let it=S(we.endRe,Ge);if(it){if(we["on:end"]){const Yt=new t(we);we["on:end"](Re,Yt),Yt.isMatchIgnored&&(it=!1)}if(it){for(;we.endsParent&&we.parent;)we=we.parent;return we}}if(we.endsWithParent)return Co(we.parent,Re,Ge)}function ha(we){return Ue.matcher.regexIndex===0?(yt+=we[0],1):(Gr=!0,0)}function Gh(we){const Re=we[0],Ge=we.rule,it=new t(Ge),Yt=[Ge.__beforeBegin,Ge["on:begin"]];for(const Ti of Yt)if(Ti&&(Ti(we,it),it.isMatchIgnored))return ha(Re);return Ge.skip?yt+=Re:(Ge.excludeBegin&&(yt+=Re),Ot(),!Ge.returnBegin&&!Ge.excludeBegin&&(yt=Re)),ua(Ge,we),Ge.returnBegin?0:Re.length}function ti(we){const Re=we[0],Ge=Ne.substring(we.index),it=Co(Ue,we,Ge);if(!it)return Dt;const Yt=Ue;Ue.endScope&&Ue.endScope._wrap?(Ot(),di(Re,Ue.endScope._wrap)):Ue.endScope&&Ue.endScope._multi?(Ot(),lc(Ue.endScope,we)):Yt.skip?yt+=Re:(Yt.returnEnd||Yt.excludeEnd||(yt+=Re),Ot(),Yt.excludeEnd&&(yt=Re));do Ue.scope&&hn.closeNode(),!Ue.skip&&!Ue.subLanguage&&(Wr+=Ue.relevance),Ue=Ue.parent;while(Ue!==it.parent);return it.starts&&ua(it.starts,we),Yt.returnEnd?0:Re.length}function Eo(){const we=[];for(let Re=Ue;Re!==Ln;Re=Re.parent)Re.scope&&we.unshift(Re.scope);we.forEach(Re=>hn.openNode(Re))}let Ls={};function da(we,Re){const Ge=Re&&Re[0];if(yt+=we,Ge==null)return Ot(),0;if(Ls.type==="begin"&&Re.type==="end"&&Ls.index===Re.index&&Ge===""){if(yt+=Ne.slice(Re.index,Re.index+1),!bt){const it=new Error(`0 width match regex (${be})`);throw it.languageName=be,it.badRule=Ls.rule,it}return 1}if(Ls=Re,Re.type==="begin")return Gh(Re);if(Re.type==="illegal"&&!Ie){const it=new Error('Illegal lexeme "'+Ge+'" for mode "'+(Ue.scope||"<unnamed>")+'"');throw it.mode=Ue,it}else if(Re.type==="end"){const it=ti(Re);if(it!==Dt)return it}if(Re.type==="illegal"&&Ge==="")return yt+=`
|
|
160
|
+
`,1;if(ko>1e5&&ko>Re.index*3)throw new Error("potential infinite loop, way more iterations than matches");return yt+=Ge,Ge.length}const Ln=Q(be);if(!Ln)throw ct(ut.replace("{}",be)),new Error('Unknown language: "'+be+'"');const cc=Tn(Ln);let fa="",Ue=ft||cc;const uc={},hn=new Ce.__emitter(Ce);Eo();let yt="",Wr=0,gr=0,ko=0,Gr=!1;try{if(Ln.__emitTokens)Ln.__emitTokens(Ne,hn);else{for(Ue.matcher.considerAll();;){ko++,Gr?Gr=!1:Ue.matcher.considerAll(),Ue.matcher.lastIndex=gr;const we=Ue.matcher.exec(Ne);if(!we)break;const Re=Ne.substring(gr,we.index),Ge=da(Re,we);gr=we.index+Ge}da(Ne.substring(gr))}return hn.finalize(),fa=hn.toHTML(),{language:be,value:fa,relevance:Wr,illegal:!1,_emitter:hn,_top:Ue}}catch(we){if(we.message&&we.message.includes("Illegal"))return{language:be,value:Ve(Ne),illegal:!0,relevance:0,_illegalBy:{message:we.message,index:gr,context:Ne.slice(gr-100,gr+100),mode:we.mode,resultSoFar:fa},_emitter:hn};if(bt)return{language:be,value:Ve(Ne),illegal:!1,relevance:0,errorRaised:we,_emitter:hn,_top:Ue};throw we}}function dr(be){const Ne={value:Ve(be),illegal:!1,relevance:0,_top:ke,_emitter:new Ce.__emitter(Ce)};return Ne._emitter.addText(be),Ne}function fr(be,Ne){Ne=Ne||Ce.languages||Object.keys(pe);const Ie=dr(be),ft=Ne.filter(Q).filter(Ee).map(Ot=>Rn(Ot,be,!1));ft.unshift(Ie);const Wt=ft.sort((Ot,di)=>{if(Ot.relevance!==di.relevance)return di.relevance-Ot.relevance;if(Ot.language&&di.language){if(Q(Ot.language).supersetOf===di.language)return 1;if(Q(di.language).supersetOf===Ot.language)return-1}return 0}),[zn,hi]=Wt,ei=zn;return ei.secondBest=hi,ei}function Qn(be,Ne,Ie){const ft=Ne&&Se[Ne]||Ie;be.classList.add("hljs"),be.classList.add(`language-${ft}`)}function It(be){let Ne=null;const Ie=Vt(be);if(Pe(Ie))return;if(Jt("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 _t("One of your code blocks includes unescaped HTML.",be.innerHTML);Ne=be;const ft=Ne.textContent,Wt=Ie?nt(ft,{language:Ie,ignoreIllegals:!0}):fr(ft);be.innerHTML=Wt.value,be.dataset.highlighted="yes",Qn(be,Ie,Wt.language),be.result={language:Wt.language,re:Wt.relevance,relevance:Wt.relevance},Wt.secondBest&&(be.secondBest={language:Wt.secondBest.language,relevance:Wt.secondBest.relevance}),Jt("after:highlightElement",{el:be,result:Wt,text:ft})}function Nt(be){Ce=ln(Ce,be)}const Fi=()=>{pr(),Ct("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Fr(){pr(),Ct("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ca=!1;function pr(){function be(){pr()}if(document.readyState==="loading"){ca||window.addEventListener("DOMContentLoaded",be,!1),ca=!0;return}document.querySelectorAll(Ce.cssSelector).forEach(It)}function Rs(be,Ne){let Ie=null;try{Ie=Ne(ee)}catch(ft){if(ct("Language definition for '{}' could not be registered.".replace("{}",be)),bt)ct(ft);else throw ft;Ie=ke}Ie.name||(Ie.name=be),pe[be]=Ie,Ie.rawDefinition=Ne.bind(null,ee),Ie.aliases&&_e(Ie.aliases,{languageName:be})}function er(be){delete pe[be];for(const Ne of Object.keys(Se))Se[Ne]===be&&delete Se[Ne]}function De(){return Object.keys(pe)}function Q(be){return be=(be||"").toLowerCase(),pe[be]||pe[Se[be]]}function _e(be,{languageName:Ne}){typeof be=="string"&&(be=[be]),be.forEach(Ie=>{Se[Ie.toLowerCase()]=Ne})}function Ee(be){const Ne=Q(be);return Ne&&!Ne.disableAutodetect}function at(be){be["before:highlightBlock"]&&!be["before:highlightElement"]&&(be["before:highlightElement"]=Ne=>{be["before:highlightBlock"](Object.assign({block:Ne.el},Ne))}),be["after:highlightBlock"]&&!be["after:highlightElement"]&&(be["after:highlightElement"]=Ne=>{be["after:highlightBlock"](Object.assign({block:Ne.el},Ne))})}function Qe(be){at(be),je.push(be)}function Bt(be){const Ne=je.indexOf(be);Ne!==-1&&je.splice(Ne,1)}function Jt(be,Ne){const Ie=be;je.forEach(function(ft){ft[Ie]&&ft[Ie](Ne)})}function Qt(be){return Ct("10.7.0","highlightBlock will be removed entirely in v12.0"),Ct("10.7.0","Please use highlightElement now."),It(be)}Object.assign(ee,{highlight:nt,highlightAuto:fr,highlightAll:pr,highlightElement:It,highlightBlock:Qt,configure:Nt,initHighlighting:Fi,initHighlightingOnLoad:Fr,registerLanguage:Rs,unregisterLanguage:er,listLanguages:De,getLanguage:Q,registerAliases:_e,autoDetection:Ee,inherit:ln,addPlugin:Qe,removePlugin:Bt}),ee.debugMode=function(){bt=!1},ee.safeMode=function(){bt=!0},ee.versionString=Je,ee.regex={concat:w,lookahead:x,either:b,optional:T,anyNumberOfTimes:C};for(const be in de)typeof de[be]=="object"&&e(de[be]);return Object.assign(ee,de),ee},jt=Un({});return jt.newInstance=()=>Un({}),Ap=jt,jt.HighlightJS=jt,jt.default=jt,Ap}var oD=aD();const Ii=um(oD);function Fy(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:/'/},v={match:/\\'/},g={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},x=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=e.SHEBANG({binary:`(${x.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._-]+)+/},_=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["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:[..._,...S,"set","shopt",...k,...L]},contains:[C,e.SHEBANG(),T,g,f,p,b,c,h,d,v,i]}}const Wy="[A-Za-z$_][0-9A-Za-z$_]*",lD=["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"],cD=["true","false","null","undefined","NaN","Infinity"],yC=["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"],SC=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],xC=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],uD=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],hD=[].concat(xC,yC,SC);function Gy(e){const t=e.regex,i=(K,{after:j})=>{const z="</"+K[0].slice(1);return K.input.indexOf(z,j)!==-1},s=Wy,o={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,j)=>{const z=K[0].length+K.index,D=K.input[z];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(K,{after:z})||j.ignoreMatch());let F;const J=K.input.substring(z);if(F=J.match(/^\s*=/)){j.ignoreMatch();return}if((F=J.match(/^\s+extends\s+/))&&F.index===0){j.ignoreMatch();return}}},c={$pattern:Wy,keyword:lD,literal:cD,built_in:hD,"variable.language":uD},h="[0-9](_?[0-9])*",d=`\\.(${h})`,v="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${v})((${d})|\\.)?|(${d}))[eE][+-]?(${h})\\b`},{begin:`\\b(${v})\\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},x={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,x]},_={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]},S=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,{match:/\$\d+/},g];x.contains=S.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(S)});const k=[].concat(_,x.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:{_:[...yC,...SC]}},B={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},U={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function W(K){return t.concat("(?!",K.join("|"),")")}const I={match:t.concat(/\b/,W([...xC,"super","import"].map(K=>`${K}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},X={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",G={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],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}),B,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,_,{match:/\$\d+/},g,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},G,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[_,e.REGEXP_MODE,{className:"function",begin:P,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"]}]}]},V,{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},X,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},I,U,N,Y,{match:/\$[(.]/}]}}function dD(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 qy(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}/}]},v={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},g=e.inherit(d,{contains:[]}),x=e.inherit(v,{contains:[]});d.contains.push(x),v.contains.push(g);let C=[i,h];return[d,v,g,x].forEach(b=>{b.contains=b.contains.concat(C)}),C=C.concat(d,v),{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,v,{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 Ky(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:/#/},v={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,v,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,v,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,v,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,v,d]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x="[0-9](_?[0-9])*",C=`(\\b(${x}))?\\.(${x})|\\b(${x})\\.`,T=`\\b|${s.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${x})|(${C}))[eE][+-]?(${x})[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(${x})[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 vh="[A-Za-z$_][0-9A-Za-z$_]*",wC=["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"],CC=["true","false","null","undefined","NaN","Infinity"],EC=["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"],kC=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],TC=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],AC=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],RC=[].concat(TC,EC,kC);function fD(e){const t=e.regex,i=(K,{after:j})=>{const z="</"+K[0].slice(1);return K.input.indexOf(z,j)!==-1},s=vh,o={begin:"<>",end:"</>"},f=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,j)=>{const z=K[0].length+K.index,D=K.input[z];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(K,{after:z})||j.ignoreMatch());let F;const J=K.input.substring(z);if(F=J.match(/^\s*=/)){j.ignoreMatch();return}if((F=J.match(/^\s+extends\s+/))&&F.index===0){j.ignoreMatch();return}}},c={$pattern:vh,keyword:wC,literal:CC,built_in:RC,"variable.language":AC},h="[0-9](_?[0-9])*",d=`\\.(${h})`,v="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",g={className:"number",variants:[{begin:`(\\b(${v})((${d})|\\.)?|(${d}))[eE][+-]?(${h})\\b`},{begin:`\\b(${v})\\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},x={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,x],subLanguage:"graphql"}},m={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,x]},_={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]},S=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,{match:/\$\d+/},g];x.contains=S.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(S)});const k=[].concat(_,x.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:{_:[...EC,...kC]}},B={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},V={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[R],illegal:/%/},U={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function W(K){return t.concat("(?!",K.join("|"),")")}const I={match:t.concat(/\b/,W([...TC,"super","import"].map(K=>`${K}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},X={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Y={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},R]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",G={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],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}),B,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,m,_,{match:/\$\d+/},g,A,{scope:"attr",match:s+t.lookahead(":"),relevance:0},G,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[_,e.REGEXP_MODE,{className:"function",begin:P,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"]}]}]},V,{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},X,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[R]},I,U,N,Y,{match:/\$[(.]/}]}}function Vy(e){const t=e.regex,i=fD(e),s=vh,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:vh,keyword:wC.concat(h),literal:CC,built_in:RC.concat(o),"variable.language":AC},v={className:"meta",begin:"@"+s},g=(w,m,b)=>{const _=w.contains.findIndex(S=>S.label===m);if(_===-1)throw new Error("can not find mode to replace");w.contains.splice(_,1,b)};Object.assign(i.keywords,d),i.exports.PARAMS_CONTAINS.push(v);const x=i.contains.find(w=>w.scope==="attr"),C=Object.assign({},x,{match:t.concat(s,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,x,C]),i.contains=i.contains.concat([v,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 pD=/\[\[wiki:([^\]]+)\]\]/g,gD=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,mD=/^(\S[^:]*?):[ \t]*(.*)$/,_D=new gC({gfm:!0,breaks:!1}),Yy={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},Rp=MD();function bh(e,t={}){const{entries:i,content:s}=yD(e),o=wD(s,t.resolveWikiLink),f=_D.parse(o,{async:!1}),p=xD(i),c=Fl.sanitize(p+f,Yy),h=new DOMParser().parseFromString(c,"text/html");return ED(h,t.omitDuplicateTitle),CD(h),kD(h),AD(h),{html:Fl.sanitize(h.body.innerHTML,Yy),toc:RD(h)}}function vD(e){const t=new TextEncoder().encode(e);let i="";for(const s of t)i+=String.fromCharCode(s);return btoa(i)}function bD(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 yD(e){const t=gD.exec(e);return t?{entries:SD(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function SD(e){const t=[];for(const i of e.split(/\r?\n/)){const s=i.replace(/\s+$/,"");if(s.trim()==="")continue;const o=mD.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 xD(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${Wl(i.key)}</dt><dd>${Wl(i.value)}</dd>`).join("")}</dl>`}function wD(e,t){return e.replace(pD,(i,s)=>{const o=s.trim();if(!o)return"";if(!t)return Wl(`[[wiki:${o}]]`);const f=t(o);if(f===null)return Wl(`[[wiki:${o}]]`);const p=Wl(o),c=encodeURIComponent(o);return`<a href="${f}" data-entry-id="${c}">${p}</a>`})}function CD(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const s=i.textContent?.trim()??"",o=DD(s||"section"),f=t.get(o)??0;t.set(o,f+1),i.id=f===0?o:`${o}-${f+1}`}}function ED(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||Xy(i.textContent??"")===Xy(t)&&i.remove()}function kD(e){for(const t of e.querySelectorAll("pre > code")){const i=ND(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",vD(s)),p.setAttribute("data-diagram-state","pending"),o.replaceWith(p);continue}const f=LD(s,i);t.innerHTML=f,t.classList.add("hljs"),o.classList.add("code-block"),o.dataset.code=s,o.insertBefore(TD(e,i||"text"),o.firstChild)}}function TD(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 AD(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";OD(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function RD(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 LD(e,t){return t&&Rp.getLanguage(t)?Rp.highlight(e,{language:t}).value:Rp.highlightAuto(e).value}function MD(){return Ii.registerLanguage("bash",Fy),Ii.registerLanguage("sh",Fy),Ii.registerLanguage("javascript",Gy),Ii.registerLanguage("js",Gy),Ii.registerLanguage("json",dD),Ii.registerLanguage("markdown",qy),Ii.registerLanguage("md",qy),Ii.registerLanguage("python",Ky),Ii.registerLanguage("py",Ky),Ii.registerLanguage("typescript",Vy),Ii.registerLanguage("ts",Vy),Ii}function ND(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function OD(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function DD(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function Xy(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Wl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const jD="modulepreload",ID=function(e){return"/console/"+e},Zy={},BD=function(t,i,s){let o=Promise.resolve();if(i&&i.length>0){let h=function(d){return Promise.all(d.map(v=>Promise.resolve(v).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=ID(d),d in Zy)return;Zy[d]=!0;const v=d.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const x=document.createElement("link");if(x.rel=v?"stylesheet":jD,v||(x.as="script"),x.crossOrigin="",x.href=d,c&&x.setAttribute("nonce",c),document.head.appendChild(x),v)return new Promise((C,T)=>{x.addEventListener("load",C),x.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)})},PD=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",zD=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),HD=/^on/i,$D={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},Jy="diagramInteractionBound",UD=/^oklch\s*\(\s*([^)]+)\s*\)$/i,FD=/^(-?\d+(?:\.\d+)?)(deg)?$/i,zi=[25,50,75,100,125,150,200],WD=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let Lp=null;const Qy=new WeakSet;let GD=0,qD=0,Jl=null;function Ss(e){const t=e.trim();if(!t)return t;const i=p8(t);return i?g8(i):t}function LC(e){if(Qy.has(e))return;Qy.add(e),eS(e);const t=e instanceof Node?e:document.body;new MutationObserver(s=>{let o=!1;for(const f of s)if(f.type==="childList"){Jl&&!Jl.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&&eS(e)}).observe(t,{childList:!0,subtree:!0})}function eS(e){const t=e.querySelectorAll(PD);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",KD(i))}async function KD(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=bD(t)}catch{Mp(e,"Invalid diagram source");return}if(!i.trim()){Mp(e,"Empty diagram source");return}try{const s=await YD(),o=`mermaid-diagram-${++GD}`,{svg:f}=await s.render(o,i);e.innerHTML=VD(f),JD(e,f),QD(e),e8(e),e.dataset.diagramState="rendered"}catch(s){const o=s instanceof Error?s.message:String(s);Mp(e,o)}}function Mp(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function VD(e){const t=(i,s)=>{HD.test(s.attrName)&&(s.keepAttr=!1)};Fl.addHook("uponSanitizeAttribute",t);try{return Fl.sanitize(e,$D)}finally{Fl.removeHook("uponSanitizeAttribute",t)}}async function YD(){return Lp||(Lp=(async()=>{const e=await BD(()=>import("./mermaid.core-DNlIf4_3.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:XD(),themeCSS:ZD(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),Lp}function XD(){const e=getComputedStyle(document.documentElement),t=(w,m)=>{const b=e.getPropertyValue(w).trim();return Ss(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"),v=t("--ink-fog","#a6afbb"),g=t("--ink-pearl","#e6e9ef"),x=t("--ink-spectral","#bcc4d0"),C=[o,s,p,h,Ss("oklch(70% 0.11 68)"),c,Ss("oklch(76% 0.09 205)"),f,Ss("oklch(68% 0.14 30)"),v,Ss("oklch(62% 0.08 228)"),Ss("oklch(52% 0.05 248)")],T=Object.fromEntries(WD.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:x,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 ZD(){const e=getComputedStyle(document.documentElement),t=(d,v)=>{const g=e.getPropertyValue(d).trim();return Ss(g||v)},i=t("--brass-deep","#a0782a"),s=t("--brass-bright","#e6b86a"),o=t("--aurora-deep","#1f8aa8"),f=t("--ink-abyss","#131920"),p=Ss("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 JD(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")??"",v=NC(d);v&&h.setAttribute("href",v)}}function QD(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",`${io(s)} ${io(o)} ${io(f)} ${io(p)}`)}function e8(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),h8(e),e.dataset[Jy]!=="true"&&(e.dataset[Jy]="true",e.addEventListener("click",t8),e.addEventListener("keydown",n8))}function t8(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||yh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),MC(t))}function n8(e){if(e.key!=="Enter"&&e.key!==" "||yh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),MC(t))}function MC(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=++qD,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 v=document.createElement("div");v.className="diagram-lightbox__controls",v.setAttribute("aria-label","Diagram zoom controls");const g=ju("−","Zoom out","out"),x=document.createElement("span");x.className="diagram-lightbox__zoom-readout",x.setAttribute("aria-live","polite");const C=ju("+","Zoom in","in"),T=ju("Fit","Fit diagram to viewport","fit"),w=ju("Reset","Reset diagram zoom","reset");v.append(g,x,C,T,w);const m=document.createElement("div");m.className="diagram-lightbox__viewport";const b=s8(t),_=t.cloneNode(!0);_.removeAttribute("style"),o8(_,`diagram-lightbox-svg-${o}`),m.append(_),c.append(h,v,d),p.append(c,m),s.append(p),document.body.append(s);const S=new i8(m,_,x,b);g.addEventListener("click",()=>S.zoomOut()),C.addEventListener("click",()=>S.zoomIn()),T.addEventListener("click",()=>S.fit()),w.addEventListener("click",()=>S.reset());const k=l8(s),L=A=>{(A.target===s||A.target===d)&&Pl(!0)},R=A=>{if(A.key==="Escape"){A.preventDefault(),Pl(!0);return}S.handleKeyboard(A)||A.key==="Tab"&&u8(A,s)},N={dialog:s,trigger:e,inertStates:k,onClick:L,onKeyDown:R,cleanupPanZoom:()=>S.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),Jl=N,S.fit(),d.focus()}function ju(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 i8{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=zi.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,zi.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(zi.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=zi.findIndex(c=>c>o),p=f===-1?zi.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*(Iu(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Iu(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=Iu(this.zoomIndex),s=i/100;this.svg.setAttribute("width",io(this.baseSize.width*s)),this.svg.setAttribute("height",io(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||yh(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=Iu(this.pinchStart.zoomIndex)*s;this.applyZoom(a8(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,zi.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{yh(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===zi.indexOf(200)?zi.indexOf(100):zi.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 r8(e){const t=tS(e.getAttribute("width")),i=tS(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 s8(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:r8(e)}function tS(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 io(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function a8(e){let t=0,i=Number.POSITIVE_INFINITY;return zi.forEach((s,o)=>{const f=Math.abs(s-e);f<i&&(i=f,t=o)}),t}function Iu(e){return zi[e]??zi[0]}function o8(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=Jl;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),c8(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),Jl=null,e&&t.trigger.isConnected&&t.trigger.focus())}function l8(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 c8(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 u8(e,t){const i=Array.from(t.querySelectorAll(zD)).filter(f8);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 h8(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function yh(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!d8(t)}function d8(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function f8(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function NC(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:NC(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 p8(e){const t=UD.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 v=Np(c,1),g=Np(h,.4),x=m8(d);if(v===null||g===null||x===null)return null;let C=1;if(s>=0){const T=Np(f,1);if(T===null)return null;C=T}return{L:v,C:g,h:x,alpha:C}}function g8(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,v=c**3,g=4.0767416621*h-3.3077115913*d+.2309699292*v,x=-1.2684380046*h+2.6097574011*d-.3413193965*v,C=-.0041960863*h-.7034186147*d+1.707614701*v,T=Bu(Op(g)),w=Bu(Op(x)),m=Bu(Op(C));if(e.alpha<1){const b=Bu(e.alpha);return`#${Vs(T)}${Vs(w)}${Vs(m)}${Vs(b)}`}return`#${Vs(T)}${Vs(w)}${Vs(m)}`}function Np(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 m8(e){const t=FD.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function Op(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 Bu(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function Vs(e){return e.toString(16).padStart(2,"0")}const _8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),v8=new Set(["img.shields.io"]),b8=/^[a-z][a-z0-9+.-]*:/i;function nS(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||b8.test(i))return null;const s=OC(i);if(!s)return null;const o=x8(s);return o===null?null:w8(o,t)}function y8(e){const t=OC(e).toLowerCase();return[..._8].some(i=>t.endsWith(i))}function iS(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function S8(e){try{const t=new URL(e);return t.protocol==="https:"&&v8.has(t.hostname)}catch{return!1}}function OC(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function x8(e){try{return decodeURI(e)}catch{return null}}function w8(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 C8({content:e,onOpenPath:t,relativePath:i,theaterId:s,truncated:o}){const f=M.useMemo(()=>{const g=bh(e).html,x=new DOMParser().parseFromString(g,"text/html");return Dp(x.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:s}),x.body.innerHTML},[e,i,s]),p=M.useRef(null);M.useEffect(()=>{const g=p.current;if(!g)return;LC(g),Dp(g,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s});const x=new MutationObserver(()=>Dp(g,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s}));return x.observe(g,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>x.disconnect()},[f,i,s]);const c=M.useCallback(g=>{const x=g.target.closest('[data-action="copy-code"]');if(!x)return;const C=x.closest("pre")?.getAttribute("data-code");if(!C)return;navigator.clipboard?.writeText(C);const T=x.textContent;x.textContent="Copied",window.setTimeout(()=>{x.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]),v=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:v,onKeyDown:d,dangerouslySetInnerHTML:{__html:f}})]})}function Dp(e,t){for(const i of e.querySelectorAll("a[href]")){const s=i.getAttribute("href")??"",o=nS(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===iS(t.theaterId,o)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&S8(s)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const f=nS(s,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&f&&y8(f)){i.setAttribute("src",iS(t.theaterId,f)),i.setAttribute("data-fexp-local-image-path",f),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&E8(i)}}function E8(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 k8=360,Qm=248,e_=200,Sh=160,xh=4;function T8(e){return e-e_-xh>=Sh}function A8(e,t,i){const s=i-e_-xh;return s<Sh?e:Math.max(Sh,Math.min(s,e-t))}function R8(e){const t=e_+xh;return`minmax(0, 1fr) ${xh}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function L8(e){return e?k8:null}const DC="fleet-console.file-explorer.treePaneWidth",t_={selectedPath:null,viewState:{kind:"none"}},M8={...t_,treePaneWidth:Qm},jC=new Map,rS=new Map,Ug=new Set;let wh=I8();function N8(e){return M.useSyncExternalStore(j8,()=>D8(e),()=>M8)}function sS(e,t){e&&PC(e,{selectedPath:t})}function ms(e,t){e&&PC(e,{viewState:t})}function O8(e){wh=zC(e);try{localStorage.setItem(DC,String(wh))}catch{}IC()}function IC(){for(const e of Ug)e()}function BC(e){return jC.get(e)??t_}function D8(e){const t=e??"__none__",i=e!=null?BC(e):t_,s=rS.get(t);if(s&&s.selectedPath===i.selectedPath&&s.viewState===i.viewState&&s.treePaneWidth===wh)return s;const o={...i,treePaneWidth:wh};return rS.set(t,o),o}function PC(e,t){jC.set(e,{...BC(e),...t}),IC()}function j8(e){return Ug.add(e),()=>{Ug.delete(e)}}function I8(){try{return zC(Number(localStorage.getItem(DC)))}catch{return Qm}}function zC(e){return!Number.isFinite(e)||e<=0?Qm:Math.max(Sh,Math.round(e))}const B8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),P8={id:"file-explorer",title:"Files",icon:$8,render:e=>u.jsx(H8,{...e})};function z8(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 H8(e){const{theaterId:t}=e,{selectedPath:i,viewState:s,treePaneWidth:o}=N8(t),f=M.useRef(o);f.current=o;const p=M.useRef(null),[c,h]=M.useState(!1),d=M.useMemo(()=>z8(t),[t]),v=M.useCallback(async(w,m)=>{if(!t){ms(t,{kind:"error",message:"no_theater"});return}sS(t,w);const b=m??w.split("/").filter(Boolean).at(-1)??w,_=b.slice(b.lastIndexOf(".")).toLowerCase();if(B8.has(_)){const S=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(w)}`:"";ms(t,{kind:"image",relativePath:w,name:b,src:S});return}ms(t,{kind:"loading"});try{const S=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:w})});if(!S.ok){const L=await S.json();throw new Error(L.error??"read_failed")}const k=await S.json();if(k.binary){ms(t,{kind:"binary",name:b});return}ms(t,{kind:"code",relativePath:k.relativePath,content:k.content,lang:k.lang,truncated:k.truncated})}catch(S){const k=S instanceof Error?S.message:"Unable to load file";k==="binary_file"?ms(t,{kind:"binary",name:b}):ms(t,{kind:"error",message:k})}},[t]),g=M.useCallback(async w=>{w.kind==="file"&&await v(w.relativePath,w.name)},[v]),x=M.useCallback(()=>{ms(t,{kind:"none"}),sS(t,null)},[t]),C=M.useCallback(w=>{w.preventDefault();const m=p.current;if(!m)return;const b=m.getBoundingClientRect().width;if(!T8(b))return;const _=w.clientX,S=f.current;h(!0);const k=R=>{const N=R.clientX-_,A=A8(S,N,b);f.current=A,O8(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?.(L8(T))},[e,T]),u.jsxs("div",{ref:p,className:`fexp-root${T?" is-split":" is-tree-only"}${c?" is-dragging":""}`,style:T?{gridTemplateColumns:R8(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:x,"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(C8,{content:s.content,onOpenPath:v,relativePath:s.relativePath,theaterId:t,truncated:s.truncated}),s.kind==="code"&&s.lang!=="markdown"&&u.jsx(XN,{content:s.content,lang:s.lang,truncated:s.truncated}),s.kind==="image"&&u.jsx(QN,{src:s.src,name:s.name}),s.kind==="binary"&&u.jsx(zN,{name:s.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:C,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(BN,{files:d,theaterId:t,selectedPath:i,onSelect:g})})]})}function $8(){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 U8={id:"file-explorer",railPanels:[P8]},F8=[U8],W8={M:"M",A:"A",D:"D",R:"R",U:"U"};function G8(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 q8({files:e,selectedPath:t,onSelect:i}){const s=G8(e);return u.jsx(HC,{node:s,depth:0,selectedPath:t,onSelect:i})}function HC({node:e,depth:t,selectedPath:i,onSelect:s}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([o,f])=>u.jsx(K8,{dirKey:o,node:f,depth:t,selectedPath:i,onSelect:s},o)),e.files.map(o=>u.jsx(V8,{entry:o,depth:t,selectedPath:i,onSelect:s},o.path))]})}function K8({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 v=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:`${v}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(HC,{node:d,depth:i+1,selectedPath:s,onSelect:o})]})}function V8({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:W8[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 aS="fleet-console.diff.changesCollapsed",Y8={M:"modified",A:"added",D:"deleted",R:"renamed",U:"untracked"};function X8(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function Z8({ctx:e,viewMode:t,selectedPath:i,subPath:s,onSelect:o}){const[f,p]=M.useState({kind:"loading"}),[c,h]=M.useState(0),[d,v]=M.useState(()=>X8(aS));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),[]),x=M.useCallback(()=>{v(C=>{const T=!C;try{localStorage.setItem(aS,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:x,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(q8,{files:f.files,selectedPath:i,onSelect:o}):f.files.map(C=>u.jsx(J8,{entry:C,isSelected:C.path===i,onSelect:o},C.path))})]})})}function J8({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":Y8[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 Fg=new Set;let sa={file:null,commit:null};function Fh(){for(const e of Fg)e()}function $C(e){return Fg.add(e),()=>{Fg.delete(e)}}function Ch(){return sa}function Q8(e){const t=M.useSyncExternalStore($C,Ch,Ch);return!t.file||t.file.theaterId!==e?null:t.file}function UC(e){const t=M.useSyncExternalStore($C,Ch,Ch);return!t.commit||t.commit.theaterId!==e?null:t.commit}function e7(e,t,i){sa={file:{entry:e,subPath:t,theaterId:i},commit:null},Fh()}function t7(e,t,i){sa={file:null,commit:{commit:e,subPath:t,theaterId:i}},Fh()}function jp(){sa={file:null,commit:sa.commit},Fh()}function Ip(){sa={file:sa.file,commit:null},Fh()}const Wg=12,Va=20,Bp=3,n7=5;function Ll(e){return e*Wg+6}function i7({node:e,laneCount:t,collapsed:i=!1}){const s=Math.max(t,1),o=i?10:0,f=s*Wg+o,p=Ll(e.lane),c=Va/2;return u.jsxs("svg",{width:f,height:Va,viewBox:`0 0 ${f} ${Va}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(h=>u.jsx("line",{x1:Ll(h),y1:0,x2:Ll(h),y2:Va,stroke:"var(--ink-rim)",strokeWidth:1.5},`pt-${h}`)),e.connectAbove&&u.jsx("line",{x1:p,y1:0,x2:p,y2:c-Bp,stroke:"var(--ink-rim)",strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:p,y1:c+Bp,x2:p,y2:Va,stroke:"var(--ink-rim)",strokeWidth:1.5}),e.mergeFromLanes.map(h=>u.jsx("line",{x1:Ll(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:Ll(h),y2:Va,stroke:"var(--ink-rim)",strokeWidth:1.5,strokeLinecap:"round"},`bt-${h}`)),e.isHead&&u.jsx("circle",{cx:p,cy:c,r:n7,fill:"none",stroke:"var(--brass)",strokeWidth:1.5}),u.jsx("circle",{cx:p,cy:c,r:Bp,fill:e.isHead?"var(--brass)":"var(--ink-fog)"}),i&&u.jsx("text",{x:s*Wg+2,y:c+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const oS=3;function r7(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 v;const g=[];if(d.length===0){const w=t.indexOf(null);w>=0?v=w:(v=t.length,t.push(null))}else{v=Math.min(...d);for(const w of d)w!==v&&(g.push(w),t[w]=null)}const x=[];if(h.length===0)t[v]=null;else{t[v]=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,x.push(b);else{const _=t.length;t.push(w),x.push(_)}}}const C=t.map((w,m)=>({h:w,i:m})).filter(({h:w})=>w!==null).map(({i:w})=>w);if(C.length>oS){s=!0;const w=C.filter(m=>m!==v).sort((m,b)=>b-m).slice(0,C.length-oS);for(const m of w){t[m]=null;const b=x.indexOf(m);b>=0&&x.splice(b,1)}}const T=t.map((w,m)=>({h:w,i:m})).filter(({h:w,i:m})=>w!==null&&m!==v).map(({i:w})=>w);o=Math.max(o,v,...x,...T),i.push({lane:v,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:x})}return{nodes:i,activeLaneCount:o+1,collapsed:s}}function s7(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 lS="fleet-console.diff.historyCollapsed";function a7(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function o7({entry:e,isCur:t,onClick:i,graphNode:s,laneCount:o=0,layoutCollapsed:f=!1}){const p=M.useCallback(()=>i(e),[e,i]),c=s7(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(i7,{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 l7({ctx:e,subPath:t,refreshToken:i=0,graphMode:s="flat"}){const[o,f]=M.useState({kind:"loading"}),[p,c]=M.useState(()=>a7(lS)),[h,d]=M.useState(0),v=UC(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 _=>{if(!_.ok){const L=(await _.json()).error??"unknown";b||f(L==="git_unavailable"?{kind:"ok",commits:[]}:{kind:"error",message:L});return}const S=await _.json();b||f({kind:"ok",commits:S.commits})}).catch(_=>{b||f({kind:"error",message:_ instanceof Error?_.message:"unknown"})}),()=>{b=!0}},[e.theaterId,e.api,t,i,h]);const g=M.useCallback(()=>{c(b=>{const _=!b;try{localStorage.setItem(lS,_?"1":"0")}catch{}return _})},[]),x=M.useCallback(()=>d(b=>b+1),[]),C=M.useCallback(b=>{e.theaterId&&t7(b,t,e.theaterId)},[e.theaterId,t]),T=o.kind==="ok"?o.commits.length:0,w=o.kind==="ok"&&s==="graph"?r7(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:x,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,_)=>u.jsx(o7,{entry:b,isCur:v?.commit.fullHash===b.fullHash,onClick:C,graphNode:w?w.nodes[_]??null:null,laneCount:w?w.activeLaneCount:0,layoutCollapsed:m},b.fullHash))]})]})}const c7=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,u7=/^diff --git a\/(.+) b\/(.+)$/;function h7(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=u7.exec(p),h=c?.[1],d=c?.[2]??p,v=h!==void 0&&h!==d?h:void 0;i.push({kind:"file-label",text:d,oldPath:v}),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=c7.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 Pp(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function cS({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 v=!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 x=await g.json();v||p({kind:"ok",result:x})}).catch(g=>{v||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 x=await g.json();v||p({kind:"ok",result:x})}).catch(g=>{v||p({kind:"error",message:g instanceof Error?g.message:"unknown"})}),()=>{v=!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=h7(c.content),d=o?h:h.filter(v=>v.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((v,g)=>u.jsx("tr",{className:`diff-line diff-line-${v.kind}`,children:v.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:Pp(v.text)}}):v.kind==="file-label"?u.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:Pp(v.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"diff-gutter diff-gutter-old",children:v.oldLine??""}),u.jsx("td",{className:"diff-gutter diff-gutter-new",children:v.newLine??""}),u.jsx("td",{className:"diff-marker",children:v.kind==="add"?"+":v.kind==="del"?"−":""}),u.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:Pp(v.text.length>0?v.text.slice(1):v.text)}})]})},g))})})})]})}const Eh=140,Ql=4,d7=null;function f7({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:s,hunkPaneMinWidth:o,dividerWidth:f}){const p=i-o-f;return p<s?d7:Math.max(s,Math.min(p,e-t))}function p7(e){const t=Eh+Ql;return`minmax(0, 1fr) ${Ql}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function g7(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 m7(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 FC="fleet-console.diff.viewMode",WC="fleet-console.diff.listPaneWidth",GC="fleet-console.diff.depth",qC="fleet-console.diff.repo.",KC="fleet-console.diff.historyGraphMode",_7=400,VC=248,kh=220,v7=3,b7=[{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 y7(){try{const e=localStorage.getItem(FC);if(e==="list"||e==="tree")return e}catch{}return"list"}function S7(){try{const e=localStorage.getItem(WC);if(e!==null){const t=parseFloat(e);if(Number.isFinite(t)&&t>0)return E7(t)}}catch{}return VC}function x7(){try{const e=localStorage.getItem(GC);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=1)return t}}catch{}return v7}function w7(){try{const e=localStorage.getItem(KC);if(e==="flat"||e==="graph")return e}catch{}return"flat"}function uS(e){try{return localStorage.getItem(qC+e)??""}catch{return""}}function C7(e,t){try{localStorage.setItem(qC+e,t)}catch{}}function E7(e){const t=typeof window>"u"?VC:window.innerWidth-Eh-Ql,i=Math.max(kh,t);return Math.max(kh,Math.min(i,e))}function k7(e){return e.entry.status==="U"?"untracked":"unified"}function T7(e){return e.split("/").filter(Boolean).pop()??e}function A7({repos:e,loading:t,truncated:i,activeSubPath:s,depth:o,onSelect:f,onDepthChange:p,onRescan:c,onClose:h}){const{groups:d,topLevelCount:v}=g7(e),g=M.useCallback(x=>{x.stopPropagation();const C=parseInt(x.target.value,10);isNaN(C)||p(C)},[p]);return u.jsxs("div",{className:"diff-repo-menu",role:"listbox","aria-label":"Repositories",onClick:x=>x.stopPropagation(),children:[u.jsxs("div",{className:"diff-repo-menu-eyebrow",children:[u.jsx("span",{children:"REPOSITORIES"}),!t&&u.jsxs("span",{children:[v," 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:x,worktrees:C})=>{const T=x.relPath===s,w=x.isWorktree===!0&&x.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(x.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:x.name}),u.jsxs("span",{className:"diff-repo-branch",children:[u.jsx(Gg,{}),u.jsx("span",{children:x.branch})]}),x.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:x.relPath===""?"· Theater root":x.relPath})]})]}),C.length>0&&u.jsx("div",{className:"diff-repo-children",role:"group",children:C.map(m=>{const b=m.relPath===s,_=m7(m.relPath,x.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(Gg,{}),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:_})]})]})},m.relPath)})})]},x.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:x=>x.stopPropagation(),onMouseDown:x=>x.stopPropagation(),children:b7.map(x=>u.jsx("option",{value:x.value,children:x.label},x.value))})]}),u.jsx("button",{type:"button",className:"diff-repo-rescan",onClick:x=>{x.stopPropagation(),c()},children:"⟳ Rescan"})]})]})}function R7(){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 Gg(){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 L7(){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 M7({ctx:e}){const[t,i]=M.useState(y7),[s,o]=M.useState(w7),f=Q8(e.theaterId??null),p=UC(e.theaterId??null),[c,h]=M.useState(S7),d=M.useRef(c),v=M.useRef(null),[g,x]=M.useState(!1),[C,T]=M.useState(()=>e.theaterId?uS(e.theaterId):""),[w,m]=M.useState(x7),[b,_]=M.useState([]),[S,k]=M.useState(!1),[L,R]=M.useState(!1),[N,A]=M.useState(!1),B=M.useRef(0),V=M.useRef(w);V.current=w;const U=M.useCallback(q=>{if(!e.theaterId)return;const H=++B.current;k(!0),fetch("/plugins/diff/repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:q})}).then(async se=>{if(H!==B.current)return;if(!se.ok){k(!1);return}const de=await se.json();if(H!==B.current)return;const xe=de.repos;_(xe),A(de.truncated??!1),k(!1)}).catch(()=>{H===B.current&&k(!1)})},[e.theaterId]);M.useEffect(()=>{if(!e.theaterId)return;const q=uS(e.theaterId);T(q),_([]),A(!1),R(!1),jp(),Ip(),U(V.current)},[e.theaterId,U]);const W=M.useCallback(q=>{q.stopPropagation(),R(H=>!H)},[]),I=M.useCallback(()=>R(!1),[]),X=M.useCallback(q=>{q!==C&&(T(q),e.theaterId&&C7(e.theaterId,q),jp(),Ip())},[C,e.theaterId]),Y=M.useCallback(q=>{m(q);try{localStorage.setItem(GC,String(q))}catch{}U(q)},[U]),P=M.useCallback(()=>{U(w)},[U,w]);M.useEffect(()=>{if(!L)return;const q=()=>R(!1);return document.addEventListener("click",q),()=>document.removeEventListener("click",q)},[L]),M.useEffect(()=>{if(!L)return;const q=H=>{H.key==="Escape"&&R(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[L]);const G=M.useCallback(q=>{e.theaterId&&e7(q,C,e.theaterId)},[e.theaterId,C]),K=M.useCallback(()=>{jp(),Ip()},[]),j=M.useCallback(q=>{i(q);try{localStorage.setItem(FC,q)}catch{}},[]),z=M.useCallback(q=>{o(q);try{localStorage.setItem(KC,q)}catch{}},[]),D=M.useCallback(q=>{q.preventDefault();const H=v.current;if(!H)return;const se=H.getBoundingClientRect().width,de=q.clientX,xe=d.current;if(se-Eh-Ql<kh)return;x(!0);const Me=Fe=>{const ht=Fe.clientX-de,Ae=f7({startWidth:xe,dx:ht,containerWidth:se,listPaneMinWidth:kh,hunkPaneMinWidth:Eh,dividerWidth:Ql});Ae!==null&&(d.current=Ae,h(Ae))},Oe=()=>{document.removeEventListener("pointermove",Me),document.removeEventListener("pointerup",Oe),x(!1);try{localStorage.setItem(WC,String(d.current))}catch{}};document.addEventListener("pointermove",Me),document.addEventListener("pointerup",Oe)},[]);M.useLayoutEffect(()=>{e.requestExtraWidth?.(f||p?_7:null)},[e,f,p]);const F=b.find(q=>q.relPath===C)??null,J=F?.name??(C===""?"Working tree":T7(C)||"Working tree"),ne=F?.branch??null,Z=f?k7(f):"unified",re=!!(f||p);return u.jsxs("div",{ref:v,className:`diff-root${re?" has-hunk":""}${g?" is-dragging":""}`,style:re?{gridTemplateColumns:p7(c)}:void 0,children:[re&&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:K,children:"✕"})]}),u.jsx("div",{className:"diff-hunk-body",children:p?u.jsx(cS,{ctx:e,file:{path:"",status:"M",additions:0,deletions:0},mode:"unified",subPath:p.subPath,commit:p}):f?u.jsx(cS,{ctx:e,file:f.entry,mode:Z,subPath:f.subPath}):null})]}),re&&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:W,children:[u.jsx(R7,{}),u.jsx("span",{className:"nm",children:J}),ne&&u.jsxs("span",{className:"brc",children:[u.jsx(Gg,{}),u.jsx("span",{className:"bnm",children:ne})]}),u.jsx(L7,{})]}),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:()=>z("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:()=>z("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(Z8,{ctx:e,viewMode:t,selectedPath:f?.entry.path??null,subPath:C,onSelect:G}),u.jsx(l7,{ctx:e,subPath:C,graphMode:s}),L&&u.jsx(A7,{theaterId:e.theaterId??"",repos:b,loading:S,truncated:N,activeSubPath:C,depth:w,onSelect:X,onDepthChange:Y,onRescan:P,onClose:I})]})]})}function N7(){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 O7={id:"diff",title:"Diff",icon:()=>u.jsx(N7,{}),render:e=>u.jsx(M7,{ctx:e})},D7={id:"diff",railPanels:[O7]},j7=[D7],Pu=["claude-code","codex","cursor","opencode"],I7={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},B7="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function P7({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),[v,g]=M.useState(new Set(Pu)),{status:x,start:C}=f,T=x==="running",w=x==="done",m=x==="error",b=M.useCallback(()=>{d(!0),g(new Set(Pu))},[]),_=M.useCallback(k=>{d(!1),g(L=>{const R=new Set(L);return R.has(k)?R.delete(k):R.add(k),R})},[]),S=M.useCallback(()=>{const k=h?Pu:Array.from(v);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,v,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"}),Pu.map(k=>u.jsx("button",{type:"button",className:`skills-agent-chip${!h&&v.has(k)?" is-active":""}`,onClick:()=>_(k),disabled:T||w,children:I7[k]},k))]}),u.jsx("p",{className:"skills-permission-warning",children:B7}),!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:S,disabled:!h&&v.size===0,children:"Install now"})]})]})}const z7=4e3;function YC({status:e,lines:t,runningLabel:i,doneLabel:s,errorLabel:o,onDismiss:f,onRetry:p}){const[c,h]=M.useState(!1),d=M.useRef(null),v=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 v.current=setTimeout(()=>{h(!1),f()},z7),()=>{v.current&&(clearTimeout(v.current),v.current=null)}},[e,f]);const g=M.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),h(!1),f()},[f]),x=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:x,onKeyDown:m=>{m.target===m.currentTarget&&(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),x())},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 H7={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,updateJobId:null,updateJobScope:null,installFormOpenId:null},qg=new Set;let Zn=H7;function oa(){for(const e of qg)e()}function $7(e){return qg.add(e),()=>{qg.delete(e)}}function hS(){return Zn}function n_(){return M.useSyncExternalStore($7,hS,hS)}function zu(e){Zn={...Zn,activeTab:e},oa()}function dS(e){Zn={...Zn,scope:e},oa()}function U7(e){Zn={...Zn,filterText:e},oa()}function F7(e){Zn={...Zn,searchQuery:e},oa()}function Qa(e,t){Zn={...Zn,searchResults:e,searchLoading:t},oa()}function zp(e,t){Zn={...Zn,installedList:e,installedLoading:t},oa()}function Kg(e){Zn={...Zn,installFormOpenId:e},oa()}const fS=750;function XC(){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 v=0;const g=async()=>{const x=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(d)}&cursor=${v}`).catch(()=>null);if(!x?.ok){t(T=>({...T,status:"error"}));return}const C=await x.json();v=C.nextCursor,t(T=>({...T,lines:[...T.lines,...C.lines]})),C.status==="running"?i.current=setTimeout(()=>{g()},fS):t(T=>({...T,status:C.status}))};i.current=setTimeout(()=>{g()},fS)})()},[s]);return{...e,start:f,reset:o}}const W7=300,Ju=2;function G7(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function q7(e){if(e.length<Ju){Qa([],!1);return}Qa([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Qa([],!1);return}const i=await t.json();Qa(i.skills??[],!1)}catch{Qa([],!1)}}function K7({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:G7(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(P7,{source:e.source,skill:e.name,theaterId:t,onCancel:s,onStarted:h=>f(e.name,h),jobLog:p})]})}function V7({theaterId:e,onReadMore:t,onInstallSuccess:i}){const{searchQuery:s,searchResults:o,searchLoading:f,installFormOpenId:p}=n_(),c=M.useRef(null),h=XC(),[d,v]=M.useState(null),g=M.useCallback(C=>{if(F7(C),c.current&&clearTimeout(c.current),C.length<Ju){Qa([],!1);return}c.current=setTimeout(()=>{q7(C)},W7)},[]);M.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]),M.useEffect(()=>{h.status!=="done"||!d||(i(d.name,d.scope),Kg(null),v(null))},[h.status,d,i]);const x=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>=Ju&&o.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',s,'".']}),!f&&s.length>0&&s.length<Ju&&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(K7,{result:C,theaterId:e,isFormOpen:p===C.id,onInstallClick:()=>Kg(p===C.id?null:C.id),onReadMore:t,onInstallStarted:(T,w)=>v({name:T,scope:w}),jobLog:h},C.id))})]}),u.jsx(YC,{status:h.status,lines:h.lines,runningLabel:x,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:h.reset})]})}const Y7=2600;function X7({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),Y7))},[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 Z7(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/plugins/skills/list${t}`);return i.ok?(await i.json()).skills??[]:[]}function J7({theaterId:e,onReadMore:t,refreshKey:i}){const{scope:s,filterText:o,installedList:f,installedLoading:p}=n_(),c=XC(),h=M.useRef(null),d=M.useCallback(m=>{zp([],!0),Z7(m).then(b=>zp(b,!1)).catch(()=>zp([],!1))},[]);M.useEffect(()=>{d(e)},[e,d,i]),M.useEffect(()=>{(c.status==="done"||c.status==="error")&&d(e)},[c.status,e,d]);const v=M.useCallback(m=>{const b=m;h.current=b;const _={scope:b};e&&(_.theaterId=e),c.start("/plugins/skills/update",_)},[e,c]),g=M.useCallback((m,b)=>{const _={scope:b,skill:m};e&&(_.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}).then(()=>d(e)).catch(()=>null)},[e,d]),x=M.useCallback(()=>{h.current&&v(h.current)},[v]),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:()=>dS("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:()=>dS("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:o,onChange:m=>U7(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(X7,{skill:m,onReadMore:t,onUpdate:v,onRemove:g,isUpdating:w},`${m.scope}:${m.name}`))})]}),u.jsx(YC,{status:c.status,lines:c.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:c.reset,onRetry:x})]})}function Hp(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 Q7({content:e}){const t=M.useMemo(()=>{const o=bh(e).html,f=new DOMParser().parseFromString(o,"text/html");return Hp(f.body),f.body.innerHTML},[e]),i=M.useRef(null);M.useEffect(()=>{const o=i.current;if(!o)return;Hp(o);const f=new MutationObserver(()=>Hp(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 ej=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),tj="Skills run with full agent permissions. Review before use.";function nj(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(ej)),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 ij({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),v=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"&&nj(T,g.current),T.stopImmediatePropagation()};return v.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 x=e.displayPath||e.source||null;return Es.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}),x&&u.jsx("span",{className:"skills-overlay-meta",children:x}),u.jsx("button",{ref:v,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(Q7,{content:f})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:tj}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{s(),o()},children:"Install"})]})]})}),document.body)}const rj=3200;function sj({message:e,onDismiss:t}){return M.useEffect(()=>{if(!e)return;const i=setTimeout(t,rj);return()=>clearTimeout(i)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function aj({ctx:e}){const{theaterId:t}=e,{activeTab:i,installedList:s}=n_(),[o,f]=M.useState(null),[p,c]=M.useState(null),[h,d]=M.useState(0),v=s.length,g=M.useCallback(w=>{f({skill:w,isInstalled:!0})},[]),x=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),zu("installed")},[]),T=M.useCallback(()=>{o?.registryId&&(Kg(o.registryId),zu("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:()=>zu("installed"),children:["Installed",v>0?` ${v}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":i==="find",className:`skills-tab-btn${i==="find"?" is-active":""}`,onClick:()=>zu("find"),children:"Find"})]}),i==="installed"?u.jsx(J7,{theaterId:t,onReadMore:g,refreshKey:h}):u.jsx(V7,{theaterId:t,onReadMore:x,onInstallSuccess:C}),u.jsx(sj,{message:p,onDismiss:()=>c(null)}),u.jsx(ij,{skill:o?.skill??null,isInstalled:o?.isInstalled??!1,theaterId:t,onClose:()=>f(null),onInstall:T})]})}function oj(){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 lj={id:"skills",title:"Skills",icon:oj,render:e=>u.jsx(aj,{ctx:e})},cj={id:"skills",railPanels:[lj]},uj=[cj],ZC=[...AN,...F8,...j7,...uj],hj=QC(ZC),JC=M.createContext(hj),dj=JC.Provider;async function fj(){const e=[...ZC],t=new Set(e.map(s=>s.id)),i=await pj();for(const s of i){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}const o=await gj(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 QC(e)}function oc(){return M.useContext(JC)}async function pj(){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(_j):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function gj(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return mj(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 QC(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 mj(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function _j(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 vj=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function e2(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await r_(t),t2(await t.json(),t.status)}async function bj(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await r_(t),xj(await t.json(),t.status)}async function $p(e,t,i){return i_(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function yj(e,t,i,s){return i_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,s)}async function Sj(e,t,i){return i_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function i_(e,t,i,s){const o=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:s});await r_(o);const f=await o.json();if(!f||typeof f!="object"||!("state"in f))throw new lt(o.status,"Invalid carrier settings mutation response");return{state:t2(f.state,o.status)}}async function r_(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 lt(e.status,t)}function t2(e,t){n2(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new lt(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(s=>wj(s,t))}}function xj(e,t){n2(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new lt(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(s=>Cj(s,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function wj(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 lt(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=>kj(s,t))}}}function Cj(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 lt(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(s=>Ej(s,t)),defaultModel:i.defaultModel}}function Ej(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new lt(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new lt(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 kj(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 lt(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function n2(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(vj.has(o))throw new lt(t,"Carrier settings response leaked a restricted field");f&&typeof f=="object"&&i.push(f)}}}const Tj={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Vg=new Set;let Bn={loading:!1,state:null,options:null,activeCarrierId:null,draft:Tj,savingActionId:null,error:null};function i2(){return M.useSyncExternalStore(Aj,pS,pS)}function pS(){return Bn}function Aj(e){return Vg.add(e),()=>{Vg.delete(e)}}async function gS(e){lr({loading:!0,error:null});try{const[t,i]=await Promise.all([e2(e),bj(e)]);r2(t,i)}catch(t){if(e?.aborted)return;lr({loading:!1,error:a2(t)})}}function Rj(e){const t=Bn.state?.carriers.find(i=>i.carrierId===e);lr({activeCarrierId:e,draft:t?s_(t,Bn.options):Bn.draft,error:null})}function ro(e){lr({draft:{...Bn.draft,...e},error:null})}function Yg(e,t){const i=Bn.draft.taskforce[e]??{model:"",effort:""};lr({draft:{...Bn.draft,taskforce:{...Bn.draft.taskforce,[e]:{...i,...t}}},error:null})}function Lj(){const e=s2();e&&lr({draft:s_(e,Bn.options),error:null})}async function Mj(e){const t=s2();return t?Nj("save-all",async()=>{const i=Bn.draft;let s=null;i.displayName!==t.displayName&&(s=(await $p(t.carrierId,{displayName:i.displayName})).state);const o=i.cliType!==t.cliType;return o&&(s=(await $p(t.carrierId,{cli:i.cliType})).state),(o||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(s=(await $p(t.carrierId,{model:Dj(i)})).state),s=await jj(t,e,s),{state:s??await e2()}}):!1}function r2(e,t){const i=Ij(e,Bn.activeCarrierId),s=e.carriers.find(o=>o.carrierId===i)??null;lr({loading:!1,state:e,options:t,activeCarrierId:i,draft:s?s_(s,t):Bn.draft,error:null})}async function Nj(e,t){lr({savingActionId:e,error:null});try{const i=await t();return r2(i.state,Bn.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),lr({savingActionId:null}),!0}catch(i){return lr({savingActionId:null,error:a2(i)}),!1}}function s_(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??Oj(s.id,o?.model??s.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function Oj(e,t,i){return i?.cliTypes.find(f=>f.id===e)?.models.find(f=>f.modelId===t)?.effort?.default??null}function Dj(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function s2(){return Bn.state?.carriers.find(e=>e.carrierId===Bn.activeCarrierId)??null}async function jj(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 Sj(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 yj(e.carrierId,o.cliType,{model:o.model,...o.effort?{effort:o.effort}:{}})).state)}return i}function Ij(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function lr(e){Bn={...Bn,...e};for(const t of Vg)t()}function a2(e){return e instanceof Error?e.message:String(e)}const Bj=50,Pj=2400,zj={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 Hj(){const e=i2(),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"),v=e.savingActionId==="save-all",g=t?qj(t,e.draft,p):!1,x=t?.taskforce.backends.map(w=>`${w.cliType}:${w.model}:${w.effort??""}`).join("|")??"";M.useEffect(()=>{const w=new AbortController;return gS(w.signal),()=>w.abort()},[]),M.useEffect(()=>{f(!1),c(t?.taskforce.backends.map(w=>w.cliType)??[]),d("idle")},[t?.carrierId,x]),M.useEffect(()=>{if(h!=="saved")return;const w=window.setTimeout(()=>d("idle"),Pj);return()=>window.clearTimeout(w)},[h]);function C(){t&&(Lj(),c(t.taskforce.backends.map(w=>w.cliType)),f(!1),d("idle"))}async function T(){if(!t)return;if(d("saving"),!await Mj(Vj(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"||v?"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||v,onClick:()=>{T()},children:"Save"}),u.jsx("button",{type:"button",className:`carrier-settings-action-button ${g?"is-dirty":""}`,disabled:!g||v,onClick:C,children:"Discard"})]}):null,u.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{gS()},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($j,{carrier:w,active:w.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>Rj(w.carrierId)},w.carrierId))]}),t&&e.options&&i?u.jsxs("div",{className:"carrier-settings-detail",style:c2(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:Bj,onChange:w=>ro({displayName:w.target.value})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:v,onClick:()=>{f(!1)},children:u.jsx(Xj,{})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{ro({displayName:t.displayName}),f(!1)},children:u.jsx(Zj,{})})]}):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:()=>{ro({displayName:t.displayName}),f(!0)},children:u.jsx(Yj,{})})]})}),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=>Fj(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(o2,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:w=>Wj(i,w)}),u.jsx(l2,{id:"carrier-effort",model:s,value:e.draft.effort,onChange:w=>ro({effort:w})})]})]})]}),u.jsx(Uj,{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 $j({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:c2(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 o2({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 l2({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 Uj({carrier:e,cliOptions:t,minBackends:i,savingActionId:s,rows:o,onRowsChange:f}){const p=i2(),c=e.taskforce.backends.length,[h,d]=M.useState(c>0),[v,g]=M.useState(!1),[x,C]=M.useState(""),T=e.taskForceBackendCount>=i,w=t.filter(b=>!o.includes(b.id)),m=x||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 _=t.find(R=>R.id===b);if(!_)return null;const S=p.draft.taskforce[_.id]??{model:_.defaultModel,effort:""},k=_.models.find(R=>R.modelId===S.model)??_.models[0]??null,L=e.taskforce.backends.some(R=>R.cliType===_.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:_.displayName})]}),u.jsx(o2,{id:`tf-${_.id}-model`,label:"Model",models:_.models,value:S.model,onChange:R=>Gj(_,R)}),u.jsx(l2,{id:`tf-${_.id}-effort`,model:k,value:S.effort,onChange:R=>Yg(_.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!==_.id)),children:"Remove"})})]},_.id)}),u.jsxs("div",{className:"carrier-settings-tf-add-row",children:[v&&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(!v){g(!0);return}const b=m,_=t.find(k=>k.id===b),S=_?.models.find(k=>k.modelId===_.defaultModel)??_?.models[0]??null;!_||!S||(Yg(_.id,{model:S.modelId,effort:S.effort?.default??""}),f(o.includes(_.id)?o:[...o,_.id]),C(""),g(!1))},children:"Add"})]})]}):null]})}function Fj(e,t){const i=t.find(o=>o.id===e),s=i?.models.find(o=>o.modelId===i.defaultModel)??i?.models[0]??null;ro({cliType:e,model:s?.modelId??"",effort:s?.effort?.default??""})}function Wj(e,t){const i=e.models.find(s=>s.modelId===t);ro({model:t,effort:i?.effort?.default??""})}function Gj(e,t){const i=e.models.find(s=>s.modelId===t);Yg(e.id,{model:t,effort:i?.effort?.default??""})}function qj(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:Kj(e,i,t.taskforce)}function Kj(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 Vj(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 c2(e){return{"--cap-color":zj[e]??"var(--brass)"}}function Yj(){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 Xj(){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 Zj(){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 Jj(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await Qj(t),eI(await t.json(),t.status).routes}async function Qj(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 lt(e.status,t)}function eI(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new lt(t,"Invalid backend API catalog response");return{routes:i.routes.map(s=>tI(s,t))}}function tI(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 lt(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const Xg=new Set;let Zg={loading:!1,state:null,error:null};function nI(){return M.useSyncExternalStore(iI,mS,mS)}function mS(){return Zg}function iI(e){return Xg.add(e),()=>{Xg.delete(e)}}async function rI(e){Up({loading:!0,error:null});try{const t=await Jj(e);Up({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Up({loading:!1,error:sI(t)})}}function Up(e){Zg={...Zg,...e};for(const t of Xg)t()}function sI(e){return e instanceof Error?e.message:String(e)}function aI(){const e=nI(),[t,i]=M.useState(!0),s=M.useMemo(()=>cI(e.state??[]),[e.state]),o=e.state?.length??0,f=s.length;return M.useEffect(()=>{const p=new AbortController;return rI(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(oI,{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 oI({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(lI,{entry:t},`${t.method}:${t.path}`))})]})}function lI({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 cI(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 u2(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await h2(t),d2(await t.json(),t.status)}async function uI(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await h2(i);const s=await i.json();if(!s||typeof s!="object"||!("state"in s))throw new lt(i.status,"Invalid global settings mutation response");return{state:d2(s.state,i.status)}}async function h2(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 lt(e.status,t)}function d2(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!hI(i.consoleStaticPort)||i.theme!=="maritime"&&i.theme!=="carbon")throw new lt(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme}}function hI(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}const Jg=new Set;let Qg={loading:!1,state:null,savingField:null,error:null};function dI(){return M.useSyncExternalStore(fI,_S,_S)}function _S(){return Qg}function fI(e){return Jg.add(e),()=>{Jg.delete(e)}}async function pI(e){fo({loading:!0,error:null});try{const t=await u2(e);fo({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;fo({loading:!1,error:f2(t)})}}async function em(e,t){fo({savingField:e,error:null});try{const i=await uI({[e]:t});return fo({state:i.state,savingField:null,error:null}),!0}catch(i){return fo({savingField:null,error:f2(i)}),!1}}function fo(e){Qg={...Qg,...e};for(const t of Jg)t()}function f2(e){return e instanceof Error?e.message:String(e)}const gI=[{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)"]}],mI=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],_I=1024,vI=65535,bI=[{id:"general",label:"General",eyebrow:"Theme · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function yI(){const e=dI(),t=e.state,i=e.savingField!==null,[s,o]=M.useState("general"),f=oc(),p=xI(f.plugins),c=wI(p);return M.useEffect(()=>{const h=new AbortController;return pI(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"}),bI.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:SI(s,t,i,p)},s)]})]})}function SI(e,t,i,s){if(e.includes(":")){const o=s.find(f=>f.id===e);return o?.render?u.jsx(dm,{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(EI,{}),u.jsx(kI,{state:t,saving:i})]});case"backend-api":return u.jsx(aI,{})}}function xI(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:CI(t.id),sectionTitle:i.title,render:i.render})))}function wI(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 CI(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function EI(){const{activeTheme:e}=$r();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:gI.map(t=>{const i=t.id===e;return u.jsxs("button",{type:"button","aria-pressed":i,className:`theme-card ${i?"is-active":""}`,onClick:()=>{Ux(t.id),em("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(AI,{}):null})]},t.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function kI({state:e,saving:t}){const i=$r();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsx(u.Fragment,{children:u.jsx(TI,{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 TI({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(),v=Number(d),g=d.length>0,x=g&&vS(v),C=e.consolePortMode==="static"&&g&&!x;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:mI.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:()=>{em("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());vS(m)&&em("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 vS(e){return Number.isInteger(e)&&e>=_I&&e<=vI}function AI(){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 RI(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function ec(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function LI(e,t){return{...RI(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const MI=[{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"}]}],NI=288,OI=520,Ml=12,_s=[{id:"operations",label:"Operations"},{id:"map",label:"Map"},{id:"help",label:"Help"}],DI=/mac|iphone|ipad|ipod/i;function Qu({anchor:e,viewportBounds:t,placement:i="cursor",mode:s="full",catalog:o,canLaunch:f,mapFullscreen:p,radarEnabled:c,perimeterEnabled:h,renderKindIcon:d,onLaunchKind:v,onResetView:g,onMaximizeMap:x,onToggleRadar:C,onTogglePerimeter:T,onClose:w}){const m=M.useRef(null),b=M.useRef(null),_=M.useRef({operations:null,map:null,help:null}),[S,k]=M.useState(s==="controls"?"map":"operations"),L=BI(),R=s==="full",N=s==="full"||s==="launch",A=s==="full"||s==="controls";M.useEffect(()=>{const U=I=>{m.current?.contains(I.target)||w()},W=I=>{I.key==="Escape"&&w()};return document.addEventListener("mousedown",U),document.addEventListener("keydown",W),()=>{document.removeEventListener("mousedown",U),document.removeEventListener("keydown",W)}},[w]),M.useEffect(()=>{b.current?.focus()},[]);const B=(U,W=!1)=>{k(U),W&&window.requestAnimationFrame(()=>_.current[U]?.focus())},V=U=>{const W=_s.findIndex(X=>X.id===S),I=_s.length-1;if(U.key==="ArrowRight"||U.key==="ArrowLeft"){U.preventDefault();const X=U.key==="ArrowRight"?1:-1,Y=_s[(W+X+_s.length)%_s.length];B(Y.id,!0)}else U.key==="Home"?(U.preventDefault(),B(_s[0].id,!0)):U.key==="End"&&(U.preventDefault(),B(_s[I].id,!0))};return u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:m,style:II(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:b,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(jI,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Operations Control"})})]}),R?u.jsx("div",{className:"canvas-context-menu-tabs",role:"tablist","aria-label":"Operations Control sections",children:_s.map(U=>u.jsx("button",{ref:W=>{_.current[U.id]=W},type:"button",id:`canvas-control-tab-${U.id}`,className:"canvas-context-menu-tab",role:"tab","aria-selected":S===U.id,"aria-controls":`canvas-control-panel-${U.id}`,tabIndex:S===U.id?0:-1,onClick:()=>B(U.id),onKeyDown:V,children:U.label},U.id))}):null,N?u.jsxs("div",{id:"canvas-control-panel-operations",role:"tabpanel","aria-labelledby":"canvas-control-tab-operations",className:"canvas-context-menu-panel",hidden:R?S!=="operations":void 0,children:[u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),o.length>0?o.map((U,W)=>u.jsxs("div",{children:[W>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:U.title}),U.kinds.map(I=>{const X=I.disabled===!0||!f;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:X,title:I.disabledReason,onClick:()=>v(U.id,I),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:d(U.id,I)??u.jsx(UI,{})}),u.jsx("span",{className:"theater-menu-label",children:I.title}),I.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:I.disabledReason}):null]},`${U.id}:${I.id}`)})]},U.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]}):null,A?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:R?S!=="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:g,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(PI,{})}),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"}),x?u.jsx(Fp,{checked:!!p,label:"Maximized map",onClick:x,children:u.jsx(zI,{})}):null,C?u.jsx(Fp,{checked:!!c,label:"Radar sweep",onClick:C,children:u.jsx(HI,{})}):null,T?u.jsx(Fp,{checked:!!h,label:"Panel pulse",onClick:T,children:u.jsx($I,{})}):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:R?S!=="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(bS,{modLabel:L})]}):u.jsx(bS,{modLabel:L})})]}):null]})})}function jI(){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 II(e,t,i){const s=t?Math.max(Ml,Math.min(e.x,t.width-NI-Ml)):e.x;if(i==="above")return{left:s,bottom:Math.max(Ml,e.y)};const o=t?Math.max(Ml,Math.min(e.y,t.height-OI-Ml)):e.y;return{left:s,top:o}}function bS({modLabel:e}){return u.jsx(u.Fragment,{children:MI.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 Fp({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 BI(){const t=navigator.userAgentData?.platform??navigator.platform;return DI.test(t)?"⌘":"Ctrl"}function PI(){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 zI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M9.5 3.5h3v3M12.5 3.5 9 7M6.5 12.5h-3v-3M3.5 12.5 7 9",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function HI(){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 $I(){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 UI(){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 yS=256,SS=176,Wp=12,Hu=220,p2="fleet-console.map.radarCollapsed";function FI({operations:e,pluginOperations:t,viewport:i,canvasSize:s,onJump:o}){const f=M.useRef(null),p=M.useRef(!1),[c,h]=M.useState(WI);if(s.width<=0||s.height<=0||i.zoom<=0)return null;const d=[...Object.entries(e).map(([I,X])=>({id:I,kind:"op",x:X.x,y:X.y,width:X.width,height:X.height})),...Object.entries(t).map(([I,X])=>({id:I,kind:"plugin",x:X.geometry.x,y:X.geometry.y,width:X.geometry.width,height:X.geometry.height}))];if(d.length===0)return null;const v=()=>{h(I=>{const X=!I;return GI(X),X})};if(c)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:v,"aria-label":"Radar 펼치기",title:"Show radar",children:u.jsx(KI,{})});const g=yS-Wp*2,x=SS-Wp*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(I=>I.x)),w=Math.min(C.y,...d.map(I=>I.y)),m=Math.max(C.x+C.width,...d.map(I=>I.x+I.width)),b=Math.max(C.y+C.height,...d.map(I=>I.y+I.height));T-=Hu,w-=Hu,m+=Hu,b+=Hu;const _=m-T,S=b-w,k=Math.min(g/_,x/S),L=(g-_*k)/2,R=(x-S*k)/2,N=I=>L+(I-T)*k,A=I=>R+(I-w)*k,B=I=>{const X=f.current?.getBoundingClientRect();if(!X)return;const Y=I.clientX-X.left,P=I.clientY-X.top;o({x:T+(Y-L)/k,y:w+(P-R)/k})},V=I=>{I.stopPropagation(),p.current=!0,I.currentTarget.setPointerCapture(I.pointerId),B(I)},U=I=>{p.current&&(I.stopPropagation(),B(I))},W=I=>{p.current=!1;try{I.currentTarget.releasePointerCapture(I.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:yS,height:SS},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Radar"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:v,"aria-label":"Radar 접기",title:"Collapse radar",children:u.jsx(qI,{})}),u.jsxs("div",{ref:f,className:"canvas-minimap-inner",style:{inset:Wp},onPointerDown:V,onPointerMove:U,onPointerUp:W,onPointerCancel:W,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[d.map(I=>u.jsx("div",{className:`canvas-minimap-operation ${I.kind==="plugin"?"is-plugin":""}`,style:{left:N(I.x),top:A(I.y),width:Math.max(2,I.width*k),height:Math.max(2,I.height*k)}},I.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 WI(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(p2)==="true"}catch{return!1}}function GI(e){if(!(typeof window>"u"))try{window.localStorage.setItem(p2,String(e))}catch{}}function qI(){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 KI(){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 VI="is-animation-paused";function YI({viewport:e,backgroundAnimationEnabled:t}){const[i,s]=M.useState(()=>document.hidden);return M.useEffect(()=>{function o(){s(document.hidden)}return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o)}},[]),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`}}),t?u.jsxs("div",{className:`operations-radar${i?` ${VI}`:""}`,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"})]}):null]})}const Wh=[{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 tc(e){return Wh.find(t=>t.key===e)?.color??null}function xS(e){return typeof e.accent=="string"?e.accent:null}const wS=8,XI=120;function ZI({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+wS,d=h+XI>window.innerHeight;f(d?{position:"fixed",left:c,top:"auto",bottom:Math.round(window.innerHeight-e.top+wS)}:{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 Es.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"]}),Wh.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 g2(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,v]=M.useState("");M.useEffect(()=>{c&&(o.current?.focus(),o.current?.select())},[c]);const g=()=>{s?.(),p.current=!1,v(t),h(!0)},x=()=>{p.current=!0,h(!1),v("")},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:x,commit:C,setDraftTitle:v,handleKeyDown:m=>{if(m.key==="Enter"){m.preventDefault(),C();return}m.key==="Escape"&&(m.preventDefault(),x())},handleBlur:()=>{if(p.current){p.current=!1;return}C()}}}const JI=["n","ne","e","se","s","sw","w","nw"],Gp=320,qp=200;function QI({operation:e,active:t,geometry:i,zoom:s,subtitle:o,status:f,minimized:p=!1,maximized:c=!1,accentKey:h=null,children:d,onActivate:v,onClose:g,onMinimize:x,onMaximize:C,onRename:T,onSetAccent:w,onGeometryChange:m,onGeometryCommit:b}){const _=M.useRef(null),S=M.useRef(null),k=M.useRef(null),[L,R]=M.useState(null),N=e.title,A=g2({currentTitle:N,onCommit:T,onBegin:v}),B=h?tc(h):null,V=["canvas-operation",t?"is-active":"",p?"is-minimized":"",c?"is-maximized":"",tB(f)].filter(Boolean).join(" "),U=ne=>{c||ne.button===0&&(ne.preventDefault(),ne.stopPropagation(),v(),S.current={pointerId:ne.pointerId,startX:ne.clientX,startY:ne.clientY,geometry:i,latest:i},ne.currentTarget.setPointerCapture(ne.pointerId))},W=ne=>{if(c)return;const Z=S.current;if(!Z||Z.pointerId!==ne.pointerId)return;ne.preventDefault(),ne.stopPropagation();const re={...Z.geometry,x:Z.geometry.x+(ne.clientX-Z.startX)/s,y:Z.geometry.y+(ne.clientY-Z.startY)/s};Z.latest=re,m(re)},I=ne=>{if(c){S.current=null;return}const Z=S.current;!Z||Z.pointerId!==ne.pointerId||(ne.preventDefault(),ne.stopPropagation(),S.current=null,ne.currentTarget.releasePointerCapture(ne.pointerId),b(Z.latest))},X=(ne,Z)=>{c||(Z.preventDefault(),Z.stopPropagation(),v(),k.current={direction:ne,pointerId:Z.pointerId,startX:Z.clientX,startY:Z.clientY,geometry:i,latest:i},Z.currentTarget.setPointerCapture(Z.pointerId))},Y=ne=>{if(c)return;const Z=k.current;if(!Z||Z.pointerId!==ne.pointerId)return;ne.preventDefault(),ne.stopPropagation();const re=eB(Z.geometry,Z.direction,(ne.clientX-Z.startX)/s,(ne.clientY-Z.startY)/s);Z.latest=re,m(re)},P=ne=>{if(c){k.current=null;return}const Z=k.current;!Z||Z.pointerId!==ne.pointerId||(ne.preventDefault(),ne.stopPropagation(),k.current=null,ne.currentTarget.releasePointerCapture(ne.pointerId),b(Z.latest))},G=ne=>{ne.stopPropagation()},K=ne=>{ne.stopPropagation(),v()},j=ne=>{ne.stopPropagation(),v()},z=ne=>{ne.stopPropagation()},D=()=>{const ne=typeof document<"u"?document.activeElement:null;ne instanceof HTMLElement&&_.current?.contains(ne)&&ne.blur(),x()},F=ne=>{v(),R(ne)},J={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...B?{"--op-accent":B}:{}};return u.jsxs("article",{ref:_,className:V,style:J,onPointerDown:v,"data-canvas-operation":!0,"aria-label":`Operation ${N}`,inert:p?!0:void 0,children:[u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:U,onPointerMove:W,onPointerUp:I,onPointerCancel:I,"data-canvas-blocker":!0,children:[w?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:G,onClick:ne=>F(ne.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${N}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:CS(f),"aria-hidden":"true"})}):u.jsx("span",{className:CS(f),"aria-hidden":"true"}),A.renaming?u.jsx("input",{ref:A.inputRef,className:"canvas-operation-rename-input",value:A.draftTitle,"aria-label":`${N} 이름 변경`,onPointerDown:ne=>ne.stopPropagation(),onChange:ne=>A.setDraftTitle(ne.target.value),onKeyDown:A.handleKeyDown,onBlur:A.handleBlur}):u.jsx("span",{className:"canvas-operation-title",onPointerDown:K,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:G,onClick:D,"aria-label":`Minimize operation ${N}`,title:"Minimize operation",children:u.jsx(nB,{})}),C?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${c?"is-active":""}`,onPointerDown:G,onClick:C,"aria-label":c?`Restore operation ${N}`:`Maximize operation ${N}`,"aria-pressed":c,title:c?"Restore operation":"Maximize operation",children:c?u.jsx(rB,{}):u.jsx(iB,{})}):null,u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:G,onClick:g,"aria-label":`Close operation ${N}`,title:"Close operation",children:u.jsx(sB,{})})]}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:j,onWheel:z,"data-canvas-blocker":!0,children:d}),!c&&JI.map(ne=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${ne}`,onPointerDown:Z=>X(ne,Z),onPointerMove:Y,onPointerUp:P,onPointerCancel:P,"data-canvas-blocker":!0,"aria-hidden":"true"},ne)),L&&w?u.jsx(ZI,{anchor:L,accentKey:h,onSelect:w,onClose:()=>R(null)}):null]})}function eB(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<Gp&&(t.includes("w")&&(o-=Gp-p),p=Gp),c<qp&&(t.includes("n")&&(f-=qp-c),c=qp),{...e,x:o,y:f,width:p,height:c}}function tB(e){return e==="running"?"is-running is-running--turn":e==="awaiting"?"is-running is-running--awaiting":""}function CS(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 nB(){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 iB(){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 rB(){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 sB(){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 aB({rect:e,viewport:t}){const i=LI(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 oB=.25,lB=2,cB=200,uB=150,ES=5,hB=.0018;function dB({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),[v,g]=M.useState(null),[x,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),!fB(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||kS(R.target)||R.button!==0&&R.button!==1)return;if(R.preventDefault(),i){p?.();return}const N=Vp(R),A=R.shiftKey&&R.button===0&&!x?"create":"pan";h.current={pointerId:R.pointerId,mode:A,startScreen:N,currentScreen:N,startViewport:d.current},R.currentTarget.setPointerCapture(R.pointerId),A==="create"&&g(Kp(N,N,d.current))},b=R=>{const N=h.current;if(!N||N.pointerId!==R.pointerId)return;R.preventDefault();const A=Vp(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(Kp(N.startScreen,A,d.current))},_=R=>{L(R,!0)},S=R=>{L(R,!1)},k=R=>{if(t||kS(R.target))return;R.preventDefault();const N=Vp(R),A=d.current,B=pB(A.zoom*Math.exp(-R.deltaY*hB),oB,lB),V=ec(N,A);o({x:N.x-V.x*B,y:N.y-V.y*B,zoom:B})},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 B=Math.abs(A.currentScreen.x-A.startScreen.x),V=Math.abs(A.currentScreen.y-A.startScreen.y);if(B<ES&&V<ES){c?.();return}if(A.mode!=="create")return;const U=Kp(A.startScreen,A.currentScreen,d.current),W={x:U.x,y:U.y,width:Math.max(U.width,cB),height:Math.max(U.height,uB)};f(W,A.currentScreen)};return{rubberBand:v,spaceActive:x,shiftActive:T,onPointerDown:m,onPointerMove:b,onPointerUp:_,onPointerCancel:S,onWheel:k}}function Kp(e,t,i){const s=ec(e,i),o=ec(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 Vp(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function kS(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function fB(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function pB(e,t,i){return Math.min(i,Math.max(t,e))}const gB="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",mB=560,_B=360;function vB({state:e,catalog:t,canLaunch:i,mapFullscreen:s,radarEnabled:o,perimeterEnabled:f,renderKindIcon:p,onLaunchKind:c,onLaunchAtGeometry:h,onResetView:d,onMaximizeMap:v,onToggleRadar:g,onTogglePerimeter:x,onClose:C,onFocus:T,onSetAccent:w}){const m=M.useRef(null),b=vx(),_=yx(),S=Sx(),k=e.activeOperationId,[L,R]=M.useState(null),N=oc(),[A,B]=M.useState({width:0,height:0}),V=!e.activeTheaterId||e.addingTheater;M.useEffect(()=>{const Z=m.current;if(!Z||typeof ResizeObserver>"u")return;const re=()=>B({width:Z.clientWidth,height:Z.clientHeight});re();const q=new ResizeObserver(re);return q.observe(Z),()=>q.disconnect()},[]);const U=dB({viewport:b.viewport,disabled:V,onViewportChange:fg,onZoom:xx,onCreate:Z=>{if(R(null),e.activeTheaterId&&i){const re=CB(t);if(!re)return;const q={...SB(Z),zIndex:ia()};h(re.pluginId,re.kind,q)}},consumePointerDown:L!==null,onConsumePointerDown:()=>{R(null)},onClick:yB}),W=(Z,re)=>{const q=L?.canvasPoint;R(null),q&&c(Z,re,q)},I=()=>{R(null),d()},X=Z=>{if(Z.target instanceof Element&&Z.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;Z.preventDefault();const re=m.current?.getBoundingClientRect();if(!re)return;const q={x:Z.clientX-re.left,y:Z.clientY-re.top};R({anchor:q,canvasPoint:ec(q,b.viewport)})},Y=new Set(S);M.useEffect(()=>{e.activeOperationId&&Y.has(e.activeOperationId)&&or(null)},[S,e.activeOperationId]);const P=Object.fromEntries(Object.entries(b.operations).filter(([Z])=>!Y.has(Z))),G=(e.operations??[]).filter(Z=>Z.theaterId===e.activeTheaterId),K=G,j=G.length>0,z=N.operationKinds,F=_!==null&&G.some(Z=>Z.id===_&&!Y.has(Z.id))?_:null,J=F?1:b.viewport.zoom,ne=wB(b.operations)+1;return u.jsxs("main",{className:`operations-canvas ${U.spaceActive?"is-panning":""} ${U.shiftActive?"is-creating":""} ${F?"is-panel-maximized":""} ${f?"":"is-perimeter-anim-off"}`,onPointerDown:U.onPointerDown,onPointerMove:U.onPointerMove,onPointerUp:U.onPointerUp,onPointerCancel:U.onPointerCancel,onWheel:U.onWheel,onContextMenu:X,ref:m,children:[u.jsx(YI,{viewport:b.viewport,backgroundAnimationEnabled:o}),u.jsx("div",{className:"operations-canvas-world",style:{transform:F?"none":`translate(${Math.round(b.viewport.x)}px, ${Math.round(b.viewport.y)}px) scale(${b.viewport.zoom})`},children:K.map(Z=>{const re=b.operations[Z.id]??Z.geometry??Yp(Z),q=F===Z.id,H=q?xB(A,ne):re;return kB(Z,{active:k===Z.id,geometry:H,operationKindRegistry:z,status:e.operationStatus[Z.id],theme:e.activeTheme,viewportZoom:J,minimized:Y.has(Z.id),maximized:q,accentKey:b.operationAccent[Z.id]??EB(Z),onActivate:()=>{or(Z.id),q||pg(Z.id,b.operations[Z.id]??Z.geometry??Yp(Z))},onClose:()=>{e.activeOperationId===Z.id&&or(null),F===Z.id&&go(),C(Z.id)},onMinimize:()=>{e.activeOperationId===Z.id&&or(null),vA(Z.id)},onMaximize:()=>{q?go():(or(Z.id),Hl(Z.id))},onRename:se=>{RB(Z.id,se)},onSetAccent:se=>{w(Z.id,se)},onGeometryChange:se=>{q||pg(Z.id,se)},onGeometryCommit:se=>{q||AB(Z.id,po().operations[Z.id]??se)}})})}),j?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?gB:"Add a Theater from the top bar to start operations."})]}),U.rubberBand?u.jsx(aB,{rect:U.rubberBand,viewport:b.viewport}):null,L?u.jsx(Qu,{anchor:L.anchor,viewportBounds:bB(m.current),placement:"cursor",catalog:t,canLaunch:i,mapFullscreen:s,radarEnabled:o,perimeterEnabled:f,renderKindIcon:p,onLaunchKind:W,onResetView:I,onMaximizeMap:v,onToggleRadar:g,onTogglePerimeter:x,onClose:()=>R(null)},`${L.anchor.x}:${L.anchor.y}`):null,u.jsx(FI,{operations:P,pluginOperations:Object.fromEntries(G.filter(Z=>!Y.has(Z.id)).map(Z=>[Z.id,{theaterId:Z.theaterId,geometry:b.operations[Z.id]??Z.geometry??Yp(Z)}])),viewport:b.viewport,canvasSize:A,onJump:Z=>fg({x:A.width/2-Z.x*b.viewport.zoom,y:A.height/2-Z.y*b.viewport.zoom,zoom:b.viewport.zoom})})]})}function bB(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function yB(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}or(null)}function SB(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Yp(e){return e.geometry??{x:0,y:0,width:mB,height:_B,zIndex:0}}function xB(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function wB(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function CB(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 EB(e){return typeof e.accent=="string"?e.accent:null}function kB(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=Ih(()=>{Si(null).then(xi).catch(()=>{})});return u.jsx(QI,{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(dm,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(TB,{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 TB({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 AB(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}async function RB(e,t){await Dx(e,t),await Si(null).then(xi)}const tm="fleet-console.rail.activePanelId";function LB(){try{return localStorage.getItem(tm)}catch{return null}}function m2(e){try{e===null?localStorage.removeItem(tm):localStorage.setItem(tm,e)}catch{}}const nm=new Set;let zr={activeRailPanelId:LB(),panelExtraWidth:0};function a_(){for(const e of nm)e()}function _2(e){return nm.add(e),()=>{nm.delete(e)}}function v2(){return zr}function MB(e){const t=zr.activeRailPanelId===e?null:e;zr={activeRailPanelId:t,panelExtraWidth:0},m2(t),a_()}function NB(){zr.activeRailPanelId!==null&&(zr={activeRailPanelId:null,panelExtraWidth:0},m2(null),a_())}function OB(e,t){if(e!==zr.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!==zr.panelExtraWidth&&(zr={...zr,panelExtraWidth:o},a_())}function b2(){return M.useSyncExternalStore(_2,v2).activeRailPanelId}function DB(){return M.useSyncExternalStore(_2,v2).panelExtraWidth}function y2(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 S2(e,t){const i=new Set(t.map(s=>s.id));return e.filter(s=>i.has(s.operationId))}function x2(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 im(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 w2(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const jB={ended:"Stood down","input-waiting":"Awaiting orders"},IB={id:"alerts",title:"Alerts",icon:()=>u.jsx(PB,{}),render:()=>u.jsx(BB,{})};function BB(){const e=$r(),t=Nh(),[i,s]=M.useState(!1),o=M.useMemo(()=>S2(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),f=y2(e),p=x2(o,f).hidden,c=w2(p,e.notificationPreferences),h=im(c),d=im(p),v=rm(h,"input-waiting"),g=rm(h,"ended"),x=h.length===0,C=M.useCallback(T=>{Dh(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:[v>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:v}):null,g>0?u.jsx("span",{className:"notification-tally is-ended",children:g}):null,x?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(UB,{})})]}),i?u.jsx(zB,{groups:d}):null,x?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:jB[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 PB(){const e=$r(),i=b2()==="alerts",s=M.useMemo(()=>S2(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),o=y2(e),f=x2(s,o).hidden,p=w2(f,e.notificationPreferences),c=im(p),h=c.reduce((w,m)=>w+m.notifications.length,0),d=rm(c,"input-waiting"),v=M.useMemo(()=>p.reduce((w,m)=>Math.max(w,m.lastRaisedSeq),0),[p]),g=M.useRef(v),[x,C]=M.useState(0);M.useEffect(()=>{v>g.current&&!i&&C(w=>w+1),g.current=v},[v,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($B,{}),h>0?u.jsx("span",{className:"alerts-icon-badge",children:h}):null,x>0?u.jsx("span",{className:"alerts-icon-pulse","aria-hidden":"true"},x):null]})}function zB({groups:e}){const t=$r(),i=HB(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=>$3(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=>U3(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&&F3(s.theaterId)}}),u.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function HB(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 rm(e,t){let i=0;for(const s of e)for(const o of s.notifications)o.kind===t&&(i+=1);return i}function $B(){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 UB(){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 FB(e,t){const s=new URLSearchParams().toString();return wo(la(e,`/search${s?`?${s}`:""}`))}async function WB(e,t,i){return wo(la(e,`/entry/${encodeURIComponent(t)}`))}async function C2(e,t="pending"){return wo(la(e,`/drydock?status=${encodeURIComponent(t)}`))}async function GB(e,t){return wo(la(e,`/drydock/${encodeURIComponent(t)}`))}async function qB(e,t,i,s){const o={action:i};return s!==void 0&&(o.reason=s),YB(la(e,`/drydock/${encodeURIComponent(t)}/decision`),o)}async function KB(e){return wo(la(e,"/conflicts"))}async function VB(e,t){return wo(la(e,`/conflicts/${encodeURIComponent(t)}`))}function la(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function wo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await E2(e,t));return t.json()}async function YB(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 E2(e,i));return i.json()}async function E2(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const sm=new Set,Th={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function so(){return Th}function k2(e){return sm.add(e),()=>sm.delete(e)}function TS(e){eh({currentWorkspaceId:e})}async function Ah(){eh({loading:!0,error:null});try{const e=Th.currentWorkspaceId,[t,i]=await Promise.all([FB(e),C2(e,"pending").catch(()=>null)]);eh({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){eh({loading:!1,error:XB(e)})}}function eh(e){Object.assign(Th,e);for(const t of sm)t(Th)}function XB(e){return e instanceof Error?e.message:String(e)}const ZB=120;function Yi(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function JB(e,t){if(!t)return Yi(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?Yi(e):Yi(e.slice(0,i))+`<mark>${Yi(e.slice(i,i+t.length))}</mark>`+Yi(e.slice(i+t.length))}function QB(e){return`<span class="codex-nav-tag">${Yi(e)}</span>`}function e9(e,t,i){const s=t?e.tags.some(c=>c.toLowerCase().includes(t.toLowerCase())):!1,o=e.tags.slice(0,3).map(QB).join(""),f=Yi(e.status??"current"),p=Yi(e.updated??"");return`<button
|
|
215
|
+
class="codex-nav-entry${i?" is-current":""}"
|
|
216
|
+
data-entry-id="${Yi(e.id)}"
|
|
217
|
+
type="button"
|
|
218
|
+
${i?'aria-current="page"':""}
|
|
219
|
+
title="${Yi(e.title)}"
|
|
220
|
+
>
|
|
221
|
+
<span class="t">${JB(e.title,s?"":t)}</span>
|
|
222
|
+
${o?`<span class="tg">${o}</span>`:""}
|
|
223
|
+
<span class="meta">${f} · ${p}</span>
|
|
224
|
+
</button>`}function t9(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 n9(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=t9(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">${Yi(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=>e9(w,i,w.id===s)).join("")}function v(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(so()),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(so())},ZB)}e.addEventListener("click",v),f.addEventListener("input",g);const x=k2(C=>d(C));return d(so()),{destroy(){x(),e.removeEventListener("click",v),f.removeEventListener("input",g),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(C){i="",s=null,f&&(f.value=""),d(so())}}}function i9(e,t){t.initialTheaterId&&TS(t.initialTheaterId);const i=n9(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),s=k2(()=>{});Ah();const o=i.destroy.bind(i);return{destroy(){s(),o()},setTheater(f){TS(f),Ah(),i.setTheater(f)}}}function wt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function vo(e){return wt(e).replace(/"/g,""")}const r9="contextual-knowledge-not-instructions";function s9(e,t){const i=e.frontmatter.whyThisMatched,s=R2(e,t);return`
|
|
249
|
+
<div class="context-actions-grid">
|
|
250
|
+
<button class="context-action-btn" type="button" data-action="copy-compact-context">
|
|
251
|
+
<span class="context-action-label">Compact context</span>
|
|
252
|
+
<span class="context-action-meta">${th(T2(e))} tok</span>
|
|
253
|
+
</button>
|
|
254
|
+
<button class="context-action-btn" type="button" data-action="copy-provenance-context">
|
|
255
|
+
<span class="context-action-label">Provenance</span>
|
|
256
|
+
<span class="context-action-meta">${th(A2(e))} tok</span>
|
|
257
|
+
</button>
|
|
258
|
+
<button class="context-action-btn" type="button" data-action="copy-related-context">
|
|
259
|
+
<span class="context-action-label">Context pack</span>
|
|
260
|
+
<span class="context-action-meta">${th(s)} tok</span>
|
|
261
|
+
</button>
|
|
262
|
+
${i?`
|
|
263
|
+
<button class="context-action-btn context-action-btn--secondary" type="button" data-action="toggle-why-matched">
|
|
264
|
+
<span class="context-action-label">Why this matched</span>
|
|
265
|
+
</button>
|
|
266
|
+
<div class="context-why-matched" hidden>${wt(i)}</div>
|
|
267
|
+
`:""}
|
|
268
|
+
</div>
|
|
269
|
+
`}function T2(e){const t={id:e.frontmatter.id,title:e.frontmatter.title,status:e.frontmatter.status??null,tags:e.frontmatter.tags,updated:e.frontmatter.updated,summary:o_(e.body)};return JSON.stringify({...t,token_estimate:th(JSON.stringify(t))},null,2)}function A2(e){return[`# ${e.frontmatter.title} (\`${e.frontmatter.id}\`)`,"",`- updated: ${e.frontmatter.updated}`,`- status: ${e.frontmatter.status??"unknown"}`,`- raw_source_ref: ${e.frontmatter.rawSourceRef??"(none)"}`,`- raw_source_refs: ${(e.frontmatter.rawSourceRefs??[]).join(", ")||"(none)"}`,"","## Summary",o_(e.body)].join(`
|
|
270
|
+
`)}function R2(e,t){const i=new Set([...e.frontmatter.related??[]]),s=t.filter(o=>i.has(o.id)).sort((o,f)=>o.title.localeCompare(f.title));return[`<fleet-wiki-context boundary="${r9}">`,"# Fleet Wiki Context Pack","",`## Entry: ${e.frontmatter.title} (\`${e.frontmatter.id}\`)`,"",`- updated: ${e.frontmatter.updated}`,`- status: ${e.frontmatter.status??"unknown"}`,`- tags: ${e.frontmatter.tags.join(", ")||"(none)"}`,"","### Summary",o_(e.body),"","### Related Entries",...s.length>0?s.map(o=>`- [[wiki:${o.id}]] — ${o.title}`):["- (none)"],"","</fleet-wiki-context>"].join(`
|
|
271
|
+
`)}function th(e){return Math.max(1,Math.ceil(e.length/4))}function o_(e){return e.replace(/\s+/g," ").trim().slice(0,240)||"(empty)"}function a9(e){const t=e.tags.map(s=>`<span class="chip chip-tag">${wt(s)}</span>`).join(""),i=l9(e);return`
|
|
272
|
+
<div class="meta-chips">
|
|
273
|
+
${t}
|
|
274
|
+
${i}
|
|
275
|
+
<span class="chip">Updated ${wt(o9(e.updated))}</span>
|
|
276
|
+
</div>
|
|
277
|
+
`}function L2(e){return e.map(t=>`<span class="chip chip-muted">${wt(t)}</span>`).join("")}function o9(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function l9(e){const t=c9(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${vo(t.title)}">${wt(t.label)}</span>`:""}function c9(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 u9="active";function AS(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${vo(t.id)}" data-toc-id="${vo(t.id)}">${wt(t.text)}</a>`).join("")}function RS(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 x=g.target instanceof HTMLElement?g.target.id:"";x&&(g.isIntersecting?c.add(x):c.delete(x))}const v=h9(f,c)??d9(f,p)??f[0]?.id??null;LS(s,v)},{root:p,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const d of f)h.observe(d);return LS(s,f[0]?.id??null),()=>h.disconnect()}function h9(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function d9(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 LS(e,t){for(const i of e){const s=!!(t&&i.dataset.tocId===t);i.classList.toggle(u9,s),s?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function MS(e){return`/entry/${encodeURIComponent(e)}`}const M2={create_wiki:"+",update_wiki:"↻"},N2={create_wiki:"Create",update_wiki:"Update"};function f9(e,t){let i=!1,s=null,o=t,f="idle",p=null,c=null,h=null;LC(e);function d(b){const _=b.target;if(!(_ instanceof Element))return;const S=_.closest("[data-patch-id]");if(S){b.preventDefault();const B=S.dataset.patchId||void 0;o.onPatchOpen?.(B);return}const k=_.closest("[data-entry-id]");if(k?.dataset.entryId){b.preventDefault(),o.onRelatedClick(k.dataset.entryId);return}const L=_.closest("[data-drydock-action]");if(L){b.preventDefault(),v(L.dataset.drydockAction);return}const R=_.closest("[data-action]");if(!R)return;const N=R.dataset.action,A=e._currentEntry;if(A){if(N==="copy-compact-context")navigator.clipboard.writeText(T2(A));else if(N==="copy-provenance-context")navigator.clipboard.writeText(A2(A));else if(N==="copy-related-context")navigator.clipboard.writeText(R2(A,so().index));else if(N==="toggle-why-matched"){const B=R.nextElementSibling;B?.classList.contains("context-why-matched")&&(B.hidden=!B.hidden)}}}function v(b){if(b){if(b==="back"){o.onPatchOpen?.(void 0);return}if(b==="approve"){f="approving",p=null,x();return}if(b==="approve-confirm"){g("approve",void 0);return}if(b==="reject"){f="rejecting",p=null,x();return}if(b==="reject-submit"){const _=e.querySelector("#queue-reject-reason")?.value.trim();if(!_){p="Rejection reason is required.",x();return}g("reject",_);return}if(b==="cancel"){f="idle",p=null,x();return}}}async function g(b,_){if(h){f="submitting",p=null,x();try{await qB(o.theaterId,h,b,_),o.onDecided?.()}catch(S){f=b==="approve"?"approving":"rejecting",p=S instanceof Error?S.message:String(S),x()}}}function x(){const b=e.querySelector("[data-decision-bar-wrap]");b&&(b.innerHTML=O2(f,p))}e.addEventListener("click",d);function C(){s?.(),s=null}async function T(b){if(!i){Xp(e,t.tocContainer),C();try{const _=await WB(o.theaterId,b);if(i)return;const{index:S}=so(),{html:k,toc:L}=bh(_.body,{omitDuplicateTitle:_.frontmatter.title,resolveWikiLink:N=>MS(N)});e._currentEntry=_,e.innerHTML=`
|
|
278
|
+
<article class="document">
|
|
279
|
+
<header class="document-header">
|
|
280
|
+
${p9(_.frontmatter.title)}
|
|
281
|
+
<h1>${wt(_.frontmatter.title)}</h1>
|
|
282
|
+
${a9(_.frontmatter)}
|
|
283
|
+
</header>
|
|
284
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
285
|
+
${k}
|
|
286
|
+
</div>
|
|
287
|
+
${g9(_.frontmatter.id,_.frontmatter.tags,S)}
|
|
288
|
+
${s9(_,S)}
|
|
289
|
+
</article>
|
|
290
|
+
`,t.tocContainer.innerHTML=AS(L);const R=e.querySelector("article");R&&L.length>0&&(s=RS(R,L,t.tocContainer))}catch(_){i||Zp(e,t.tocContainer,_)}}}async function w(b){if(!i){Xp(e,t.tocContainer),C(),c=null,h=null,f="idle",p=null;try{if(b){const _=await GB(o.theaterId,b);if(i)return;c=_.meta,h=b;const{html:S,toc:k}=bh(_.wikiEntry.body,{omitDuplicateTitle:_.wikiEntry.title,resolveWikiLink:R=>MS(R)});e.innerHTML=v9(_,S),t.tocContainer.innerHTML=AS(k);const L=e.querySelector("article");L&&k.length>0&&(s=RS(L,k,t.tocContainer))}else{const _=await C2(o.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=m9(_.items,"Drydock — Pending Patches")}}catch(_){i||Zp(e,t.tocContainer,_)}}}async function m(b){if(!i){Xp(e,t.tocContainer),C();try{if(b){const _=await VB(o.theaterId,b);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=S9(_)}else{const _=await KB(o.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=x9(_)}}catch(_){i||Zp(e,t.tocContainer,_)}}}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 Xp(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Zp(e,t,i){const s=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${wt(s)}</div>`,t.innerHTML=""}function p9(e){return`
|
|
291
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
292
|
+
<ol>
|
|
293
|
+
<li><span>Codex</span></li>
|
|
294
|
+
<li><span aria-current="page">${wt(e)}</span></li>
|
|
295
|
+
</ol>
|
|
296
|
+
</nav>
|
|
297
|
+
`}function g9(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?"":`
|
|
298
|
+
<section class="related-list">
|
|
299
|
+
<h2>Related entries</h2>
|
|
300
|
+
<div class="related-items">
|
|
301
|
+
${o.map(f=>`<button class="related-card" type="button" data-entry-id="${vo(f.entry.id)}">
|
|
302
|
+
<strong>${wt(f.entry.title)}</strong>
|
|
303
|
+
<span>${L2(f.matchingTags)}</span>
|
|
304
|
+
</button>`).join("")}
|
|
305
|
+
</div>
|
|
306
|
+
</section>
|
|
307
|
+
`}function m9(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
308
|
+
<article class="document">
|
|
309
|
+
<header class="document-header">
|
|
310
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
311
|
+
<ol>
|
|
312
|
+
<li><span>Codex</span></li>
|
|
313
|
+
<li><span aria-current="page">Drydock</span></li>
|
|
314
|
+
</ol>
|
|
315
|
+
</nav>
|
|
316
|
+
<h1>${wt(t)}</h1>
|
|
317
|
+
</header>
|
|
318
|
+
<div class="queue-row-list">
|
|
319
|
+
${e.map(_9).join("")}
|
|
320
|
+
</div>
|
|
321
|
+
</article>
|
|
322
|
+
`}function _9(e){const t=e.op??"create_wiki",i=M2[t]??"?",s=N2[t]??"Patch",o=e.target??e.id,p=[w9(e.meta.createdAt)].filter(Boolean);return`
|
|
323
|
+
<button class="queue-row" type="button" data-patch-id="${vo(e.id)}" aria-label="${vo(s+": "+o)}">
|
|
324
|
+
<span class="queue-row-badge" aria-hidden="true">
|
|
325
|
+
<span class="op-badge">${i}</span>
|
|
326
|
+
</span>
|
|
327
|
+
<span class="queue-row-body">
|
|
328
|
+
<span class="queue-row-target">${wt(o)}</span>
|
|
329
|
+
${e.summary?`<span class="queue-row-summary">${wt(e.summary)}</span>`:""}
|
|
330
|
+
${p.length>0?`<span class="queue-row-meta">${p.map(wt).join(" · ")}</span>`:""}
|
|
331
|
+
</span>
|
|
332
|
+
</button>
|
|
333
|
+
`}function v9(e,t){const{patch:i,meta:s,wikiEntry:o,targetExists:f}=e,p=i.frontmatter.op,c=M2[p]??"?",h=N2[p]??"Patch",d=f?"기존 문서 대체":"신규 문서 생성",v=s.status==="pending";return`
|
|
334
|
+
<article class="document">
|
|
335
|
+
<header class="document-header">
|
|
336
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
337
|
+
<ol>
|
|
338
|
+
<li><span>Codex</span></li>
|
|
339
|
+
<li><span>Drydock</span></li>
|
|
340
|
+
<li><span aria-current="page">${wt(h)}</span></li>
|
|
341
|
+
</ol>
|
|
342
|
+
</nav>
|
|
343
|
+
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
344
|
+
<h1><span class="op-badge">${c}</span> ${wt(o.title)}</h1>
|
|
345
|
+
<p class="eyebrow">${wt(i.frontmatter.target)} · v${o.version} · ${wt(d)}</p>
|
|
346
|
+
${b9(i.frontmatter.proposer,o.tags)}
|
|
347
|
+
</header>
|
|
348
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
349
|
+
${t}
|
|
350
|
+
</div>
|
|
351
|
+
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
352
|
+
${v?O2("idle",null):y9(s)}
|
|
353
|
+
</div>
|
|
354
|
+
</article>
|
|
355
|
+
`}function b9(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${wt(e)}</span>`),t.length>0&&i.push(L2(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function O2(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
356
|
+
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
357
|
+
<div class="queue-action-buttons">
|
|
358
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
359
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
360
|
+
</div>
|
|
361
|
+
${t?`<p class="queue-action-error">${wt(t)}</p>`:""}
|
|
362
|
+
`:e==="rejecting"?`
|
|
363
|
+
<div class="queue-reject-form">
|
|
364
|
+
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
365
|
+
<div class="queue-action-buttons">
|
|
366
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
367
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
368
|
+
</div>
|
|
369
|
+
${t?`<p class="queue-action-error">${wt(t)}</p>`:""}
|
|
370
|
+
</div>
|
|
371
|
+
`:`
|
|
372
|
+
<div class="queue-action-buttons">
|
|
373
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
374
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
375
|
+
</div>
|
|
376
|
+
`}function y9(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",s=t?"queue-decision-decided--approve":"queue-decision-decided--reject",o=e.reason?` · ${wt(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${i}${o}</p>`}function S9(e){return`
|
|
377
|
+
<article class="document">
|
|
378
|
+
<header class="document-header">
|
|
379
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
380
|
+
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
381
|
+
</nav>
|
|
382
|
+
<h1>${wt(e.id)}</h1>
|
|
383
|
+
<p class="eyebrow">Conflict · ${wt(e.meta?.status??"open")}</p>
|
|
384
|
+
</header>
|
|
385
|
+
<div class="markdown-body">
|
|
386
|
+
${e.current?`<h2>Current</h2><pre><code>${wt(e.current)}</code></pre>`:""}
|
|
387
|
+
${e.proposed?`<h2>Proposed</h2><pre><code>${wt(e.proposed)}</code></pre>`:""}
|
|
388
|
+
</div>
|
|
389
|
+
</article>
|
|
390
|
+
`}function x9(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
391
|
+
<article class="document">
|
|
392
|
+
<header class="document-header">
|
|
393
|
+
<h1>Conflicts</h1>
|
|
394
|
+
</header>
|
|
395
|
+
<div class="markdown-body">
|
|
396
|
+
<ul class="queue-list">
|
|
397
|
+
${e.map(t=>`<li class="queue-item">
|
|
398
|
+
<strong>${wt(t.title||t.id)}</strong>
|
|
399
|
+
<span class="eyebrow">${wt(t.status)}</span>
|
|
400
|
+
</li>`).join("")}
|
|
401
|
+
</ul>
|
|
402
|
+
</div>
|
|
403
|
+
</article>
|
|
404
|
+
`}function w9(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 Xs=null,nc=null,D2=null,Cs=null,Zs=null,xs=null,nh=null,Jp=null,ih,am=0;function NS(e){D2=e}function C9(e,t){const i=T9();i.parentElement!==e&&e.appendChild(i),nc||(nc=i9(i,{initialTheaterId:t,onRequest:s=>D2?.(s)}))}function E9(e){nc?.setTheater(e)}function j2(e,t,i){const s=A9(),o=R9(),f=s.parentElement,p=i.kind==="entry"&&nh==="entry"&&i.initialEntryId===Jp;f&&f!==e&&(am=f.scrollTop),s.parentElement!==e&&e.appendChild(s),o.parentElement!==t&&t.appendChild(o),!xs||nh!==i.kind?(xs?.destroy(),xs=f9(s,{...i,tocContainer:o}),nh=i.kind,ih=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==Jp?xs.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==ih&&(ih=i.subId,xs.navigateSub(i.subId)),Jp=i.kind==="entry"?i.initialEntryId??null:null,xs.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const c=p?am:0;requestAnimationFrame(()=>{e.scrollTop=c})}function k9(){const e=Cs?.parentElement;e&&(am=e.scrollTop)}function I2(){xs?.destroy(),xs=null,nh=null,ih=void 0,Cs?.parentElement&&Cs.parentElement.removeChild(Cs),Zs?.parentElement&&Zs.parentElement.removeChild(Zs)}function OS(){I2(),nc?.destroy(),nc=null,Xs?.parentElement&&Xs.parentElement.removeChild(Xs)}function T9(){return Xs||(Xs=document.createElement("div"),Xs.className="codex-host"),Xs}function A9(){return Cs||(Cs=document.createElement("div"),Cs.className="codex-reader-host"),Cs}function R9(){return Zs||(Zs=document.createElement("div"),Zs.className="codex-toc-host"),Zs}const L9={id:"codex",title:"Codex",icon:()=>u.jsx(O9,{}),render:()=>u.jsx(M9,{})};function M9(){const e=$r(),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(x=>x.id===e.activeTheaterId)??null,h=c?.id??null,d=!!c?.hasWiki,v=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){OS();return}return()=>{OS()}},[d]),M.useEffect(()=>{if(!d||!h)return;const x=t.current;if(x)return C9(x,h),NS(C=>{C.kind==="entry"?Br({kind:"entry",entryId:C.id}):C.kind==="drydock"?Br({kind:"drydock",patchId:C.patchId}):C.kind==="conflicts"&&Br({kind:"conflicts",id:C.id})}),()=>{NS(null)}},[d,h,f]),M.useEffect(()=>{d&&h&&E9(h)},[h,d]),M.useEffect(()=>{if(!d||!h||!f||p||!i.current||!s.current||!o)return;const x=o.kind,C=x==="drydock"?o.patchId:x==="conflicts"?o.id:void 0;j2(i.current,s.current,{initialEntryId:x==="entry"?o.entryId:"",kind:x,subId:C,theaterId:h,onRelatedClick:T=>Br({kind:"entry",entryId:T}),onClose:()=>_b(),onPatchOpen:T=>Br({kind:"drydock",patchId:T}),onDecided:()=>{Ah(),Br({kind:"drydock",patchId:void 0})}})},[d,h,f,p,g]),M.useEffect(()=>{f||I2()},[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:qu,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:_b,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(N9,{activeTheater:c,hasTheaters:v})}function N9({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 O9(){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 D9=[IB,L9];function j9(e="right"){const{railPanels:t}=oc();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const I9=360;function B9(e){const{codexReader:t}=$r();return e==="codex"&&t!==null?I9:0}const B2=240,P9=312,P2="fleet-console.rail.panelWidth";function z9(){try{const e=localStorage.getItem(P2);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=B2)return t}}catch{}return P9}function H9({theaterId:e,api:t}){const i=b2(),s=j9(),o=D9,p=[...o,...s].find(b=>b.id===i)??null,c=p!==null,h=B9(i)+(p?.preferredExtraWidth??0)+DB(),d=M.useRef(h);d.current=h;const[v,g]=M.useState(z9),x=M.useRef(v),[C,T]=M.useState(!1),w=M.useCallback(b=>{b.preventDefault();const _=b.clientX,S=x.current;T(!0);const k=R=>{const N=_-R.clientX,A=window.innerWidth-148-d.current,B=Math.max(B2,Math.min(A,S+N));x.current=B,g(B)},L=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",L),T(!1);try{localStorage.setItem(P2,String(x.current))}catch{}};document.addEventListener("pointermove",k),document.addEventListener("pointerup",L)},[]),m=M.useMemo(()=>({theaterId:e,api:t,requestExtraWidth:b=>{i!==null&&OB(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:v+h}:void 0,children:[c&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:w,"aria-hidden":"true"}),p&&u.jsx($9,{activePanel:p,activeId:i,ctx:m})]}),u.jsxs("nav",{className:"right-rail-icons",role:"tablist","aria-label":"Activity tools",children:[o.map(b=>u.jsx(DS,{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(DS,{panel:b,isActive:i===b.id},b.id))]})]})}const $9=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:NB,children:"✕"})]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:t.render(s)})]})});function DS({panel:e,isActive:t}){const i=M.useCallback(()=>MB(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})}const jS=8,U9=260;function IS(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+jS,c=p+U9>window.innerHeight;o(c?{position:"fixed",left:f,top:"auto",bottom:Math.round(window.innerHeight-t.top+jS)}:{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]),Es.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(F9,{...e}):u.jsx(W9,{...e})}):null}),document.body)}function F9({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),v=M.useRef(null);M.useEffect(()=>{f&&v.current?.select()},[f]);const g=()=>{const x=c.trim();x&&(s.onCreateGroup(x),o())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(x=>{const C=tc(x.color),T=e.groupId===x.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:x.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:x.name}),T?u.jsx(G9,{}):null]},x.id)}),f?u.jsx("input",{ref:v,className:"group-context-menu-new-input",type:"text",value:c,onChange:x=>h(x.target.value),onCompositionStart:()=>{d.current=!0},onCompositionEnd:()=>{d.current=!1},onKeyDown:x=>{x.key==="Enter"&&!d.current&&(x.preventDefault(),g()),x.key==="Escape"&&(x.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:Wh.map(x=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":x.label,"aria-pressed":i===x.key,onClick:()=>{s.onSetAccent(x.key),o()},children:u.jsx("span",{style:{background:x.color}})},x.key))})]})}function W9({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:Wh.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 G9(){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 q9(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 v=Array.from(d.querySelectorAll("[data-side-bar-chip-id]"));for(const g of v){const x=g.dataset.sideBarChipId;if(!x||x===s)continue;const C=g.getBoundingClientRect();if(e<=C.top+C.height/2)return{groupId:f.groupId,index:Math.max(0,f.entryIds.indexOf(x))}}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 K9(e,t,i,s){const o=e.filter(v=>v!==t),f=new Set(s),p=o.filter(v=>f.has(v)),c=Math.max(0,Math.min(i,p.length));if(p.length===0)return[...o,t];if(c<p.length){const v=o.indexOf(p[c]),g=[...o];return g.splice(v,0,t),g}const h=o.indexOf(p[p.length-1]),d=[...o];return d.splice(h+1,0,t),d}function V9(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 v=0;return e.map(g=>o.has(g)?c[v++]??g:g)}function Y9(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 X9(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 Z9({entry:e,index:t,isCloseArmed:i,accentValue:s,dragging:o,dragOffsetY:f,dropTarget:p,onArmClose:c,onDisarmClose:h,onClose:d,onFocus:v,onKeyboardMove:g,onPointerDragStart:x,onOpenAccent:C,onRename:T}){const w=M.useRef(!1),{operation:m,active:b,minimized:_,notificationCount:S}=e,k=J9(m),L=g2({currentTitle:k,onCommit:I=>T(m.id,I),onBegin:h}),R=["side-bar-chip",b?"side-bar-chip--active":"",_?"side-bar-chip--minimized":"",o?"side-bar-chip--dragging":"",p?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),N=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),A={"--i":t,...s?{"--chip-accent":s}:{},...o?{"--drag-dy":`${Math.round(f)}px`}:{}},B=()=>{if(h(),w.current){w.current=!1;return}v(m.id)},V=I=>{I.stopPropagation()},U=I=>{if(I.stopPropagation(),!i){c(m.id);return}h(),d(m.id)},W=I=>{I.preventDefault(),h(),C(m.id,I.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":m.id,className:R,role:"button",tabIndex:0,"aria-label":b?`${k} (focused)`:`Focus operation ${k}`,"aria-current":b?"true":void 0,title:b?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:A,onClick:B,onContextMenu:W,onFocus:()=>{i||h()},onPointerDown:I=>x(I,m.id),onPointerUp:()=>{o&&(w.current=!0)},onKeyDown:I=>{if(I.target===I.currentTarget){if(I.altKey&&I.shiftKey&&(I.key==="ArrowUp"||I.key==="ArrowDown")){I.preventDefault(),g(m.id,I.key==="ArrowUp"?-1:1);return}(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),B())}},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(eP,{})})}),L.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:L.inputRef,value:L.draftTitle,"aria-label":`Rename operation ${k}`,onChange:I=>L.setDraftTitle(I.target.value),onKeyDown:L.handleKeyDown,onBlur:L.handleBlur,onPointerDown:I=>I.stopPropagation(),onClick:I=>I.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:L.begin,children:k}),S>0?u.jsx("span",{className:"side-bar-chip-count",children:S}):null,u.jsx("button",{type:"button",className:N,onPointerDown:V,onClick:U,"aria-label":i?`Confirm close operation ${k}`:`Close operation ${k}`,title:i?"Confirm close":"Close operation",children:i?"Close?":u.jsx(Q9,{})})]})}function J9(e){return e.title}function Q9(){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 eP(){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 tP({group:e,count:t,collapsed:i,tier:s,onToggle:o,onContextMenu:f}){const p=tc(e.color),c=p?{"--grp-color":p}:void 0,h=d=>{d.preventDefault(),f(e.id,d.currentTarget.getBoundingClientRect())};return s==="rail"?u.jsx("div",{className:"side-bar-group-header side-bar-group-header--rail","data-tier":"rail",style:c,onClick:()=>o(e.id),onContextMenu:h,role:"button",tabIndex:0,"aria-label":`Group ${e.name}`,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o(e.id))},children:u.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"})}):u.jsxs("div",{className:"side-bar-group-header",style:c,onContextMenu:h,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>o(e.id),"aria-expanded":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:u.jsx(nP,{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 nP({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 z2="fleet-console.operations.side-width",H2="fleet-console.operations.side-collapsed",Rh=56,iP=180,BS=iP;function rP(){return typeof window<"u"?window.innerWidth-480:800}function sP(){try{if(typeof window>"u")return BS;const e=localStorage.getItem(z2);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=Rh)return t}}catch{}return BS}function aP(){try{return typeof window>"u"?!1:localStorage.getItem(H2)==="1"}catch{}return!1}let ic={width:sP(),collapsed:aP()};const om=new Set;function $2(){for(const e of om)e()}function PS(){return ic}function oP(e){return om.add(e),()=>{om.delete(e)}}function lP(){return M.useSyncExternalStore(oP,PS,PS)}function zS(e){const t=Math.max(Rh,Math.min(rP(),e));ic={...ic,width:t};try{typeof window<"u"&&localStorage.setItem(z2,String(t))}catch{}$2()}function cP(e){ic={...ic,collapsed:e};try{typeof window<"u"&&localStorage.setItem(H2,e?"1":"0")}catch{}$2()}function uP(e){return e<120?"rail":e<240?"list":"detail"}function hP(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 dP=1500,fP=6,HS=34,$S=18;function pP({operations:e,groups:t,minimized:i,activeOperationId:s,operationNotifications:o,catalog:f,canLaunch:p,mapFullscreen:c,radarEnabled:h,perimeterEnabled:d,renderKindIcon:v,onLaunchKind:g,onResetView:x,onMaximizeMap:C,onToggleRadar:T,onTogglePerimeter:w,onClose:m,onFocus:b,onSetAccent:_,onRename:S,onSetGroupId:k,onCreateGroup:L,onSetGroupColor:R,onRenameGroup:N,onUngroupAll:A}){const B=M.useRef(null),V=lP(),{width:U,collapsed:W}=V,I=W?"rail":uP(U),X=vx(),Y=M.useRef(null),[P,G]=M.useState(null),[K,j]=M.useState(null),z=M.useRef(null),D=M.useRef([]),F=M.useRef([]),J=M.useRef([]),ne=M.useRef(k),[Z,re]=M.useState(null),[q,H]=M.useState(null),[se,de]=M.useState(null),xe=_A(),ye=new Set(i),Me=new Set(xe),Oe=Yx(e,X.operationOrder).map(ve=>{const $e=hP(f,ve),Je=$e?v(ve.pluginId,$e):null;return{operation:ve,active:s===ve.id,minimized:ye.has(ve.id),notificationCount:o[ve.id]?1:0,icon:Je}}),Fe=gP(Oe,t,X.operationOrder),ht=Fe.flatMap(ve=>Me.has(ve.groupId??"")?[]:ve.entries),Ae=Oe.map(ve=>ve.operation.id),Rt=M.useCallback(()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},[]),Xt=M.useCallback(()=>{Rt(),G(null)},[Rt]),vn=M.useCallback(ve=>{Rt(),G(ve),Y.current=window.setTimeout(()=>{Y.current=null,G(null)},dP)},[Rt]);M.useEffect(()=>Rt,[Rt]),M.useEffect(()=>{P!==null&&(Oe.some(ve=>ve.operation.id===P)||Xt())},[P,Oe,Xt]);const on=Z?.kind==="chip"?Oe.find(ve=>ve.operation.id===Z.operationId)?.operation??null:null,kn=Z?.kind==="group"?t.find(ve=>ve.id===Z.groupId)??null:null,Zt=(ve,$e)=>{const Je=ht.findIndex(Dt=>Dt.operation.id===ve);if(Je===-1)return;const _t=Math.max(0,Math.min(ht.length-1,Je+$e));if(_t===Je)return;const Ve=ht.map(Dt=>Dt.operation.id),ln=X9(Ve,ve,_t);rp(Y9(Ae,Ve,ln))},ct=Fe.map(ve=>({groupId:ve.groupId,entryIds:ve.entries.map($e=>$e.operation.id)}));M.useEffect(()=>{D.current=Oe,F.current=Ae,J.current=ct,ne.current=k});const Lt=ve=>{z.current=ve,j(ve)},Ct=K?.pointerId??null;M.useEffect(()=>{if(Ct===null)return;const ve=_t=>{if(_t.pointerId!==Ct)return;const Ve=z.current;if(!Ve)return;if(_t.buttons===0){Lt(null);return}const ln=Math.hypot(_t.clientX-Ve.startX,_t.clientY-Ve.startY);if(!Ve.dragging&&ln<fP)return;Ve.dragging&&_t.preventDefault();const Dt=q9(_t.clientY,J.current,B.current,Ve.sourceId);mP(_t.clientY,B.current),Lt({...Ve,currentY:_t.clientY,dragging:!0,dropIndex:Dt.index,dropGroupId:Dt.groupId})},$e=_t=>{if(_t.pointerId!==Ct)return;const Ve=z.current;if(Lt(null),!Ve?.dragging)return;const{sourceId:ln,sourceGroupId:Dt,dropIndex:An,dropGroupId:Un}=Ve,jt=J.current,ee=F.current;if(Un!==Dt){const ke=jt.find(Ce=>Ce.groupId===Un)?.entryIds??[];rp(K9(ee,ln,An,ke)),ne.current(ln,Un);return}const Se=jt.find(ut=>ut.groupId===Dt)?.entryIds??[],je=Se.indexOf(ln);if(je===-1||An===je)return;const bt=V9(ee,ln,An,Se);rp(bt)},Je=_t=>{_t.pointerId===Ct&&Lt(null)};return window.addEventListener("pointermove",ve),window.addEventListener("pointerup",$e),window.addEventListener("pointercancel",Je),()=>{window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",$e),window.removeEventListener("pointercancel",Je)}},[Ct]);const Ft=(ve,$e)=>{if(ve.button!==0||ve.target instanceof Element&&ve.target.closest("button"))return;re(null),Xt();const _t=Oe.find(Ve=>Ve.operation.id===$e)?.operation.groupId??null;Lt({sourceId:$e,sourceGroupId:_t,pointerId:ve.pointerId,startX:ve.clientX,startY:ve.clientY,currentY:ve.clientY,dragging:!1,dropIndex:Ae.indexOf($e),dropGroupId:_t})},Kt=M.useCallback(ve=>{ve.preventDefault();const $e=ve.clientX,Je=V.width,_t=ln=>{const Dt=ln.clientX-$e;zS(Je+Dt)},Ve=()=>{document.removeEventListener("pointermove",_t),document.removeEventListener("pointerup",Ve)};document.addEventListener("pointermove",_t),document.addEventListener("pointerup",Ve)},[V.width]),Jn=()=>{cP(!W),W||zS(Rh)},bn=ve=>{if(q){H(null);return}de(null);const $e=ve.currentTarget.getBoundingClientRect();H({anchor:{x:$e.right+8,y:$e.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Pn=ve=>{ve.defaultPrevented||(ve.preventDefault(),de(null),re(null),H({anchor:{x:ve.clientX,y:ve.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},dt=ve=>{if(se){de(null);return}H(null);const $e=ve.currentTarget.getBoundingClientRect();de({anchor:{x:$e.right+8,y:$e.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Tn=W?Rh:U;return Oe.length===0&&I==="rail"?u.jsxs("aside",{className:"operations-side-bar","data-tier":I,"data-canvas-blocker":!0,style:{"--side-bar-width":`${Tn}px`},onContextMenu:Pn,children:[u.jsx("header",{className:"operations-side-bar-header",children:u.jsx("button",{type:"button",className:"side-bar-new-btn",onClick:bn,"aria-label":"New Operation",title:"New Operation",children:u.jsx(US,{})})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Kt,onDoubleClick:Jn,"aria-hidden":"true"}),q?Es.createPortal(u.jsx(Qu,{anchor:q.anchor,viewportBounds:q.viewportBounds,placement:"cursor",mode:"launch",catalog:f,canLaunch:p,renderKindIcon:v,onLaunchKind:(ve,$e)=>{H(null),g(ve,$e)},onResetView:x,onClose:()=>H(null)},`${q.anchor.x}:${q.anchor.y}`),document.body):null]}):u.jsxs("aside",{className:"operations-side-bar","data-tier":I,"data-canvas-blocker":!0,style:{"--side-bar-width":`${Tn}px`},onContextMenu:Pn,children:[u.jsxs("header",{className:"operations-side-bar-header",children:[u.jsxs("button",{type:"button",className:"side-bar-new-btn",onClick:bn,"aria-label":"New Operation","aria-expanded":q!==null,title:"New Operation",children:[u.jsx(US,{}),I!=="rail"?u.jsx("span",{children:"Operation"}):null]}),I!=="rail"?u.jsx("button",{type:"button",className:"side-bar-settings-btn",onClick:dt,"aria-expanded":se!==null,"aria-label":"Map and display controls",title:"Map and display controls",children:u.jsx(_P,{})}):null]}),u.jsx("ol",{className:"operations-side-bar-chips",ref:B,"aria-label":"Operations",children:Fe.map(ve=>{const $e=ve.groupId!==null&&Me.has(ve.groupId),Je=ve.group?tc(ve.group.color):null,_t=Je?{"--grp-color":Je}:void 0;return u.jsxs("li",{"data-drop-zone-group-id":ve.groupId??"__ungrouped__",className:ve.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:_t,children:[ve.group?u.jsx(tP,{group:ve.group,count:ve.entries.length,collapsed:$e,tier:I,onToggle:mA,onContextMenu:(Ve,ln)=>re({kind:"group",groupId:Ve,anchor:ln})}):ve.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:I!=="rail"?u.jsx("span",{children:"Ungrouped"}):null}):null,$e?null:u.jsx("ol",{className:["side-bar-group-chips",K?.dragging&&K.dropGroupId===ve.groupId&&K.dropGroupId!==K.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":ve.groupId??"__ungrouped__","aria-label":ve.group?ve.group.name:"Ungrouped",children:ve.entries.map(Ve=>{const ln=Oe.indexOf(Ve),Dt=ve.entries.indexOf(Ve),An=X.operationAccent[Ve.operation.id]??xS(Ve.operation),Un=An?tc(An):null;return u.jsx(Z9,{entry:Ve,index:ln,isCloseArmed:P===Ve.operation.id,accentValue:Un,dragging:K?.sourceId===Ve.operation.id&&K.dragging,dragOffsetY:K?.sourceId===Ve.operation.id&&K.dragging?K.currentY-K.startY:0,dropTarget:K?.dragging===!0&&K.dropGroupId===ve.groupId&&K.dropGroupId===K.sourceGroupId&&K.dropIndex===Dt&&K.sourceId!==Ve.operation.id,onArmClose:vn,onDisarmClose:Xt,onClose:m,onFocus:b,onKeyboardMove:Zt,onPointerDragStart:Ft,onOpenAccent:(jt,ee)=>re({kind:"chip",operationId:jt,anchor:ee}),onRename:S},Ve.operation.id)})})]},ve.groupId??"__ungrouped__")})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Kt,onDoubleClick:Jn,"aria-hidden":"true"}),q?Es.createPortal(u.jsx(Qu,{anchor:q.anchor,viewportBounds:q.viewportBounds,placement:"cursor",mode:"launch",catalog:f,canLaunch:p,renderKindIcon:v,onLaunchKind:(ve,$e)=>{H(null),g(ve,$e)},onResetView:x,onClose:()=>H(null)},`${q.anchor.x}:${q.anchor.y}`),document.body):null,se?Es.createPortal(u.jsx(Qu,{anchor:se.anchor,viewportBounds:se.viewportBounds,placement:"cursor",mode:"controls",catalog:f,canLaunch:p,mapFullscreen:c,radarEnabled:h,perimeterEnabled:d,renderKindIcon:v,onLaunchKind:g,onResetView:()=>{de(null),x()},onMaximizeMap:C,onToggleRadar:T,onTogglePerimeter:w,onClose:()=>de(null)},`settings:${se.anchor.x}:${se.anchor.y}`),document.body):null,Z?.kind==="chip"&&on?u.jsx(IS,{kind:"chip",operation:on,groups:t,accentKey:X.operationAccent[on.id]??xS(on),anchor:Z.anchor,actions:{onSetAccent:ve=>_(on.id,ve),onSetGroupId:ve=>k(on.id,ve),onCreateGroup:ve=>L(on.theaterId,ve,on.id)},onClose:()=>re(null)}):Z?.kind==="group"&&kn?u.jsx(IS,{kind:"group-header",group:kn,anchor:Z.anchor,actions:{onSetColor:ve=>R(kn.id,ve),onRename:ve=>N(kn.id,ve),onUngroupAll:()=>A(kn.id)},onClose:()=>re(null)}):null]})}function gP(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(v=>v.groupId===h)?.entries.push(c):f.entries.push(c)}return[...o,f]}function mP(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+HS?t.scrollTop-=$S:e>i.bottom-HS&&(t.scrollTop+=$S)}function US(){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 _P(){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"})]})}const vP='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function bP(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=$r(),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(()=>{k9(),z3()},[]);return M.useEffect(()=>{if(!c)return;const d=e;document.body.setAttribute("data-codex-reading","true");const v=document.querySelector(".operations-canvas"),g=document.querySelector(".operations-side-bar");v?.setAttribute("inert",""),g?.setAttribute("inert","");const x=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),h();return}C.key==="Tab"&&yP(s.current,C)};return window.addEventListener("keydown",x,!0),()=>{window.removeEventListener("keydown",x,!0),document.body.removeAttribute("data-codex-reading"),v?.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,v=d==="drydock"?e.patchId:d==="conflicts"?e.id:void 0;j2(o.current,f.current,{initialEntryId:d==="entry"?e.entryId:"",kind:d,subId:v,theaterId:i,onRelatedClick:g=>{Br({kind:"entry",entryId:g}),qu()},onClose:h,onPatchOpen:g=>{Br({kind:"drydock",patchId:g}),qu()},onDecided:()=>{Ah(),Br({kind:"drydock",patchId:void 0}),qu()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[c,p]),c?Es.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 yP(e,t){if(!e)return;const i=[...e.querySelectorAll(vP)].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 SP=Ih().api,lm=560,cm=360,Qp=new Set;function xP({state:e}){const t=M.useRef(null),i=yx(),s=Sx(),o=pA(),f=gA(),p=bx(),c=oc(),[h,d]=M.useState([]),v=M.useMemo(()=>wP(e).map(P=>P.id),[e.operations,e.activeTheaterId]),g=M.useRef(e);g.current=e,M.useEffect(()=>{xA(e.activeTheaterId)},[e.activeTheaterId]),M.useEffect(()=>{if(!e.activeTheaterId){d([]);return}KS().then(d).catch(()=>{})},[e.activeTheaterId]),M.useEffect(()=>{const P={current:i},G=K=>{if(!K.altKey||K.metaKey||K.ctrlKey||K.shiftKey||K.key!=="ArrowLeft"&&K.key!=="ArrowRight")return;const j=document.activeElement;if(j instanceof HTMLElement&&j.matches("input, textarea, [contenteditable='true']")&&!j.closest(".xterm"))return;const z=g.current,D=po(),F=I3(z.operations.filter(Z=>Z.theaterId===z.activeTheaterId),z.groups.filter(Z=>Z.theaterId===z.activeTheaterId),D.operationOrder,D.collapsedGroups).map(Z=>Z.id);if(F.length===0)return;K.preventDefault(),K.stopImmediatePropagation();const J=P.current??g.current.activeOperationId,ne=j3(F,J,K.key==="ArrowRight"?1:-1);if(ne){if(P.current){or(ne),Hl(ne);return}Dh(ne)}};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[i]),M.useEffect(()=>{for(const P of v)yA(P);e.operationsHydrated&&SA(v)},[v,e.operationsHydrated]),M.useEffect(()=>{const P=e.pendingOperationFocus;if(P===null)return;if(dg()!==null){Hl(P),gb();return}go();const G=FS(t.current);G&&ab(P,G),gb()},[e.pendingOperationFocus]);const x=!!e.activeTheaterId&&!e.addingTheater,C=(e.operations??[]).filter(P=>P.theaterId===e.activeTheaterId),T=(e.groups??[]).filter(P=>P.theaterId===e.activeTheaterId),w=M.useCallback((P,G)=>c.plugins.find(j=>j.id===P)?.renderLaunchIcon?.(G)??null,[c.plugins]),m=M.useCallback((P,G,K)=>{if(!g.current.activeTheaterId)return;const j={...WS(K),zIndex:ia()};eg(P,G,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),b=M.useCallback((P,G)=>{if(!g.current.activeTheaterId)return;const K=EP(t.current),j={...WS(K),zIndex:ia()};eg(P,G,j,g.current.activeTheaterId,c.plugins)},[c.plugins]),_=M.useCallback((P,G,K)=>{g.current.activeTheaterId&&eg(P,G,K,g.current.activeTheaterId,c.plugins)},[c.plugins]),S=M.useCallback(()=>{xx({x:0,y:0,zoom:1})},[]),k=M.useCallback(()=>{kA()},[]),L=M.useCallback(()=>{wA()},[]),R=M.useCallback(()=>{CA()},[]),N=M.useCallback(P=>{const G=g.current.operations.find(F=>F.id===P);if(!G)return;const K=dg();if(K!==null&&K!==P){or(P),Hl(P);return}const j=po(),z=j.operations[P]??G.geometry??CP(G);j.operations[P]||pg(P,z),bA(P),or(P);const D=FS(t.current);D&&ab(P,D)},[]),A=M.useCallback((P,G)=>{Gu(P,{accent:G}).then(()=>Si(null)).then(xi).catch(()=>{})},[]),B=M.useCallback((P,G)=>{Dx(P,G).then(()=>Si(null)).then(xi).catch(()=>{})},[]),V=M.useCallback((P,G)=>{Gu(P,{groupId:G}).then(()=>Si(null)).then(xi).catch(()=>{})},[]),U=M.useCallback((P,G,K)=>{o3({theaterId:P,name:G,color:"blue"}).then(j=>Gu(K,{groupId:j.id})).then(()=>Promise.all([Si(null).then(xi),Nl().then(Ol)])).catch(()=>{})},[]),W=M.useCallback((P,G)=>{G&&fb(P,{color:G}).then(()=>Nl()).then(Ol).catch(()=>{})},[]),I=M.useCallback((P,G)=>{fb(P,{name:G}).then(()=>Nl()).then(Ol).catch(()=>{})},[]),X=M.useCallback(P=>{l3(P).then(()=>Promise.all([Si(null).then(xi),Nl().then(Ol)])).catch(()=>{})},[]),Y=M.useCallback(P=>{if(Qp.has(P))return;Qp.add(P);const G=g.current.operations.find(j=>j.id===P)?.pluginId,K=(G?c.plugins.find(j=>j.id===G):null)??null;kP(P,K).finally(()=>Qp.delete(P))},[c.plugins]);return u.jsxs("div",{className:"console-body is-canvas",ref:t,children:[u.jsx(pP,{operations:C,groups:T,minimized:s,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:h,canLaunch:x,mapFullscreen:p,radarEnabled:o,perimeterEnabled:f,renderKindIcon:w,onLaunchKind:b,onResetView:S,onMaximizeMap:k,onToggleRadar:L,onTogglePerimeter:R,onClose:Y,onFocus:N,onSetAccent:A,onRename:B,onSetGroupId:V,onCreateGroup:U,onSetGroupColor:W,onRenameGroup:I,onUngroupAll:X}),u.jsx(vB,{state:e,catalog:h,canLaunch:x,mapFullscreen:p,radarEnabled:o,perimeterEnabled:f,renderKindIcon:w,onLaunchKind:m,onLaunchAtGeometry:_,onResetView:S,onMaximizeMap:k,onToggleRadar:L,onTogglePerimeter:R,onClose:Y,onFocus:N,onSetAccent:A}),u.jsx(H9,{theaterId:e.activeTheaterId,api:SP}),u.jsx(bP,{})]})}function wP(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Sg)}function FS(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function CP(e){return e.geometry??{x:0,y:0,width:lm,height:cm,zIndex:0}}function EP(e){const t=po(),i=e?.clientWidth??800,s=e?.clientHeight??600;return ec({x:i/2,y:s/2},t.viewport)}function WS(e){return{x:e.x-lm/2,y:e.y-cm/2,width:lm,height:cm}}async function eg(e,t,i,s,o){const f=o.find(g=>g.id===e),c=Ih(()=>{Si(null).then(xi).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 Si(null).then(xi).catch(()=>{}),!h)return;const d=fA()===s,v=bg().operations.some(g=>g.id===h);d&&v&&dg()!==null?(or(h),Hl(h)):Dh(h)}async function kP(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await Si(null).then(xi).catch(()=>{})}const TP=6e3;function AP(){const e=$r(),t=Ui(),i=oc(),s=t.pathname,f=bx()&&s.startsWith("/operations"),p=s.startsWith("/operations");return M.useEffect(()=>{const c=Ih(()=>{Si().then(xi).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(()=>{E3(p)},[p]),M.useEffect(()=>{const c=document.querySelector(".topbar");if(!c)return;const h=()=>{document.documentElement.style.setProperty("--console-topbar-offset",`${Math.round(c.getBoundingClientRect().bottom)}px`)};h();const d=new ResizeObserver(h);return d.observe(c),window.addEventListener("resize",h),()=>{d.disconnect(),window.removeEventListener("resize",h)}},[]),M.useEffect(()=>{const c=new AbortController;n3(c.signal).then(v=>{R3(v),vb()}).catch(v=>{c.signal.aborted||(Ze({theaterError:v instanceof Error?v.message:String(v)}),vb())}),Si(null,c.signal).then(xi).catch(()=>{}),Nl(null,c.signal).then(Ol).catch(()=>{}),Fx(),Mx({signal:c.signal}).then(Wx).catch(v=>{c.signal.aborted||Gx(v instanceof Error?v.message:String(v))});const h=()=>{i3(e.activeTheaterId,c.signal).then(k3).catch(()=>{})};h();const d=window.setTimeout(h,TP);return()=>{window.clearTimeout(d),c.abort()}},[]),M.useEffect(()=>{const c=h=>{(h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="k"&&(h.preventDefault(),h.stopImmediatePropagation(),B3())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[]),u.jsxs("div",{className:`console-shell ${f?"is-map-fullscreen":""}`,children:[u.jsx(kR,{state:e}),u.jsxs(RT,{children:[u.jsx(Ya,{path:"/",element:u.jsx(tb,{to:"/operations",replace:!0})}),u.jsx(Ya,{path:"/operations",element:u.jsx(xP,{state:e})}),u.jsx(Ya,{path:"/carrier-settings",element:u.jsx(Hj,{})}),u.jsx(Ya,{path:"/settings",element:u.jsx(yI,{})}),u.jsx(Ya,{path:"*",element:u.jsx(tb,{to:"/operations",replace:!0})})]}),u.jsx(fR,{state:e}),u.jsx(VR,{state:e}),u.jsx(uR,{state:e}),u.jsx(bR,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}const RP=3e4;let $u=1e3,Uu=null;function U2(){Uu!==null&&clearTimeout(Uu);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const s=JSON.parse(i.data);LP(s.operation)&&L3(s.operation)}catch{}}),e.onopen=()=>{$u=1e3},e.onerror=()=>{e.close(),Uu=setTimeout(()=>{Uu=null,$u=Math.min($u*2,RP),Si().then(xi).catch(()=>{}).finally(U2)},$u)}}function LP(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}globalThis.__fleetConsoleRuntime__={react:rh,"react/jsx-runtime":V5,"@fleet-console/sdk/plugin/browser":pk,"@fleet-console/sdk/settings/browser":Sk,"@fleet-console/sdk/operations/browser":nk,"@fleet-console/sdk/notifications/browser":wk,"@fleet-console/sdk/react/browser":Ek};try{const e=await u2();Ux(e.theme)}catch{}const MP=await fj();U2();const GS=document.querySelector("#app");GS&&Mk.createRoot(GS).render(u.jsx(M.StrictMode,{children:u.jsx(QT,{basename:"/console",children:u.jsx(dj,{value:MP,children:u.jsx(AP,{})})})}));export{BD as _,NP as a,um as g,At as k,Fl as p};
|