@dotobokuri/fleet-console 1.25.0 → 1.26.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/README.md +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.mjs +41 -18
- package/dist/client/assets/{_baseUniq-CftO_qma.js → _baseUniq-DDQ9j_k8.js} +1 -1
- package/dist/client/assets/{arc-CIUNumHO.js → arc-Bfozxruz.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-TpVISJv_.js → architectureDiagram-Q4EWVU46-DCTNRtj5.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-iHi0B0P6.js → blockDiagram-DXYQGD6D-CWyPMMVT.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CYAcFDrF.js → c4Diagram-AHTNJAMY-Rt5eOwFM.js} +1 -1
- package/dist/client/assets/channel-CetR928K.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-B3Nh-xBT.js → chunk-4BX2VUAB-D4PVI1Vt.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CDbmqVYQ.js → chunk-4TB4RGXK-C1Oxcig_.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-DRXIVd03.js → chunk-55IACEB6-Cpo6RFvp.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-b05C0dVN.js → chunk-EDXVE4YY-DbsnZ6G8.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-ByrEd9CG.js → chunk-FMBD7UC4-Dbn5YbUa.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-BpEVT-V-.js → chunk-OYMX7WX6-d2kjzA4y.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-CfdhAAA9.js → chunk-QZHKN3VN-CYgkgTK2.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-Fdx8QRTs.js → chunk-YZCP3GAM-BJU26g8l.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-D0UUo5I1.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-D0UUo5I1.js +1 -0
- package/dist/client/assets/clone-kWHSuIUT.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-D8w9KovE.js → cose-bilkent-S5V4N54A-z-z1o5SL.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-D4fw7rTF.js → dagre-KV5264BT-BcXLhG5I.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-BRFcBwDM.js → diagram-5BDNPKRD-B-ws82Eu.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BKzuEau8.js → diagram-G4DWMVQ6-BmCJvW_F.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-DkqP7aZ4.js → diagram-MMDJMWI5-CpqgkpUs.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-NelXGAN3.js → diagram-TYMM5635-D9qcELVs.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-DHH5btR9.js → erDiagram-SMLLAGMA-CIrLBm_M.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-BmqHUJoi.js → flowDiagram-DWJPFMVM-Cn_vQPc6.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-BtmWEvNP.js → ganttDiagram-T4ZO3ILL-B1NSn3FS.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-B64kk9Nb.js → gitGraphDiagram-UUTBAWPF-BoFQ1joe.js} +1 -1
- package/dist/client/assets/{graph-CEjP0hvY.js → graph-CxiyRWzn.js} +1 -1
- package/dist/client/assets/index-Bf9IE54V.js +380 -0
- package/dist/client/assets/index-CjSWaFbs.css +1 -0
- package/dist/client/assets/{infoDiagram-42DDH7IO-CaTXrw5R.js → infoDiagram-42DDH7IO-o7pQ1RaC.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-D9-Ds_71.js → ishikawaDiagram-UXIWVN3A-Du1ieZFu.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-Cv4qWOhs.js → journeyDiagram-VCZTEJTY-seGxI0_P.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-CWBLcIpD.js → kanban-definition-6JOO6SKY-fMx5ietE.js} +1 -1
- package/dist/client/assets/{layout-D8eNRDnf.js → layout-BaAXqyYr.js} +1 -1
- package/dist/client/assets/{linear-lDifS_HV.js → linear-DMj40Ji6.js} +1 -1
- package/dist/client/assets/{mermaid.core-DcGkHMSR.js → mermaid.core-BdlXsBT1.js} +4 -4
- package/dist/client/assets/{min-Dz_jFvYt.js → min-s6WtGnlJ.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-F3RmDOG-.js → mindmap-definition-QFDTVHPH-MCWf_KUb.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B1fDKBcl.js → pieDiagram-DEJITSTG-BLXhYJPc.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-D93hlO3O.js → quadrantDiagram-34T5L4WZ-DNh1hAV-.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-B4wj4AQL.js → requirementDiagram-MS252O5E-CqG-OGkG.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZRwx77Xd.js → sankeyDiagram-XADWPNL6-CHhecl0F.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-COMMRNyM.js → sequenceDiagram-FGHM5R23-DVjf5Mte.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-CpBccMyi.js → stateDiagram-FHFEXIEX-SB71u-q-.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-BWyhQXqE.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-C44EI_-o.js → timeline-definition-GMOUNBTQ-BiFLtGFX.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-BiBJbCdD.js → vennDiagram-DHZGUBPP-gVVHuVaX.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-Dm5-kWNd.js → wardley-RL74JXVD-DmAOySPQ.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BjbesihY.js → wardleyDiagram-NUSXRM2D-CxDohXgj.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-5P6xhAMr.js → xychartDiagram-5P7HB3ND-CgRIIIEQ.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/fleet-plugins/file-explorer/routes.mjs +1 -1
- package/dist/fleet-plugins/terminal/routes.mjs +359 -512
- package/package.json +1 -1
- package/dist/client/assets/channel-B-2UBgQ_.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DiaCSZq-.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DiaCSZq-.js +0 -1
- package/dist/client/assets/clone-Dq4F-r1q.js +0 -1
- package/dist/client/assets/index-B3gs6ohi.js +0 -380
- package/dist/client/assets/index-DDfl_vPx.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-UCYrbaKP.js +0 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
function zx(e,t){for(var i=0;i<t.length;i++){const s=t[i];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const d=Object.getOwnPropertyDescriptor(s,a);d&&Object.defineProperty(e,a,d.get?d:{enumerable:!0,get:()=>s[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const d of a)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(a){const d={};return a.integrity&&(d.integrity=a.integrity),a.referrerPolicy&&(d.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?d.credentials="include":a.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(a){if(a.ep)return;a.ep=!0;const d=i(a);fetch(a.href,d)}})();function Qg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function K$(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var i=function s(){var a=!1;try{a=this instanceof s}catch{}return a?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 a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(i,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),i}var Ap={exports:{}},Al={};var Oy;function xT(){if(Oy)return Al;Oy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(s,a,d){var p=null;if(d!==void 0&&(p=""+d),a.key!==void 0&&(p=""+a.key),"key"in a){d={};for(var c in a)c!=="key"&&(d[c]=a[c])}else d=a;return a=d.ref,{$$typeof:e,type:s,key:p,ref:a!==void 0?a:null,props:d}}return Al.Fragment=t,Al.jsx=i,Al.jsxs=i,Al}var Dy;function wT(){return Dy||(Dy=1,Ap.exports=xT()),Ap.exports}var l=wT();const CT=Qg(l),ET=zx({__proto__:null,default:CT},[l]);var Rp={exports:{}},Ye={};var jy;function kT(){if(jy)return Ye;jy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),S=Symbol.iterator;function C(j){return j===null||typeof j!="object"?null:(j=S&&j[S]||j["@@iterator"],typeof j=="function"?j:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,_={};function b(j,G,V){this.props=j,this.context=G,this.refs=_,this.updater=V||T}b.prototype.isReactComponent={},b.prototype.setState=function(j,G){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,G,"setState")},b.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function v(){}v.prototype=b.prototype;function y(j,G,V){this.props=j,this.context=G,this.refs=_,this.updater=V||T}var k=y.prototype=new v;k.constructor=y,w(k,b.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function A(){}var N={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function I(j,G,V){var ne=V.ref;return{$$typeof:e,type:j,key:G,ref:ne!==void 0?ne:null,props:V}}function Y(j,G){return I(j.type,G,j.props)}function z(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function q(j){var G={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(V){return G[V]})}var B=/\/+/g;function W(j,G){return typeof j=="object"&&j!==null&&j.key!=null?q(""+j.key):G.toString(36)}function F(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(A,A):(j.status="pending",j.then(function(G){j.status==="pending"&&(j.status="fulfilled",j.value=G)},function(G){j.status==="pending"&&(j.status="rejected",j.reason=G)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function P(j,G,V,ne,ie){var ve=typeof j;(ve==="undefined"||ve==="boolean")&&(j=null);var ee=!1;if(j===null)ee=!0;else switch(ve){case"bigint":case"string":case"number":ee=!0;break;case"object":switch(j.$$typeof){case e:case t:ee=!0;break;case g:return ee=j._init,P(ee(j._payload),G,V,ne,ie)}}if(ee)return ie=ie(j),ee=ne===""?"."+W(j,0):ne,M(ie)?(V="",ee!=null&&(V=ee.replace(B,"$&/")+"/"),P(ie,G,V,"",function(ge){return ge})):ie!=null&&(z(ie)&&(ie=Y(ie,V+(ie.key==null||j&&j.key===ie.key?"":(""+ie.key).replace(B,"$&/")+"/")+ee)),G.push(ie)),1;ee=0;var $=ne===""?".":ne+":";if(M(j))for(var ae=0;ae<j.length;ae++)ne=j[ae],ve=$+W(ne,ae),ee+=P(ne,G,V,ve,ie);else if(ae=C(j),typeof ae=="function")for(j=ae.call(j),ae=0;!(ne=j.next()).done;)ne=ne.value,ve=$+W(ne,ae++),ee+=P(ne,G,V,ve,ie);else if(ve==="object"){if(typeof j.then=="function")return P(F(j),G,V,ne,ie);throw G=String(j),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ee}function K(j,G,V){if(j==null)return j;var ne=[],ie=0;return P(j,ne,"","",function(ve){return G.call(V,ve,ie++)}),ne}function X(j){if(j._status===-1){var G=j._result;G=G(),G.then(function(V){(j._status===0||j._status===-1)&&(j._status=1,j._result=V)},function(V){(j._status===0||j._status===-1)&&(j._status=2,j._result=V)}),j._status===-1&&(j._status=0,j._result=G)}if(j._status===1)return j._result.default;throw j._result}var O=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},H={map:K,forEach:function(j,G,V){K(j,function(){G.apply(this,arguments)},V)},count:function(j){var G=0;return K(j,function(){G++}),G},toArray:function(j){return K(j,function(G){return G})||[]},only:function(j){if(!z(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Ye.Activity=m,Ye.Children=H,Ye.Component=b,Ye.Fragment=i,Ye.Profiler=a,Ye.PureComponent=y,Ye.StrictMode=s,Ye.Suspense=h,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ye.__COMPILER_RUNTIME={__proto__:null,c:function(j){return N.H.useMemoCache(j)}},Ye.cache=function(j){return function(){return j.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function(j,G,V){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ne=w({},j.props),ie=j.key;if(G!=null)for(ve in G.key!==void 0&&(ie=""+G.key),G)!R.call(G,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&G.ref===void 0||(ne[ve]=G[ve]);var ve=arguments.length-2;if(ve===1)ne.children=V;else if(1<ve){for(var ee=Array(ve),$=0;$<ve;$++)ee[$]=arguments[$+2];ne.children=ee}return I(j.type,ie,ne)},Ye.createContext=function(j){return j={$$typeof:p,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:d,_context:j},j},Ye.createElement=function(j,G,V){var ne,ie={},ve=null;if(G!=null)for(ne in G.key!==void 0&&(ve=""+G.key),G)R.call(G,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ie[ne]=G[ne]);var ee=arguments.length-2;if(ee===1)ie.children=V;else if(1<ee){for(var $=Array(ee),ae=0;ae<ee;ae++)$[ae]=arguments[ae+2];ie.children=$}if(j&&j.defaultProps)for(ne in ee=j.defaultProps,ee)ie[ne]===void 0&&(ie[ne]=ee[ne]);return I(j,ve,ie)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(j){return{$$typeof:c,render:j}},Ye.isValidElement=z,Ye.lazy=function(j){return{$$typeof:g,_payload:{_status:-1,_result:j},_init:X}},Ye.memo=function(j,G){return{$$typeof:f,type:j,compare:G===void 0?null:G}},Ye.startTransition=function(j){var G=N.T,V={};N.T=V;try{var ne=j(),ie=N.S;ie!==null&&ie(V,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(A,O)}catch(ve){O(ve)}finally{G!==null&&V.types!==null&&(G.types=V.types),N.T=G}},Ye.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ye.use=function(j){return N.H.use(j)},Ye.useActionState=function(j,G,V){return N.H.useActionState(j,G,V)},Ye.useCallback=function(j,G){return N.H.useCallback(j,G)},Ye.useContext=function(j){return N.H.useContext(j)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(j,G){return N.H.useDeferredValue(j,G)},Ye.useEffect=function(j,G){return N.H.useEffect(j,G)},Ye.useEffectEvent=function(j){return N.H.useEffectEvent(j)},Ye.useId=function(){return N.H.useId()},Ye.useImperativeHandle=function(j,G,V){return N.H.useImperativeHandle(j,G,V)},Ye.useInsertionEffect=function(j,G){return N.H.useInsertionEffect(j,G)},Ye.useLayoutEffect=function(j,G){return N.H.useLayoutEffect(j,G)},Ye.useMemo=function(j,G){return N.H.useMemo(j,G)},Ye.useOptimistic=function(j,G){return N.H.useOptimistic(j,G)},Ye.useReducer=function(j,G,V){return N.H.useReducer(j,G,V)},Ye.useRef=function(j){return N.H.useRef(j)},Ye.useState=function(j){return N.H.useState(j)},Ye.useSyncExternalStore=function(j,G,V){return N.H.useSyncExternalStore(j,G,V)},Ye.useTransition=function(){return N.H.useTransition()},Ye.version="19.2.7",Ye}var Iy;function e_(){return Iy||(Iy=1,Rp.exports=kT()),Rp.exports}var L=e_();const TT=Qg(L),Nh=zx({__proto__:null,default:TT},[L]),AT="fc-operation-body";let ni=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function Hx(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new ni(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(LT).filter(s=>s!==null):[]}function Oh(e){const t=e;if(!t||typeof t.id!="string"||typeof t.theaterId!="string"||typeof t.type!="string"||typeof t.pluginId!="string"||typeof t.title!="string"||!t.payload||typeof t.payload!="object"||Array.isArray(t.payload)||$x(t))throw new ni(500,"Invalid operation response");return t}function $x(e){return $m(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function RT({children:e,className:t}){return l.jsx("div",{className:NT(AT,t),children:e})}function LT(e){if(!Fx(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(MT).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function MT(e){return!Fx(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 Fx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $m(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>$m(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||$m(s,t))}function NT(...e){return e.filter(t=>!!t).join(" ")}const OT=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ni,OperationBody:RT,assertOperationNode:Oh,fetchOperationCatalog:Hx,hasForbiddenBrowserPayloadKey:$x},Symbol.toStringTag,{value:"Module"}));function DT(e){return e}function jT(e){return e}function Ux(e=()=>{}){const t=new Set;return{api:{fetch:(i,s,a)=>fetch(Lp(i,s),a).then($T),subscribe:(i,s,a)=>{const d=new EventSource(Lp(i,s));d.onmessage=a;const p=()=>d.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,a,d)=>{const p=await fetch(Lp(i,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:a}),signal:d});if(!p.ok)throw new ni(p.status,`Terminal ticket request failed: ${p.status}`);const c=await p.json();if(typeof c.ticket!="string"||typeof c.ttlMs!="number")throw new ni(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 ni(s.status,`Operation create failed: ${s.status}`);const a=await s.json();return Oh(a.operation)},rename:async(i,s)=>{const a=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!a.ok)throw new ni(a.status,`Operation rename failed: ${a.status}`);const d=await a.json();return Oh(d.operation)},remove:async i=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!s.ok)throw new ni(s.status,`Operation remove failed: ${s.status}`)}},preferences:{read:(i,s)=>UT(i,s),write:(i,s)=>WT(i,s)},settings:{read:async i=>{const s=await fetch(By(i));if(!s.ok)throw new ni(s.status,`Plugin settings read failed: ${s.status}`);const d=(await s.json()).value;return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:null},write:async(i,s)=>{const a=await fetch(By(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new ni(a.status,`Plugin settings write failed: ${a.status}`)}},status:{set:()=>{},clear:()=>{}}}}function Wx(e,t){return L.useSyncExternalStore(e,t,t)}function IT(){const[e,t]=L.useState([]),i=L.useCallback(async()=>{const s=await fetch("/api/v1/operations");if(!s.ok)throw new ni(s.status,`Operations request failed: ${s.status}`);const a=await s.json();t(Array.isArray(a.operations)?a.operations.map(Oh):[])},[]);return L.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function BT(e,t){return L.useMemo(()=>({fetch:(i,s)=>e.fetch(t,i,s),subscribe:(i,s)=>e.subscribe(t,i,s)}),[e,t])}function PT(e,t){return L.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function zT(e,t,i){const[s,a]=L.useState(()=>e.read(t,i)),d=L.useCallback(p=>{a(p),e.write(t,p)},[e,t]);return[s,d]}function HT(e,t){return L.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function $T(e){if(!e.ok)throw new ni(e.status,`Plugin request failed: ${e.status}`);return e}function Lp(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new ni(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new ni(400,"Invalid plugin path");return`/plugins/${e}${i}`}const FT=/^[a-z0-9][a-z0-9._-]*$/;function By(e){if(!FT.test(e))throw new ni(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function UT(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 WT(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const GT=Object.freeze(Object.defineProperty({__proto__:null,React:Nh,createClientCapabilities:Ux,defineOperationKind:jT,definePlugin:DT,useOperationStatus:HT,useOperations:IT,usePluginApi:BT,usePluginSettings:PT,usePluginStorage:zT,useStoreSnapshot:Wx},Symbol.toStringTag,{value:"Module"}));function qT(e){return e}function KT({title:e,description:t,children:i}){return l.jsxs("section",{className:"fc-settings-card",children:[e?l.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?l.jsx("p",{className:"fc-settings-card__desc",children:t}):null,l.jsx("div",{className:"fc-settings-card__body",children:i})]})}function VT({label:e,hint:t,children:i}){const s=L.useId(),a=L.useId();return l.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":s,"aria-describedby":t?a:void 0,children:[l.jsxs("div",{className:"fc-settings-row__copy",children:[l.jsx("div",{className:"fc-settings-row__label",id:s,children:e}),t?l.jsx("div",{className:"fc-settings-row__hint",id:a,children:t}):null]}),l.jsx("div",{className:"fc-settings-row__control",children:i})]})}function YT({checked:e,onChange:t,label:i,disabled:s=!1}){const a=L.useId();return l.jsxs("label",{className:"fc-settings-toggle",htmlFor:a,children:[l.jsx("input",{id:a,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:s,"aria-label":i?void 0:"Toggle setting",onChange:d=>t(d.currentTarget.checked)}),l.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),i?l.jsx("span",{className:"fc-settings-toggle__label",children:i}):null]})}function XT({value:e,options:t,onChange:i,label:s,disabled:a=!1}){const d=L.useId(),p=l.jsx("select",{id:d,className:"fc-settings-select__control",value:e,disabled:a,"aria-label":s?void 0:"Select setting",onChange:c=>i(c.currentTarget.value),children:t.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value))});return s?l.jsxs("label",{className:"fc-settings-select",htmlFor:d,children:[l.jsx("span",{className:"fc-settings-select__label",children:s}),p]}):l.jsx("div",{className:"fc-settings-select",children:p})}function ZT({label:e,hint:t,children:i}){const s=L.useId(),a=L.useId();return l.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":s,"aria-describedby":t?a:void 0,children:[l.jsx("div",{className:"fc-settings-field__label",id:s,children:e}),t?l.jsx("div",{className:"fc-settings-field__hint",id:a,children:t}):null,l.jsx("div",{className:"fc-settings-field__control",children:i})]})}const JT=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:KT,SettingsField:ZT,SettingsRow:VT,SettingsSelect:XT,SettingsToggle:YT,defineSettingsSection:qT},Symbol.toStringTag,{value:"Module"}));function QT(e){return e}const eA=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:QT},Symbol.toStringTag,{value:"Module"})),tA=l.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class t_ extends L.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??tA:this.props.children}}const nA=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:t_,React:Nh,default:Nh},Symbol.toStringTag,{value:"Module"}));var Mp={exports:{}},Rl={},Np={exports:{}},Op={};var Py;function iA(){return Py||(Py=1,(function(e){function t(P,K){var X=P.length;P.push(K);e:for(;0<X;){var O=X-1>>>1,H=P[O];if(0<a(H,K))P[O]=K,P[X]=H,X=O;else break e}}function i(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var K=P[0],X=P.pop();if(X!==K){P[0]=X;e:for(var O=0,H=P.length,j=H>>>1;O<j;){var G=2*(O+1)-1,V=P[G],ne=G+1,ie=P[ne];if(0>a(V,X))ne<H&&0>a(ie,V)?(P[O]=ie,P[ne]=X,O=ne):(P[O]=V,P[G]=X,O=G);else if(ne<H&&0>a(ie,X))P[O]=ie,P[ne]=X,O=ne;else break e}}return K}function a(P,K){var X=P.sortIndex-K.sortIndex;return X!==0?X:P.id-K.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var p=Date,c=p.now();e.unstable_now=function(){return p.now()-c}}var h=[],f=[],g=1,m=null,S=3,C=!1,T=!1,w=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var K=i(f);K!==null;){if(K.callback===null)s(f);else if(K.startTime<=P)s(f),K.sortIndex=K.expirationTime,t(h,K);else break;K=i(f)}}function M(P){if(w=!1,k(P),!T)if(i(h)!==null)T=!0,A||(A=!0,q());else{var K=i(f);K!==null&&F(M,K.startTime-P)}}var A=!1,N=-1,R=5,I=-1;function Y(){return _?!0:!(e.unstable_now()-I<R)}function z(){if(_=!1,A){var P=e.unstable_now();I=P;var K=!0;try{e:{T=!1,w&&(w=!1,v(N),N=-1),C=!0;var X=S;try{t:{for(k(P),m=i(h);m!==null&&!(m.expirationTime>P&&Y());){var O=m.callback;if(typeof O=="function"){m.callback=null,S=m.priorityLevel;var H=O(m.expirationTime<=P);if(P=e.unstable_now(),typeof H=="function"){m.callback=H,k(P),K=!0;break t}m===i(h)&&s(h),k(P)}else s(h);m=i(h)}if(m!==null)K=!0;else{var j=i(f);j!==null&&F(M,j.startTime-P),K=!1}}break e}finally{m=null,S=X,C=!1}K=void 0}}finally{K?q():A=!1}}}var q;if(typeof y=="function")q=function(){y(z)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,W=B.port2;B.port1.onmessage=z,q=function(){W.postMessage(null)}}else q=function(){b(z,0)};function F(P,K){N=b(function(){P(e.unstable_now())},K)}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"):R=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var K=3;break;default:K=S}var X=S;S=K;try{return P()}finally{S=X}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(P,K){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var X=S;S=P;try{return K()}finally{S=X}},e.unstable_scheduleCallback=function(P,K,X){var O=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?O+X:O):X=O,P){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=X+H,P={id:g++,callback:K,priorityLevel:P,startTime:X,expirationTime:H,sortIndex:-1},X>O?(P.sortIndex=X,t(f,P),i(h)===null&&P===i(f)&&(w?(v(N),N=-1):w=!0,F(M,X-O))):(P.sortIndex=H,t(h,P),T||C||(T=!0,A||(A=!0,q()))),P},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(P){var K=S;return function(){var X=S;S=K;try{return P.apply(this,arguments)}finally{S=X}}}})(Op)),Op}var zy;function rA(){return zy||(zy=1,Np.exports=iA()),Np.exports}var Dp={exports:{}},Kn={};var Hy;function sA(){if(Hy)return Kn;Hy=1;var e=e_();function t(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)f+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+h+"; visit "+f+" 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},a=Symbol.for("react.portal");function d(h,f,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:h,containerInfo:f,implementation:g}}var p=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Kn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Kn.createPortal=function(h,f){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return d(h,f,null,g)},Kn.flushSync=function(h){var f=p.T,g=s.p;try{if(p.T=null,s.p=2,h)return h()}finally{p.T=f,s.p=g,s.d.f()}},Kn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(h,f))},Kn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Kn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var g=f.as,m=c(g,f.crossOrigin),S=typeof f.integrity=="string"?f.integrity:void 0,C=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;g==="style"?s.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:S,fetchPriority:C}):g==="script"&&s.d.X(h,{crossOrigin:m,integrity:S,fetchPriority:C,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Kn.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var g=c(f.as,f.crossOrigin);s.d.M(h,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(h)},Kn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var g=f.as,m=c(g,f.crossOrigin);s.d.L(h,g,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Kn.preloadModule=function(h,f){if(typeof h=="string")if(f){var g=c(f.as,f.crossOrigin);s.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(h)},Kn.requestFormReset=function(h){s.d.r(h)},Kn.unstable_batchedUpdates=function(h,f){return h(f)},Kn.useFormState=function(h,f,g){return p.H.useFormState(h,f,g)},Kn.useFormStatus=function(){return p.H.useHostTransitionStatus()},Kn.version="19.2.7",Kn}var $y;function Gx(){if($y)return Dp.exports;$y=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(),Dp.exports=sA(),Dp.exports}var Fy;function aA(){if(Fy)return Rl;Fy=1;var e=rA(),t=e_(),i=Gx();function s(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}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 a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function d(n){var r=n,o=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(o=r.return),n=r.return;while(n)}return r.tag===3?o: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(d(n)!==n)throw Error(s(188))}function f(n){var r=n.alternate;if(!r){if(r=d(n),r===null)throw Error(s(188));return r!==n?null:n}for(var o=n,u=r;;){var x=o.return;if(x===null)break;var E=x.alternate;if(E===null){if(u=x.return,u!==null){o=u;continue}break}if(x.child===E.child){for(E=x.child;E;){if(E===o)return h(x),n;if(E===u)return h(x),r;E=E.sibling}throw Error(s(188))}if(o.return!==u.return)o=x,u=E;else{for(var D=!1,U=x.child;U;){if(U===o){D=!0,o=x,u=E;break}if(U===u){D=!0,u=x,o=E;break}U=U.sibling}if(!D){for(U=E.child;U;){if(U===o){D=!0,o=E,u=x;break}if(U===u){D=!0,u=E,o=x;break}U=U.sibling}if(!D)throw Error(s(189))}}if(o.alternate!==u)throw Error(s(190))}if(o.tag!==3)throw Error(s(188));return o.stateNode.current===o?n:r}function g(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=g(n),r!==null)return r;n=n.sibling}return null}var m=Object.assign,S=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),y=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function q(n){return n===null||typeof n!="object"?null:(n=z&&n[z]||n["@@iterator"],typeof n=="function"?n:null)}var B=Symbol.for("react.client.reference");function W(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===B?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case b:return"Profiler";case _:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case y:return n.displayName||"Context";case v:return(n._context.displayName||"Context")+".Consumer";case k:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case N:return r=n.displayName||null,r!==null?r:W(n.type)||"Memo";case R:r=n._payload,n=n._init;try{return W(n(r))}catch{}}return null}var F=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},O=[],H=-1;function j(n){return{current:n}}function G(n){0>H||(n.current=O[H],O[H]=null,H--)}function V(n,r){H++,O[H]=n.current,n.current=r}var ne=j(null),ie=j(null),ve=j(null),ee=j(null);function $(n,r){switch(V(ve,r),V(ie,n),V(ne,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?ny(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=ny(r),n=iy(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(ne),V(ne,n)}function ae(){G(ne),G(ie),G(ve)}function ge(n){n.memoizedState!==null&&V(ee,n);var r=ne.current,o=iy(r,n.type);r!==o&&(V(ie,n),V(ne,o))}function we(n){ie.current===n&&(G(ne),G(ie)),ee.current===n&&(G(ee),Cl._currentValue=X)}var de,Ce;function Le(n){if(de===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);de=r&&r[1]||"",Ce=-1<o.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+de+n+Ce}var Me=!1;function qe(n,r){if(!n||Me)return"";Me=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(ue){var ce=ue}Reflect.construct(n,[],be)}else{try{be.call()}catch(ue){ce=ue}n.call(be.prototype)}}else{try{throw Error()}catch(ue){ce=ue}(be=n())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(ue){if(ue&&ce&&typeof ue.stack=="string")return[ue.stack,ce.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=u.DetermineComponentFrameRoot(),D=E[0],U=E[1];if(D&&U){var Q=D.split(`
|
|
4
|
+
`),le=U.split(`
|
|
5
|
+
`);for(x=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;x<le.length&&!le[x].includes("DetermineComponentFrameRoot");)x++;if(u===Q.length||x===le.length)for(u=Q.length-1,x=le.length-1;1<=u&&0<=x&&Q[u]!==le[x];)x--;for(;1<=u&&0<=x;u--,x--)if(Q[u]!==le[x]){if(u!==1||x!==1)do if(u--,x--,0>x||Q[u]!==le[x]){var fe=`
|
|
6
|
+
`+Q[u].replace(" at new "," at ");return n.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",n.displayName)),fe}while(1<=u&&0<=x);break}}}finally{Me=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Le(o):""}function ke(n,r){switch(n.tag){case 26:case 27:case 5:return Le(n.type);case 16:return Le("Lazy");case 13:return n.child!==r&&r!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return qe(n.type,!1);case 11:return qe(n.type.render,!1);case 1:return qe(n.type,!0);case 31:return Le("Activity");default:return""}}function ye(n){try{var r="",o=null;do r+=ke(n,o),o=n,n=n.return;while(n);return r}catch(u){return`
|
|
7
|
+
Error generating stack: `+u.message+`
|
|
8
|
+
`+u.stack}}var Oe=Object.prototype.hasOwnProperty,wt=e.unstable_scheduleCallback,On=e.unstable_cancelCallback,Xn=e.unstable_shouldYield,en=e.unstable_requestPaint,ft=e.unstable_now,tn=e.unstable_getCurrentPriorityLevel,Kt=e.unstable_ImmediatePriority,Ht=e.unstable_UserBlockingPriority,nn=e.unstable_NormalPriority,pn=e.unstable_LowPriority,sn=e.unstable_IdlePriority,Zn=e.log,rt=e.unstable_setDisableYieldValue,kn=null,$t=null;function Rt(n){if(typeof Zn=="function"&&rt(n),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(kn,n)}catch{}}var Lt=Math.clz32?Math.clz32:Di,wr=Math.log,wn=Math.LN2;function Di(n){return n>>>=0,n===0?32:31-(wr(n)/wn|0)|0}var Dn=256,ji=262144,Zi=4194304;function Mt(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 J(n,r,o){var u=n.pendingLanes;if(u===0)return 0;var x=0,E=n.suspendedLanes,D=n.pingedLanes;n=n.warmLanes;var U=u&134217727;return U!==0?(u=U&~E,u!==0?x=Mt(u):(D&=U,D!==0?x=Mt(D):o||(o=U&~n,o!==0&&(x=Mt(o))))):(U=u&~E,U!==0?x=Mt(U):D!==0?x=Mt(D):o||(o=u&~n,o!==0&&(x=Mt(o)))),x===0?0:r!==0&&r!==x&&(r&E)===0&&(E=x&-x,o=r&-r,E>=o||E===32&&(o&4194048)!==0)?r:x}function pe(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function xe(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var n=Zi;return Zi<<=1,(Zi&62914560)===0&&(Zi=4194304),n}function Ct(n){for(var r=[],o=0;31>o;o++)r.push(n);return r}function gt(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ne(n,r,o,u,x,E){var D=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var U=n.entanglements,Q=n.expirationTimes,le=n.hiddenUpdates;for(o=D&~o;0<o;){var fe=31-Lt(o),be=1<<fe;U[fe]=0,Q[fe]=-1;var ce=le[fe];if(ce!==null)for(le[fe]=null,fe=0;fe<ce.length;fe++){var ue=ce[fe];ue!==null&&(ue.lane&=-536870913)}o&=~be}u!==0&&Re(n,u,0),E!==0&&x===0&&n.tag!==0&&(n.suspendedLanes|=E&~(D&~r))}function Re(n,r,o){n.pendingLanes|=r,n.suspendedLanes&=~r;var u=31-Lt(r);n.entangledLanes|=r,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function Fe(n,r){var o=n.entangledLanes|=r;for(n=n.entanglements;o;){var u=31-Lt(o),x=1<<u;x&r|n[u]&r&&(n[u]|=r),o&=~x}}function Bt(n,r){var o=r&-r;return o=(o&42)!==0?1:nt(o),(o&(n.suspendedLanes|r))!==0?0:o}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 mn(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function me(){var n=K.p;return n!==0?n:(n=window.event,n===void 0?32:ky(n.type))}function ot(n,r){var o=K.p;try{return K.p=n,r()}finally{K.p=o}}var _t=Math.random().toString(36).slice(2),Ue="__reactFiber$"+_t,Ee="__reactProps$"+_t,pt="__reactContainer$"+_t,Vt="__reactEvents$"+_t,Jn="__reactListeners$"+_t,Wn="__reactHandles$"+_t,yi="__reactResources$"+_t,Gn="__reactMarker$"+_t;function je(n){delete n[Ue],delete n[Ee],delete n[Vt],delete n[Jn],delete n[Wn]}function Z(n){var r=n[Ue];if(r)return r;for(var o=n.parentNode;o;){if(r=o[pt]||o[Ue]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(n=uy(n);n!==null;){if(o=n[Ue])return o;n=uy(n)}return r}n=o,o=n.parentNode}return null}function he(n){if(n=n[Ue]||n[pt]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function Ae(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(s(33))}function Xe(n){var r=n[yi];return r||(r=n[yi]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Je(n){n[Gn]=!0}var Et=new Set,Yt={};function Xt(n,r){Se(n,r),Se(n+"Capture",r)}function Se(n,r){for(Yt[n]=r,n=0;n<r.length;n++)Et.add(r[n])}var Pe=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]*$"),ze={},vt={};function Zt(n){return Oe.call(vt,n)?!0:Oe.call(ze,n)?!1:Pe.test(n)?vt[n]=!0:(ze[n]=!0,!1)}function qn(n,r,o){if(Zt(r))if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+o)}}function Si(n,r,o){if(o===null)n.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+o)}}function ai(n,r,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(r,o,""+u)}}function zt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xi(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Dc(n,r,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var x=u.get,E=u.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return x.call(this)},set:function(D){o=""+D,E.call(this,D)}}),Object.defineProperty(n,r,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(D){o=""+D},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function ba(n){if(!n._valueTracker){var r=xi(n)?"checked":"value";n._valueTracker=Dc(n,r,""+n[r])}}function Bo(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var o=r.getValue(),u="";return n&&(u=xi(n)?n.checked?"true":"false":n.value),n=u,n!==o?(r.setValue(n),!0):!1}function ya(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 kd=/[\n"\\]/g;function oi(n){return n.replace(kd,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Po(n,r,o,u,x,E,D,U){n.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?n.type=D:n.removeAttribute("type"),r!=null?D==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+zt(r)):n.value!==""+zt(r)&&(n.value=""+zt(r)):D!=="submit"&&D!=="reset"||n.removeAttribute("value"),r!=null?Sa(n,D,zt(r)):o!=null?Sa(n,D,zt(o)):u!=null&&n.removeAttribute("value"),x==null&&E!=null&&(n.defaultChecked=!!E),x!=null&&(n.checked=x&&typeof x!="function"&&typeof x!="symbol"),U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"?n.name=""+zt(U):n.removeAttribute("name")}function Bs(n,r,o,u,x,E,D,U){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.type=E),r!=null||o!=null){if(!(E!=="submit"&&E!=="reset"||r!=null)){ba(n);return}o=o!=null?""+zt(o):"",r=r!=null?""+zt(r):o,U||r===n.value||(n.value=r),n.defaultValue=r}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=U?n.checked:!!u,n.defaultChecked=!!u,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(n.name=D),ba(n)}function Sa(n,r,o){r==="number"&&ya(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function jn(n,r,o,u){if(n=n.options,r){r={};for(var x=0;x<o.length;x++)r["$"+o[x]]=!0;for(o=0;o<n.length;o++)x=r.hasOwnProperty("$"+n[o].value),n[o].selected!==x&&(n[o].selected=x),x&&u&&(n[o].defaultSelected=!0)}else{for(o=""+zt(o),r=null,x=0;x<n.length;x++){if(n[x].value===o){n[x].selected=!0,u&&(n[x].defaultSelected=!0);return}r!==null||n[x].disabled||(r=n[x])}r!==null&&(r.selected=!0)}}function jc(n,r,o){if(r!=null&&(r=""+zt(r),r!==n.value&&(n.value=r),o==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=o!=null?""+zt(o):""}function xa(n,r,o,u){if(r==null){if(u!=null){if(o!=null)throw Error(s(92));if(F(u)){if(1<u.length)throw Error(s(93));u=u[0]}o=u}o==null&&(o=""),r=o}o=zt(r),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),ba(n)}function Ke(n,r){if(r){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=r;return}}n.textContent=r}var Ic=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function gn(n,r,o){var u=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":u?n.setProperty(r,o):typeof o!="number"||o===0||Ic.has(r)?r==="float"?n.cssFloat=o:n[r]=(""+o).trim():n[r]=o+"px"}function kt(n,r,o){if(r!=null&&typeof r!="object")throw Error(s(62));if(n=n.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var x in r)u=r[x],r.hasOwnProperty(x)&&o[x]!==u&&gn(n,x,u)}else for(var E in r)r.hasOwnProperty(E)&&gn(n,E,r[E])}function Jr(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 Cr=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"]]),zo=/^[\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 Qr(n){return zo.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Te(){}var Ie=null;function Ze(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var lt=null,rn=null;function Ii(n){var r=he(n);if(r&&(n=r.stateNode)){var o=n[Ee]||null;e:switch(n=r.stateNode,r.type){case"input":if(Po(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+oi(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var u=o[r];if(u!==n&&u.form===n.form){var x=u[Ee]||null;if(!x)throw Error(s(90));Po(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(r=0;r<o.length;r++)u=o[r],u.form===n.form&&Bo(u)}break e;case"textarea":jc(n,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&jn(n,!!o.multiple,r,!1)}}}var Ho=!1;function Bc(n,r,o){if(Ho)return n(r,o);Ho=!0;try{var u=n(r);return u}finally{if(Ho=!1,(lt!==null||rn!==null)&&(Cu(),lt&&(r=lt,n=rn,rn=lt=null,Ii(r),n)))for(r=0;r<n.length;r++)Ii(n[r])}}function $o(n,r){var o=n.stateNode;if(o===null)return null;var u=o[Ee]||null;if(u===null)return null;o=u[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":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(s(231,r,typeof o));return o}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Td=!1;if(Er)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){Td=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{Td=!1}var es=null,Ad=null,Pc=null;function iv(){if(Pc)return Pc;var n,r=Ad,o=r.length,u,x="value"in es?es.value:es.textContent,E=x.length;for(n=0;n<o&&r[n]===x[n];n++);var D=o-n;for(u=1;u<=D&&r[o-u]===x[E-u];u++);return Pc=x.slice(n,1<u?1-u:void 0)}function zc(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 Hc(){return!0}function rv(){return!1}function li(n){function r(o,u,x,E,D){this._reactName=o,this._targetInst=x,this.type=u,this.nativeEvent=E,this.target=D,this.currentTarget=null;for(var U in n)n.hasOwnProperty(U)&&(o=n[U],this[U]=o?o(E):E[U]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?Hc:rv,this.isPropagationStopped=rv,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Hc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Hc)},persist:function(){},isPersistent:Hc}),r}var Ps={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$c=li(Ps),Uo=m({},Ps,{view:0,detail:0}),y5=li(Uo),Rd,Ld,Wo,Fc=m({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nd,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!==Wo&&(Wo&&n.type==="mousemove"?(Rd=n.screenX-Wo.screenX,Ld=n.screenY-Wo.screenY):Ld=Rd=0,Wo=n),Rd)},movementY:function(n){return"movementY"in n?n.movementY:Ld}}),sv=li(Fc),S5=m({},Fc,{dataTransfer:0}),x5=li(S5),w5=m({},Uo,{relatedTarget:0}),Md=li(w5),C5=m({},Ps,{animationName:0,elapsedTime:0,pseudoElement:0}),E5=li(C5),k5=m({},Ps,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),T5=li(k5),A5=m({},Ps,{data:0}),av=li(A5),R5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},L5={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"},M5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function N5(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=M5[n])?!!r[n]:!1}function Nd(){return N5}var O5=m({},Uo,{key:function(n){if(n.key){var r=R5[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=zc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?L5[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nd,charCode:function(n){return n.type==="keypress"?zc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?zc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),D5=li(O5),j5=m({},Fc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ov=li(j5),I5=m({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nd}),B5=li(I5),P5=m({},Ps,{propertyName:0,elapsedTime:0,pseudoElement:0}),z5=li(P5),H5=m({},Fc,{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}),$5=li(H5),F5=m({},Ps,{newState:0,oldState:0}),U5=li(F5),W5=[9,13,27,32],Od=Er&&"CompositionEvent"in window,Go=null;Er&&"documentMode"in document&&(Go=document.documentMode);var G5=Er&&"TextEvent"in window&&!Go,lv=Er&&(!Od||Go&&8<Go&&11>=Go),cv=" ",uv=!1;function hv(n,r){switch(n){case"keyup":return W5.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wa=!1;function q5(n,r){switch(n){case"compositionend":return dv(r);case"keypress":return r.which!==32?null:(uv=!0,cv);case"textInput":return n=r.data,n===cv&&uv?null:n;default:return null}}function K5(n,r){if(wa)return n==="compositionend"||!Od&&hv(n,r)?(n=iv(),Pc=Ad=es=null,wa=!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 lv&&r.locale!=="ko"?null:r.data;default:return null}}var V5={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 fv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!V5[n.type]:r==="textarea"}function pv(n,r,o,u){lt?rn?rn.push(u):rn=[u]:lt=u,r=Mu(r,"onChange"),0<r.length&&(o=new $c("onChange","change",null,o,u),n.push({event:o,listeners:r}))}var qo=null,Ko=null;function Y5(n){Xb(n,0)}function Uc(n){var r=Ae(n);if(Bo(r))return n}function mv(n,r){if(n==="change")return r}var gv=!1;if(Er){var Dd;if(Er){var jd="oninput"in document;if(!jd){var _v=document.createElement("div");_v.setAttribute("oninput","return;"),jd=typeof _v.oninput=="function"}Dd=jd}else Dd=!1;gv=Dd&&(!document.documentMode||9<document.documentMode)}function vv(){qo&&(qo.detachEvent("onpropertychange",bv),Ko=qo=null)}function bv(n){if(n.propertyName==="value"&&Uc(Ko)){var r=[];pv(r,Ko,n,Ze(n)),Bc(Y5,r)}}function X5(n,r,o){n==="focusin"?(vv(),qo=r,Ko=o,qo.attachEvent("onpropertychange",bv)):n==="focusout"&&vv()}function Z5(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Uc(Ko)}function J5(n,r){if(n==="click")return Uc(r)}function Q5(n,r){if(n==="input"||n==="change")return Uc(r)}function ek(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var wi=typeof Object.is=="function"?Object.is:ek;function Vo(n,r){if(wi(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var o=Object.keys(n),u=Object.keys(r);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var x=o[u];if(!Oe.call(r,x)||!wi(n[x],r[x]))return!1}return!0}function yv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Sv(n,r){var o=yv(n);n=0;for(var u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=r&&u>=r)return{node:o,offset:r-n};n=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=yv(o)}}function xv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?xv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function wv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=ya(n.document);r instanceof n.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)n=r.contentWindow;else break;r=ya(n.document)}return r}function Id(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var tk=Er&&"documentMode"in document&&11>=document.documentMode,Ca=null,Bd=null,Yo=null,Pd=!1;function Cv(n,r,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Pd||Ca==null||Ca!==ya(u)||(u=Ca,"selectionStart"in u&&Id(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Yo&&Vo(Yo,u)||(Yo=u,u=Mu(Bd,"onSelect"),0<u.length&&(r=new $c("onSelect","select",null,r,o),n.push({event:r,listeners:u}),r.target=Ca)))}function zs(n,r){var o={};return o[n.toLowerCase()]=r.toLowerCase(),o["Webkit"+n]="webkit"+r,o["Moz"+n]="moz"+r,o}var Ea={animationend:zs("Animation","AnimationEnd"),animationiteration:zs("Animation","AnimationIteration"),animationstart:zs("Animation","AnimationStart"),transitionrun:zs("Transition","TransitionRun"),transitionstart:zs("Transition","TransitionStart"),transitioncancel:zs("Transition","TransitionCancel"),transitionend:zs("Transition","TransitionEnd")},zd={},Ev={};Er&&(Ev=document.createElement("div").style,"AnimationEvent"in window||(delete Ea.animationend.animation,delete Ea.animationiteration.animation,delete Ea.animationstart.animation),"TransitionEvent"in window||delete Ea.transitionend.transition);function Hs(n){if(zd[n])return zd[n];if(!Ea[n])return n;var r=Ea[n],o;for(o in r)if(r.hasOwnProperty(o)&&o in Ev)return zd[n]=r[o];return n}var kv=Hs("animationend"),Tv=Hs("animationiteration"),Av=Hs("animationstart"),nk=Hs("transitionrun"),ik=Hs("transitionstart"),rk=Hs("transitioncancel"),Rv=Hs("transitionend"),Lv=new Map,Hd="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(" ");Hd.push("scrollEnd");function Ji(n,r){Lv.set(n,r),Xt(r,[n])}var Wc=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)},Bi=[],ka=0,$d=0;function Gc(){for(var n=ka,r=$d=ka=0;r<n;){var o=Bi[r];Bi[r++]=null;var u=Bi[r];Bi[r++]=null;var x=Bi[r];Bi[r++]=null;var E=Bi[r];if(Bi[r++]=null,u!==null&&x!==null){var D=u.pending;D===null?x.next=x:(x.next=D.next,D.next=x),u.pending=x}E!==0&&Mv(o,x,E)}}function qc(n,r,o,u){Bi[ka++]=n,Bi[ka++]=r,Bi[ka++]=o,Bi[ka++]=u,$d|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function Fd(n,r,o,u){return qc(n,r,o,u),Kc(n)}function $s(n,r){return qc(n,null,null,r),Kc(n)}function Mv(n,r,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var x=!1,E=n.return;E!==null;)E.childLanes|=o,u=E.alternate,u!==null&&(u.childLanes|=o),E.tag===22&&(n=E.stateNode,n===null||n._visibility&1||(x=!0)),n=E,E=E.return;return n.tag===3?(E=n.stateNode,x&&r!==null&&(x=31-Lt(o),n=E.hiddenUpdates,u=n[x],u===null?n[x]=[r]:u.push(r),r.lane=o|536870912),E):null}function Kc(n){if(50<_l)throw _l=0,Jf=null,Error(s(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var Ta={};function sk(n,r,o,u){this.tag=n,this.key=o,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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ci(n,r,o,u){return new sk(n,r,o,u)}function Ud(n){return n=n.prototype,!(!n||!n.isReactComponent)}function kr(n,r){var o=n.alternate;return o===null?(o=Ci(n.tag,r,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=r,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,r=n.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function Nv(n,r){n.flags&=65011714;var o=n.alternate;return o===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=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,r=o.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function Vc(n,r,o,u,x,E){var D=0;if(u=n,typeof n=="function")Ud(n)&&(D=1);else if(typeof n=="string")D=uT(n,o,ne.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=Ci(31,o,r,x),n.elementType=I,n.lanes=E,n;case w:return Fs(o.children,x,E,r);case _:D=8,x|=24;break;case b:return n=Ci(12,o,r,x|2),n.elementType=b,n.lanes=E,n;case M:return n=Ci(13,o,r,x),n.elementType=M,n.lanes=E,n;case A:return n=Ci(19,o,r,x),n.elementType=A,n.lanes=E,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case y:D=10;break e;case v:D=9;break e;case k:D=11;break e;case N:D=14;break e;case R:D=16,u=null;break e}D=29,o=Error(s(130,n===null?"null":typeof n,"")),u=null}return r=Ci(D,o,r,x),r.elementType=n,r.type=u,r.lanes=E,r}function Fs(n,r,o,u){return n=Ci(7,n,u,r),n.lanes=o,n}function Wd(n,r,o){return n=Ci(6,n,null,r),n.lanes=o,n}function Ov(n){var r=Ci(18,null,null,0);return r.stateNode=n,r}function Gd(n,r,o){return r=Ci(4,n.children!==null?n.children:[],n.key,r),r.lanes=o,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var Dv=new WeakMap;function Pi(n,r){if(typeof n=="object"&&n!==null){var o=Dv.get(n);return o!==void 0?o:(r={value:n,source:r,stack:ye(r)},Dv.set(n,r),r)}return{value:n,source:r,stack:ye(r)}}var Aa=[],Ra=0,Yc=null,Xo=0,zi=[],Hi=0,ts=null,dr=1,fr="";function Tr(n,r){Aa[Ra++]=Xo,Aa[Ra++]=Yc,Yc=n,Xo=r}function jv(n,r,o){zi[Hi++]=dr,zi[Hi++]=fr,zi[Hi++]=ts,ts=n;var u=dr;n=fr;var x=32-Lt(u)-1;u&=~(1<<x),o+=1;var E=32-Lt(r)+x;if(30<E){var D=x-x%5;E=(u&(1<<D)-1).toString(32),u>>=D,x-=D,dr=1<<32-Lt(r)+x|o<<x|u,fr=E+n}else dr=1<<E|o<<x|u,fr=n}function qd(n){n.return!==null&&(Tr(n,1),jv(n,1,0))}function Kd(n){for(;n===Yc;)Yc=Aa[--Ra],Aa[Ra]=null,Xo=Aa[--Ra],Aa[Ra]=null;for(;n===ts;)ts=zi[--Hi],zi[Hi]=null,fr=zi[--Hi],zi[Hi]=null,dr=zi[--Hi],zi[Hi]=null}function Iv(n,r){zi[Hi++]=dr,zi[Hi++]=fr,zi[Hi++]=ts,dr=r.id,fr=r.overflow,ts=n}var In=null,Ft=null,ht=!1,ns=null,$i=!1,Vd=Error(s(519));function is(n){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zo(Pi(r,n)),Vd}function Bv(n){var r=n.stateNode,o=n.type,u=n.memoizedProps;switch(r[Ue]=n,r[Ee]=u,o){case"dialog":at("cancel",r),at("close",r);break;case"iframe":case"object":case"embed":at("load",r);break;case"video":case"audio":for(o=0;o<bl.length;o++)at(bl[o],r);break;case"source":at("error",r);break;case"img":case"image":case"link":at("error",r),at("load",r);break;case"details":at("toggle",r);break;case"input":at("invalid",r),Bs(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":at("invalid",r);break;case"textarea":at("invalid",r),xa(r,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||u.suppressHydrationWarning===!0||ey(r.textContent,o)?(u.popover!=null&&(at("beforetoggle",r),at("toggle",r)),u.onScroll!=null&&at("scroll",r),u.onScrollEnd!=null&&at("scrollend",r),u.onClick!=null&&(r.onclick=Te),r=!0):r=!1,r||is(n,!0)}function Pv(n){for(In=n.return;In;)switch(In.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:In=In.return}}function La(n){if(n!==In)return!1;if(!ht)return Pv(n),ht=!0,!1;var r=n.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||fp(n.type,n.memoizedProps)),o=!o),o&&Ft&&is(n),Pv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ft=cy(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));Ft=cy(n)}else r===27?(r=Ft,_s(n.type)?(n=vp,vp=null,Ft=n):Ft=r):Ft=In?Ui(n.stateNode.nextSibling):null;return!0}function Us(){Ft=In=null,ht=!1}function Yd(){var n=ns;return n!==null&&(di===null?di=n:di.push.apply(di,n),ns=null),n}function Zo(n){ns===null?ns=[n]:ns.push(n)}var Xd=j(null),Ws=null,Ar=null;function rs(n,r,o){V(Xd,r._currentValue),r._currentValue=o}function Rr(n){n._currentValue=Xd.current,G(Xd)}function Zd(n,r,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),n===o)break;n=n.return}}function Jd(n,r,o,u){var x=n.child;for(x!==null&&(x.return=n);x!==null;){var E=x.dependencies;if(E!==null){var D=x.child;E=E.firstContext;e:for(;E!==null;){var U=E;E=x;for(var Q=0;Q<r.length;Q++)if(U.context===r[Q]){E.lanes|=o,U=E.alternate,U!==null&&(U.lanes|=o),Zd(E.return,o,n),u||(D=null);break e}E=U.next}}else if(x.tag===18){if(D=x.return,D===null)throw Error(s(341));D.lanes|=o,E=D.alternate,E!==null&&(E.lanes|=o),Zd(D,o,n),D=null}else D=x.child;if(D!==null)D.return=x;else for(D=x;D!==null;){if(D===n){D=null;break}if(x=D.sibling,x!==null){x.return=D.return,D=x;break}D=D.return}x=D}}function Ma(n,r,o,u){n=null;for(var x=r,E=!1;x!==null;){if(!E){if((x.flags&524288)!==0)E=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var D=x.alternate;if(D===null)throw Error(s(387));if(D=D.memoizedProps,D!==null){var U=x.type;wi(x.pendingProps.value,D.value)||(n!==null?n.push(U):n=[U])}}else if(x===ee.current){if(D=x.alternate,D===null)throw Error(s(387));D.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(n!==null?n.push(Cl):n=[Cl])}x=x.return}n!==null&&Jd(r,n,o,u),r.flags|=262144}function Xc(n){for(n=n.firstContext;n!==null;){if(!wi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Gs(n){Ws=n,Ar=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Bn(n){return zv(Ws,n)}function Zc(n,r){return Ws===null&&Gs(n),zv(n,r)}function zv(n,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},Ar===null){if(n===null)throw Error(s(308));Ar=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Ar=Ar.next=r;return o}var ak=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){r.aborted=!0,n.forEach(function(o){return o()})}},ok=e.unstable_scheduleCallback,lk=e.unstable_NormalPriority,_n={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qd(){return{controller:new ak,data:new Map,refCount:0}}function Jo(n){n.refCount--,n.refCount===0&&ok(lk,function(){n.controller.abort()})}var Qo=null,ef=0,Na=0,Oa=null;function ck(n,r){if(Qo===null){var o=Qo=[];ef=0,Na=rp(),Oa={status:"pending",value:void 0,then:function(u){o.push(u)}}}return ef++,r.then(Hv,Hv),r}function Hv(){if(--ef===0&&Qo!==null){Oa!==null&&(Oa.status="fulfilled");var n=Qo;Qo=null,Na=0,Oa=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function uk(n,r){var o=[],u={status:"pending",value:null,reason:null,then:function(x){o.push(x)}};return n.then(function(){u.status="fulfilled",u.value=r;for(var x=0;x<o.length;x++)(0,o[x])(r)},function(x){for(u.status="rejected",u.reason=x,x=0;x<o.length;x++)(0,o[x])(void 0)}),u}var $v=P.S;P.S=function(n,r){Cb=ft(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&ck(n,r),$v!==null&&$v(n,r)};var qs=j(null);function tf(){var n=qs.current;return n!==null?n:Pt.pooledCache}function Jc(n,r){r===null?V(qs,qs.current):V(qs,r.pool)}function Fv(){var n=tf();return n===null?null:{parent:_n._currentValue,pool:n}}var Da=Error(s(460)),nf=Error(s(474)),Qc=Error(s(542)),eu={then:function(){}};function Uv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Wv(n,r,o){switch(o=n[o],o===void 0?n.push(r):o!==r&&(r.then(Te,Te),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,qv(n),n;default:if(typeof r.status=="string")r.then(Te,Te);else{if(n=Pt,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=r,n.status="pending",n.then(function(u){if(r.status==="pending"){var x=r;x.status="fulfilled",x.value=u}},function(u){if(r.status==="pending"){var x=r;x.status="rejected",x.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,qv(n),n}throw Vs=r,Da}}function Ks(n){try{var r=n._init;return r(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Vs=o,Da):o}}var Vs=null;function Gv(){if(Vs===null)throw Error(s(459));var n=Vs;return Vs=null,n}function qv(n){if(n===Da||n===Qc)throw Error(s(483))}var ja=null,el=0;function tu(n){var r=el;return el+=1,ja===null&&(ja=[]),Wv(ja,n,r)}function tl(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function nu(n,r){throw r.$$typeof===S?Error(s(525)):(n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function Kv(n){function r(re,te){if(n){var oe=re.deletions;oe===null?(re.deletions=[te],re.flags|=16):oe.push(te)}}function o(re,te){if(!n)return null;for(;te!==null;)r(re,te),te=te.sibling;return null}function u(re){for(var te=new Map;re!==null;)re.key!==null?te.set(re.key,re):te.set(re.index,re),re=re.sibling;return te}function x(re,te){return re=kr(re,te),re.index=0,re.sibling=null,re}function E(re,te,oe){return re.index=oe,n?(oe=re.alternate,oe!==null?(oe=oe.index,oe<te?(re.flags|=67108866,te):oe):(re.flags|=67108866,te)):(re.flags|=1048576,te)}function D(re){return n&&re.alternate===null&&(re.flags|=67108866),re}function U(re,te,oe,_e){return te===null||te.tag!==6?(te=Wd(oe,re.mode,_e),te.return=re,te):(te=x(te,oe),te.return=re,te)}function Q(re,te,oe,_e){var $e=oe.type;return $e===w?fe(re,te,oe.props.children,_e,oe.key):te!==null&&(te.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===R&&Ks($e)===te.type)?(te=x(te,oe.props),tl(te,oe),te.return=re,te):(te=Vc(oe.type,oe.key,oe.props,null,re.mode,_e),tl(te,oe),te.return=re,te)}function le(re,te,oe,_e){return te===null||te.tag!==4||te.stateNode.containerInfo!==oe.containerInfo||te.stateNode.implementation!==oe.implementation?(te=Gd(oe,re.mode,_e),te.return=re,te):(te=x(te,oe.children||[]),te.return=re,te)}function fe(re,te,oe,_e,$e){return te===null||te.tag!==7?(te=Fs(oe,re.mode,_e,$e),te.return=re,te):(te=x(te,oe),te.return=re,te)}function be(re,te,oe){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=Wd(""+te,re.mode,oe),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case C:return oe=Vc(te.type,te.key,te.props,null,re.mode,oe),tl(oe,te),oe.return=re,oe;case T:return te=Gd(te,re.mode,oe),te.return=re,te;case R:return te=Ks(te),be(re,te,oe)}if(F(te)||q(te))return te=Fs(te,re.mode,oe,null),te.return=re,te;if(typeof te.then=="function")return be(re,tu(te),oe);if(te.$$typeof===y)return be(re,Zc(re,te),oe);nu(re,te)}return null}function ce(re,te,oe,_e){var $e=te!==null?te.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return $e!==null?null:U(re,te,""+oe,_e);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case C:return oe.key===$e?Q(re,te,oe,_e):null;case T:return oe.key===$e?le(re,te,oe,_e):null;case R:return oe=Ks(oe),ce(re,te,oe,_e)}if(F(oe)||q(oe))return $e!==null?null:fe(re,te,oe,_e,null);if(typeof oe.then=="function")return ce(re,te,tu(oe),_e);if(oe.$$typeof===y)return ce(re,te,Zc(re,oe),_e);nu(re,oe)}return null}function ue(re,te,oe,_e,$e){if(typeof _e=="string"&&_e!==""||typeof _e=="number"||typeof _e=="bigint")return re=re.get(oe)||null,U(te,re,""+_e,$e);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case C:return re=re.get(_e.key===null?oe:_e.key)||null,Q(te,re,_e,$e);case T:return re=re.get(_e.key===null?oe:_e.key)||null,le(te,re,_e,$e);case R:return _e=Ks(_e),ue(re,te,oe,_e,$e)}if(F(_e)||q(_e))return re=re.get(oe)||null,fe(te,re,_e,$e,null);if(typeof _e.then=="function")return ue(re,te,oe,tu(_e),$e);if(_e.$$typeof===y)return ue(re,te,oe,Zc(te,_e),$e);nu(te,_e)}return null}function De(re,te,oe,_e){for(var $e=null,bt=null,Be=te,et=te=0,ut=null;Be!==null&&et<oe.length;et++){Be.index>et?(ut=Be,Be=null):ut=Be.sibling;var yt=ce(re,Be,oe[et],_e);if(yt===null){Be===null&&(Be=ut);break}n&&Be&&yt.alternate===null&&r(re,Be),te=E(yt,te,et),bt===null?$e=yt:bt.sibling=yt,bt=yt,Be=ut}if(et===oe.length)return o(re,Be),ht&&Tr(re,et),$e;if(Be===null){for(;et<oe.length;et++)Be=be(re,oe[et],_e),Be!==null&&(te=E(Be,te,et),bt===null?$e=Be:bt.sibling=Be,bt=Be);return ht&&Tr(re,et),$e}for(Be=u(Be);et<oe.length;et++)ut=ue(Be,re,et,oe[et],_e),ut!==null&&(n&&ut.alternate!==null&&Be.delete(ut.key===null?et:ut.key),te=E(ut,te,et),bt===null?$e=ut:bt.sibling=ut,bt=ut);return n&&Be.forEach(function(xs){return r(re,xs)}),ht&&Tr(re,et),$e}function Ge(re,te,oe,_e){if(oe==null)throw Error(s(151));for(var $e=null,bt=null,Be=te,et=te=0,ut=null,yt=oe.next();Be!==null&&!yt.done;et++,yt=oe.next()){Be.index>et?(ut=Be,Be=null):ut=Be.sibling;var xs=ce(re,Be,yt.value,_e);if(xs===null){Be===null&&(Be=ut);break}n&&Be&&xs.alternate===null&&r(re,Be),te=E(xs,te,et),bt===null?$e=xs:bt.sibling=xs,bt=xs,Be=ut}if(yt.done)return o(re,Be),ht&&Tr(re,et),$e;if(Be===null){for(;!yt.done;et++,yt=oe.next())yt=be(re,yt.value,_e),yt!==null&&(te=E(yt,te,et),bt===null?$e=yt:bt.sibling=yt,bt=yt);return ht&&Tr(re,et),$e}for(Be=u(Be);!yt.done;et++,yt=oe.next())yt=ue(Be,re,et,yt.value,_e),yt!==null&&(n&&yt.alternate!==null&&Be.delete(yt.key===null?et:yt.key),te=E(yt,te,et),bt===null?$e=yt:bt.sibling=yt,bt=yt);return n&&Be.forEach(function(ST){return r(re,ST)}),ht&&Tr(re,et),$e}function Dt(re,te,oe,_e){if(typeof oe=="object"&&oe!==null&&oe.type===w&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case C:e:{for(var $e=oe.key;te!==null;){if(te.key===$e){if($e=oe.type,$e===w){if(te.tag===7){o(re,te.sibling),_e=x(te,oe.props.children),_e.return=re,re=_e;break e}}else if(te.elementType===$e||typeof $e=="object"&&$e!==null&&$e.$$typeof===R&&Ks($e)===te.type){o(re,te.sibling),_e=x(te,oe.props),tl(_e,oe),_e.return=re,re=_e;break e}o(re,te);break}else r(re,te);te=te.sibling}oe.type===w?(_e=Fs(oe.props.children,re.mode,_e,oe.key),_e.return=re,re=_e):(_e=Vc(oe.type,oe.key,oe.props,null,re.mode,_e),tl(_e,oe),_e.return=re,re=_e)}return D(re);case T:e:{for($e=oe.key;te!==null;){if(te.key===$e)if(te.tag===4&&te.stateNode.containerInfo===oe.containerInfo&&te.stateNode.implementation===oe.implementation){o(re,te.sibling),_e=x(te,oe.children||[]),_e.return=re,re=_e;break e}else{o(re,te);break}else r(re,te);te=te.sibling}_e=Gd(oe,re.mode,_e),_e.return=re,re=_e}return D(re);case R:return oe=Ks(oe),Dt(re,te,oe,_e)}if(F(oe))return De(re,te,oe,_e);if(q(oe)){if($e=q(oe),typeof $e!="function")throw Error(s(150));return oe=$e.call(oe),Ge(re,te,oe,_e)}if(typeof oe.then=="function")return Dt(re,te,tu(oe),_e);if(oe.$$typeof===y)return Dt(re,te,Zc(re,oe),_e);nu(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,te!==null&&te.tag===6?(o(re,te.sibling),_e=x(te,oe),_e.return=re,re=_e):(o(re,te),_e=Wd(oe,re.mode,_e),_e.return=re,re=_e),D(re)):o(re,te)}return function(re,te,oe,_e){try{el=0;var $e=Dt(re,te,oe,_e);return ja=null,$e}catch(Be){if(Be===Da||Be===Qc)throw Be;var bt=Ci(29,Be,null,re.mode);return bt.lanes=_e,bt.return=re,bt}}}var Ys=Kv(!0),Vv=Kv(!1),ss=!1;function rf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sf(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 as(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function os(n,r,o){var u=n.updateQueue;if(u===null)return null;if(u=u.shared,(xt&2)!==0){var x=u.pending;return x===null?r.next=r:(r.next=x.next,x.next=r),u.pending=r,r=Kc(n),Mv(n,null,o),r}return qc(n,u,r,o),Kc(n)}function nl(n,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var u=r.lanes;u&=n.pendingLanes,o|=u,r.lanes=o,Fe(n,o)}}function af(n,r){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var x=null,E=null;if(o=o.firstBaseUpdate,o!==null){do{var D={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};E===null?x=E=D:E=E.next=D,o=o.next}while(o!==null);E===null?x=E=r:E=E.next=r}else x=E=r;o={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:E,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=r:n.next=r,o.lastBaseUpdate=r}var of=!1;function il(){if(of){var n=Oa;if(n!==null)throw n}}function rl(n,r,o,u){of=!1;var x=n.updateQueue;ss=!1;var E=x.firstBaseUpdate,D=x.lastBaseUpdate,U=x.shared.pending;if(U!==null){x.shared.pending=null;var Q=U,le=Q.next;Q.next=null,D===null?E=le:D.next=le,D=Q;var fe=n.alternate;fe!==null&&(fe=fe.updateQueue,U=fe.lastBaseUpdate,U!==D&&(U===null?fe.firstBaseUpdate=le:U.next=le,fe.lastBaseUpdate=Q))}if(E!==null){var be=x.baseState;D=0,fe=le=Q=null,U=E;do{var ce=U.lane&-536870913,ue=ce!==U.lane;if(ue?(ct&ce)===ce:(u&ce)===ce){ce!==0&&ce===Na&&(of=!0),fe!==null&&(fe=fe.next={lane:0,tag:U.tag,payload:U.payload,callback:null,next:null});e:{var De=n,Ge=U;ce=r;var Dt=o;switch(Ge.tag){case 1:if(De=Ge.payload,typeof De=="function"){be=De.call(Dt,be,ce);break e}be=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ge.payload,ce=typeof De=="function"?De.call(Dt,be,ce):De,ce==null)break e;be=m({},be,ce);break e;case 2:ss=!0}}ce=U.callback,ce!==null&&(n.flags|=64,ue&&(n.flags|=8192),ue=x.callbacks,ue===null?x.callbacks=[ce]:ue.push(ce))}else ue={lane:ce,tag:U.tag,payload:U.payload,callback:U.callback,next:null},fe===null?(le=fe=ue,Q=be):fe=fe.next=ue,D|=ce;if(U=U.next,U===null){if(U=x.shared.pending,U===null)break;ue=U,U=ue.next,ue.next=null,x.lastBaseUpdate=ue,x.shared.pending=null}}while(!0);fe===null&&(Q=be),x.baseState=Q,x.firstBaseUpdate=le,x.lastBaseUpdate=fe,E===null&&(x.shared.lanes=0),ds|=D,n.lanes=D,n.memoizedState=be}}function Yv(n,r){if(typeof n!="function")throw Error(s(191,n));n.call(r)}function Xv(n,r){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)Yv(o[n],r)}var Ia=j(null),iu=j(0);function Zv(n,r){n=Pr,V(iu,n),V(Ia,r),Pr=n|r.baseLanes}function lf(){V(iu,Pr),V(Ia,Ia.current)}function cf(){Pr=iu.current,G(Ia),G(iu)}var Ei=j(null),Fi=null;function ls(n){var r=n.alternate;V(dn,dn.current&1),V(Ei,n),Fi===null&&(r===null||Ia.current!==null||r.memoizedState!==null)&&(Fi=n)}function uf(n){V(dn,dn.current),V(Ei,n),Fi===null&&(Fi=n)}function Jv(n){n.tag===22?(V(dn,dn.current),V(Ei,n),Fi===null&&(Fi=n)):cs()}function cs(){V(dn,dn.current),V(Ei,Ei.current)}function ki(n){G(Ei),Fi===n&&(Fi=null),G(dn)}var dn=j(0);function ru(n){for(var r=n;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||gp(o)||_p(o)))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 Lr=0,Qe=null,Nt=null,vn=null,su=!1,Ba=!1,Xs=!1,au=0,sl=0,Pa=null,hk=0;function an(){throw Error(s(321))}function hf(n,r){if(r===null)return!1;for(var o=0;o<r.length&&o<n.length;o++)if(!wi(n[o],r[o]))return!1;return!0}function df(n,r,o,u,x,E){return Lr=E,Qe=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,P.H=n===null||n.memoizedState===null?j0:Tf,Xs=!1,E=o(u,x),Xs=!1,Ba&&(E=e0(r,o,u,x)),Qv(n),E}function Qv(n){P.H=ll;var r=Nt!==null&&Nt.next!==null;if(Lr=0,vn=Nt=Qe=null,su=!1,sl=0,Pa=null,r)throw Error(s(300));n===null||bn||(n=n.dependencies,n!==null&&Xc(n)&&(bn=!0))}function e0(n,r,o,u){Qe=n;var x=0;do{if(Ba&&(Pa=null),sl=0,Ba=!1,25<=x)throw Error(s(301));if(x+=1,vn=Nt=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=I0,E=r(o,u)}while(Ba);return E}function dk(){var n=P.H,r=n.useState()[0];return r=typeof r.then=="function"?al(r):r,n=n.useState()[0],(Nt!==null?Nt.memoizedState:null)!==n&&(Qe.flags|=1024),r}function ff(){var n=au!==0;return au=0,n}function pf(n,r,o){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~o}function mf(n){if(su){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}su=!1}Lr=0,vn=Nt=Qe=null,Ba=!1,sl=au=0,Pa=null}function Qn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Qe.memoizedState=vn=n:vn=vn.next=n,vn}function fn(){if(Nt===null){var n=Qe.alternate;n=n!==null?n.memoizedState:null}else n=Nt.next;var r=vn===null?Qe.memoizedState:vn.next;if(r!==null)vn=r,Nt=n;else{if(n===null)throw Qe.alternate===null?Error(s(467)):Error(s(310));Nt=n,n={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},vn===null?Qe.memoizedState=vn=n:vn=vn.next=n}return vn}function ou(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function al(n){var r=sl;return sl+=1,Pa===null&&(Pa=[]),n=Wv(Pa,n,r),r=Qe,(vn===null?r.memoizedState:vn.next)===null&&(r=r.alternate,P.H=r===null||r.memoizedState===null?j0:Tf),n}function lu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return al(n);if(n.$$typeof===y)return Bn(n)}throw Error(s(438,String(n)))}function gf(n){var r=null,o=Qe.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var u=Qe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(x){return x.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=ou(),Qe.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(n),u=0;u<n;u++)o[u]=Y;return r.index++,o}function Mr(n,r){return typeof r=="function"?r(n):r}function cu(n){var r=fn();return _f(r,Nt,n)}function _f(n,r,o){var u=n.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=o;var x=n.baseQueue,E=u.pending;if(E!==null){if(x!==null){var D=x.next;x.next=E.next,E.next=D}r.baseQueue=x=E,u.pending=null}if(E=n.baseState,x===null)n.memoizedState=E;else{r=x.next;var U=D=null,Q=null,le=r,fe=!1;do{var be=le.lane&-536870913;if(be!==le.lane?(ct&be)===be:(Lr&be)===be){var ce=le.revertLane;if(ce===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),be===Na&&(fe=!0);else if((Lr&ce)===ce){le=le.next,ce===Na&&(fe=!0);continue}else be={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(U=Q=be,D=E):Q=Q.next=be,Qe.lanes|=ce,ds|=ce;be=le.action,Xs&&o(E,be),E=le.hasEagerState?le.eagerState:o(E,be)}else ce={lane:be,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},Q===null?(U=Q=ce,D=E):Q=Q.next=ce,Qe.lanes|=be,ds|=be;le=le.next}while(le!==null&&le!==r);if(Q===null?D=E:Q.next=U,!wi(E,n.memoizedState)&&(bn=!0,fe&&(o=Oa,o!==null)))throw o;n.memoizedState=E,n.baseState=D,n.baseQueue=Q,u.lastRenderedState=E}return x===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function vf(n){var r=fn(),o=r.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=n;var u=o.dispatch,x=o.pending,E=r.memoizedState;if(x!==null){o.pending=null;var D=x=x.next;do E=n(E,D.action),D=D.next;while(D!==x);wi(E,r.memoizedState)||(bn=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),o.lastRenderedState=E}return[E,u]}function t0(n,r,o){var u=Qe,x=fn(),E=ht;if(E){if(o===void 0)throw Error(s(407));o=o()}else o=r();var D=!wi((Nt||x).memoizedState,o);if(D&&(x.memoizedState=o,bn=!0),x=x.queue,Sf(r0.bind(null,u,x,n),[n]),x.getSnapshot!==r||D||vn!==null&&vn.memoizedState.tag&1){if(u.flags|=2048,za(9,{destroy:void 0},i0.bind(null,u,x,o,r),null),Pt===null)throw Error(s(349));E||(Lr&127)!==0||n0(u,r,o)}return o}function n0(n,r,o){n.flags|=16384,n={getSnapshot:r,value:o},r=Qe.updateQueue,r===null?(r=ou(),Qe.updateQueue=r,r.stores=[n]):(o=r.stores,o===null?r.stores=[n]:o.push(n))}function i0(n,r,o,u){r.value=o,r.getSnapshot=u,s0(r)&&a0(n)}function r0(n,r,o){return o(function(){s0(r)&&a0(n)})}function s0(n){var r=n.getSnapshot;n=n.value;try{var o=r();return!wi(n,o)}catch{return!0}}function a0(n){var r=$s(n,2);r!==null&&fi(r,n,2)}function bf(n){var r=Qn();if(typeof n=="function"){var o=n;if(n=o(),Xs){Rt(!0);try{o()}finally{Rt(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:n},r}function o0(n,r,o,u){return n.baseState=o,_f(n,Nt,typeof u=="function"?u:Mr)}function fk(n,r,o,u,x){if(du(n))throw Error(s(485));if(n=r.action,n!==null){var E={payload:x,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){E.listeners.push(D)}};P.T!==null?o(!0):E.isTransition=!1,u(E),o=r.pending,o===null?(E.next=r.pending=E,l0(r,E)):(E.next=o.next,r.pending=o.next=E)}}function l0(n,r){var o=r.action,u=r.payload,x=n.state;if(r.isTransition){var E=P.T,D={};P.T=D;try{var U=o(x,u),Q=P.S;Q!==null&&Q(D,U),c0(n,r,U)}catch(le){yf(n,r,le)}finally{E!==null&&D.types!==null&&(E.types=D.types),P.T=E}}else try{E=o(x,u),c0(n,r,E)}catch(le){yf(n,r,le)}}function c0(n,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){u0(n,r,u)},function(u){return yf(n,r,u)}):u0(n,r,o)}function u0(n,r,o){r.status="fulfilled",r.value=o,h0(r),n.state=o,r=n.pending,r!==null&&(o=r.next,o===r?n.pending=null:(o=o.next,r.next=o,l0(n,o)))}function yf(n,r,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=o,h0(r),r=r.next;while(r!==u)}n.action=null}function h0(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function d0(n,r){return r}function f0(n,r){if(ht){var o=Pt.formState;if(o!==null){e:{var u=Qe;if(ht){if(Ft){t:{for(var x=Ft,E=$i;x.nodeType!==8;){if(!E){x=null;break t}if(x=Ui(x.nextSibling),x===null){x=null;break t}}E=x.data,x=E==="F!"||E==="F"?x:null}if(x){Ft=Ui(x.nextSibling),u=x.data==="F!";break e}}is(u)}u=!1}u&&(r=o[0])}}return o=Qn(),o.memoizedState=o.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d0,lastRenderedState:r},o.queue=u,o=N0.bind(null,Qe,u),u.dispatch=o,u=bf(!1),E=kf.bind(null,Qe,!1,u.queue),u=Qn(),x={state:r,dispatch:null,action:n,pending:null},u.queue=x,o=fk.bind(null,Qe,x,E,o),x.dispatch=o,u.memoizedState=n,[r,o,!1]}function p0(n){var r=fn();return m0(r,Nt,n)}function m0(n,r,o){if(r=_f(n,r,d0)[0],n=cu(Mr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=al(r)}catch(D){throw D===Da?Qc:D}else u=r;r=fn();var x=r.queue,E=x.dispatch;return o!==r.memoizedState&&(Qe.flags|=2048,za(9,{destroy:void 0},pk.bind(null,x,o),null)),[u,E,n]}function pk(n,r){n.action=r}function g0(n){var r=fn(),o=Nt;if(o!==null)return m0(r,o,n);fn(),r=r.memoizedState,o=fn();var u=o.queue.dispatch;return o.memoizedState=n,[r,u,!1]}function za(n,r,o,u){return n={tag:n,create:o,deps:u,inst:r,next:null},r=Qe.updateQueue,r===null&&(r=ou(),Qe.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,r.lastEffect=n),n}function _0(){return fn().memoizedState}function uu(n,r,o,u){var x=Qn();Qe.flags|=n,x.memoizedState=za(1|r,{destroy:void 0},o,u===void 0?null:u)}function hu(n,r,o,u){var x=fn();u=u===void 0?null:u;var E=x.memoizedState.inst;Nt!==null&&u!==null&&hf(u,Nt.memoizedState.deps)?x.memoizedState=za(r,E,o,u):(Qe.flags|=n,x.memoizedState=za(1|r,E,o,u))}function v0(n,r){uu(8390656,8,n,r)}function Sf(n,r){hu(2048,8,n,r)}function mk(n){Qe.flags|=4;var r=Qe.updateQueue;if(r===null)r=ou(),Qe.updateQueue=r,r.events=[n];else{var o=r.events;o===null?r.events=[n]:o.push(n)}}function b0(n){var r=fn().memoizedState;return mk({ref:r,nextImpl:n}),function(){if((xt&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function y0(n,r){return hu(4,2,n,r)}function S0(n,r){return hu(4,4,n,r)}function x0(n,r){if(typeof r=="function"){n=n();var o=r(n);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function w0(n,r,o){o=o!=null?o.concat([n]):null,hu(4,4,x0.bind(null,r,n),o)}function xf(){}function C0(n,r){var o=fn();r=r===void 0?null:r;var u=o.memoizedState;return r!==null&&hf(r,u[1])?u[0]:(o.memoizedState=[n,r],n)}function E0(n,r){var o=fn();r=r===void 0?null:r;var u=o.memoizedState;if(r!==null&&hf(r,u[1]))return u[0];if(u=n(),Xs){Rt(!0);try{n()}finally{Rt(!1)}}return o.memoizedState=[u,r],u}function wf(n,r,o){return o===void 0||(Lr&1073741824)!==0&&(ct&261930)===0?n.memoizedState=r:(n.memoizedState=o,n=kb(),Qe.lanes|=n,ds|=n,o)}function k0(n,r,o,u){return wi(o,r)?o:Ia.current!==null?(n=wf(n,o,u),wi(n,r)||(bn=!0),n):(Lr&42)===0||(Lr&1073741824)!==0&&(ct&261930)===0?(bn=!0,n.memoizedState=o):(n=kb(),Qe.lanes|=n,ds|=n,r)}function T0(n,r,o,u,x){var E=K.p;K.p=E!==0&&8>E?E:8;var D=P.T,U={};P.T=U,kf(n,!1,r,o);try{var Q=x(),le=P.S;if(le!==null&&le(U,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=uk(Q,u);ol(n,r,fe,Ri(n))}else ol(n,r,u,Ri(n))}catch(be){ol(n,r,{then:function(){},status:"rejected",reason:be},Ri())}finally{K.p=E,D!==null&&U.types!==null&&(D.types=U.types),P.T=D}}function gk(){}function Cf(n,r,o,u){if(n.tag!==5)throw Error(s(476));var x=A0(n).queue;T0(n,x,r,X,o===null?gk:function(){return R0(n),o(u)})}function A0(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:X},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:o},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function R0(n){var r=A0(n);r.next===null&&(r=n.alternate.memoizedState),ol(n,r.next.queue,{},Ri())}function Ef(){return Bn(Cl)}function L0(){return fn().memoizedState}function M0(){return fn().memoizedState}function _k(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var o=Ri();n=as(o);var u=os(r,n,o);u!==null&&(fi(u,r,o),nl(u,r,o)),r={cache:Qd()},n.payload=r;return}r=r.return}}function vk(n,r,o){var u=Ri();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},du(n)?O0(r,o):(o=Fd(n,r,o,u),o!==null&&(fi(o,n,u),D0(o,r,u)))}function N0(n,r,o){var u=Ri();ol(n,r,o,u)}function ol(n,r,o,u){var x={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(du(n))O0(r,x);else{var E=n.alternate;if(n.lanes===0&&(E===null||E.lanes===0)&&(E=r.lastRenderedReducer,E!==null))try{var D=r.lastRenderedState,U=E(D,o);if(x.hasEagerState=!0,x.eagerState=U,wi(U,D))return qc(n,r,x,0),Pt===null&&Gc(),!1}catch{}if(o=Fd(n,r,x,u),o!==null)return fi(o,n,u),D0(o,r,u),!0}return!1}function kf(n,r,o,u){if(u={lane:2,revertLane:rp(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},du(n)){if(r)throw Error(s(479))}else r=Fd(n,o,u,2),r!==null&&fi(r,n,2)}function du(n){var r=n.alternate;return n===Qe||r!==null&&r===Qe}function O0(n,r){Ba=su=!0;var o=n.pending;o===null?r.next=r:(r.next=o.next,o.next=r),n.pending=r}function D0(n,r,o){if((o&4194048)!==0){var u=r.lanes;u&=n.pendingLanes,o|=u,r.lanes=o,Fe(n,o)}}var ll={readContext:Bn,use:lu,useCallback:an,useContext:an,useEffect:an,useImperativeHandle:an,useLayoutEffect:an,useInsertionEffect:an,useMemo:an,useReducer:an,useRef:an,useState:an,useDebugValue:an,useDeferredValue:an,useTransition:an,useSyncExternalStore:an,useId:an,useHostTransitionStatus:an,useFormState:an,useActionState:an,useOptimistic:an,useMemoCache:an,useCacheRefresh:an};ll.useEffectEvent=an;var j0={readContext:Bn,use:lu,useCallback:function(n,r){return Qn().memoizedState=[n,r===void 0?null:r],n},useContext:Bn,useEffect:v0,useImperativeHandle:function(n,r,o){o=o!=null?o.concat([n]):null,uu(4194308,4,x0.bind(null,r,n),o)},useLayoutEffect:function(n,r){return uu(4194308,4,n,r)},useInsertionEffect:function(n,r){uu(4,2,n,r)},useMemo:function(n,r){var o=Qn();r=r===void 0?null:r;var u=n();if(Xs){Rt(!0);try{n()}finally{Rt(!1)}}return o.memoizedState=[u,r],u},useReducer:function(n,r,o){var u=Qn();if(o!==void 0){var x=o(r);if(Xs){Rt(!0);try{o(r)}finally{Rt(!1)}}}else x=r;return u.memoizedState=u.baseState=x,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:x},u.queue=n,n=n.dispatch=vk.bind(null,Qe,n),[u.memoizedState,n]},useRef:function(n){var r=Qn();return n={current:n},r.memoizedState=n},useState:function(n){n=bf(n);var r=n.queue,o=N0.bind(null,Qe,r);return r.dispatch=o,[n.memoizedState,o]},useDebugValue:xf,useDeferredValue:function(n,r){var o=Qn();return wf(o,n,r)},useTransition:function(){var n=bf(!1);return n=T0.bind(null,Qe,n.queue,!0,!1),Qn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,o){var u=Qe,x=Qn();if(ht){if(o===void 0)throw Error(s(407));o=o()}else{if(o=r(),Pt===null)throw Error(s(349));(ct&127)!==0||n0(u,r,o)}x.memoizedState=o;var E={value:o,getSnapshot:r};return x.queue=E,v0(r0.bind(null,u,E,n),[n]),u.flags|=2048,za(9,{destroy:void 0},i0.bind(null,u,E,o,r),null),o},useId:function(){var n=Qn(),r=Pt.identifierPrefix;if(ht){var o=fr,u=dr;o=(u&~(1<<32-Lt(u)-1)).toString(32)+o,r="_"+r+"R_"+o,o=au++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=hk++,r="_"+r+"r_"+o.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Ef,useFormState:f0,useActionState:f0,useOptimistic:function(n){var r=Qn();r.memoizedState=r.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=kf.bind(null,Qe,!0,o),o.dispatch=r,[n,r]},useMemoCache:gf,useCacheRefresh:function(){return Qn().memoizedState=_k.bind(null,Qe)},useEffectEvent:function(n){var r=Qn(),o={impl:n};return r.memoizedState=o,function(){if((xt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},Tf={readContext:Bn,use:lu,useCallback:C0,useContext:Bn,useEffect:Sf,useImperativeHandle:w0,useInsertionEffect:y0,useLayoutEffect:S0,useMemo:E0,useReducer:cu,useRef:_0,useState:function(){return cu(Mr)},useDebugValue:xf,useDeferredValue:function(n,r){var o=fn();return k0(o,Nt.memoizedState,n,r)},useTransition:function(){var n=cu(Mr)[0],r=fn().memoizedState;return[typeof n=="boolean"?n:al(n),r]},useSyncExternalStore:t0,useId:L0,useHostTransitionStatus:Ef,useFormState:p0,useActionState:p0,useOptimistic:function(n,r){var o=fn();return o0(o,Nt,n,r)},useMemoCache:gf,useCacheRefresh:M0};Tf.useEffectEvent=b0;var I0={readContext:Bn,use:lu,useCallback:C0,useContext:Bn,useEffect:Sf,useImperativeHandle:w0,useInsertionEffect:y0,useLayoutEffect:S0,useMemo:E0,useReducer:vf,useRef:_0,useState:function(){return vf(Mr)},useDebugValue:xf,useDeferredValue:function(n,r){var o=fn();return Nt===null?wf(o,n,r):k0(o,Nt.memoizedState,n,r)},useTransition:function(){var n=vf(Mr)[0],r=fn().memoizedState;return[typeof n=="boolean"?n:al(n),r]},useSyncExternalStore:t0,useId:L0,useHostTransitionStatus:Ef,useFormState:g0,useActionState:g0,useOptimistic:function(n,r){var o=fn();return Nt!==null?o0(o,Nt,n,r):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:gf,useCacheRefresh:M0};I0.useEffectEvent=b0;function Af(n,r,o,u){r=n.memoizedState,o=o(u,r),o=o==null?r:m({},r,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Rf={enqueueSetState:function(n,r,o){n=n._reactInternals;var u=Ri(),x=as(u);x.payload=r,o!=null&&(x.callback=o),r=os(n,x,u),r!==null&&(fi(r,n,u),nl(r,n,u))},enqueueReplaceState:function(n,r,o){n=n._reactInternals;var u=Ri(),x=as(u);x.tag=1,x.payload=r,o!=null&&(x.callback=o),r=os(n,x,u),r!==null&&(fi(r,n,u),nl(r,n,u))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var o=Ri(),u=as(o);u.tag=2,r!=null&&(u.callback=r),r=os(n,u,o),r!==null&&(fi(r,n,o),nl(r,n,o))}};function B0(n,r,o,u,x,E,D){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,E,D):r.prototype&&r.prototype.isPureReactComponent?!Vo(o,u)||!Vo(x,E):!0}function P0(n,r,o,u){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,u),r.state!==n&&Rf.enqueueReplaceState(r,r.state,null)}function Zs(n,r){var o=r;if("ref"in r){o={};for(var u in r)u!=="ref"&&(o[u]=r[u])}if(n=n.defaultProps){o===r&&(o=m({},o));for(var x in n)o[x]===void 0&&(o[x]=n[x])}return o}function z0(n){Wc(n)}function H0(n){console.error(n)}function $0(n){Wc(n)}function fu(n,r){try{var o=n.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function F0(n,r,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Lf(n,r,o){return o=as(o),o.tag=3,o.payload={element:null},o.callback=function(){fu(n,r)},o}function U0(n){return n=as(n),n.tag=3,n}function W0(n,r,o,u){var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var E=u.value;n.payload=function(){return x(E)},n.callback=function(){F0(r,o,u)}}var D=o.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(n.callback=function(){F0(r,o,u),typeof x!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var U=u.stack;this.componentDidCatch(u.value,{componentStack:U!==null?U:""})})}function bk(n,r,o,u,x){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=o.alternate,r!==null&&Ma(r,o,x,!0),o=Ei.current,o!==null){switch(o.tag){case 31:case 13:return Fi===null?Eu():o.alternate===null&&on===0&&(on=3),o.flags&=-257,o.flags|=65536,o.lanes=x,u===eu?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([u]):r.add(u),tp(n,u,x)),!1;case 22:return o.flags|=65536,u===eu?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([u]):o.add(u)),tp(n,u,x)),!1}throw Error(s(435,o.tag))}return tp(n,u,x),Eu(),!1}if(ht)return r=Ei.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=x,u!==Vd&&(n=Error(s(422),{cause:u}),Zo(Pi(n,o)))):(u!==Vd&&(r=Error(s(423),{cause:u}),Zo(Pi(r,o))),n=n.current.alternate,n.flags|=65536,x&=-x,n.lanes|=x,u=Pi(u,o),x=Lf(n.stateNode,u,x),af(n,x),on!==4&&(on=2)),!1;var E=Error(s(520),{cause:u});if(E=Pi(E,o),gl===null?gl=[E]:gl.push(E),on!==4&&(on=2),r===null)return!0;u=Pi(u,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,n=x&-x,o.lanes|=n,n=Lf(o.stateNode,u,n),af(o,n),!1;case 1:if(r=o.type,E=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(fs===null||!fs.has(E))))return o.flags|=65536,x&=-x,o.lanes|=x,x=U0(x),W0(x,n,o,u),af(o,x),!1}o=o.return}while(o!==null);return!1}var Mf=Error(s(461)),bn=!1;function Pn(n,r,o,u){r.child=n===null?Vv(r,null,o,u):Ys(r,n.child,o,u)}function G0(n,r,o,u,x){o=o.render;var E=r.ref;if("ref"in u){var D={};for(var U in u)U!=="ref"&&(D[U]=u[U])}else D=u;return Gs(r),u=df(n,r,o,D,E,x),U=ff(),n!==null&&!bn?(pf(n,r,x),Nr(n,r,x)):(ht&&U&&qd(r),r.flags|=1,Pn(n,r,u,x),r.child)}function q0(n,r,o,u,x){if(n===null){var E=o.type;return typeof E=="function"&&!Ud(E)&&E.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=E,K0(n,r,E,u,x)):(n=Vc(o.type,null,u,r,r.mode,x),n.ref=r.ref,n.return=r,r.child=n)}if(E=n.child,!zf(n,x)){var D=E.memoizedProps;if(o=o.compare,o=o!==null?o:Vo,o(D,u)&&n.ref===r.ref)return Nr(n,r,x)}return r.flags|=1,n=kr(E,u),n.ref=r.ref,n.return=r,r.child=n}function K0(n,r,o,u,x){if(n!==null){var E=n.memoizedProps;if(Vo(E,u)&&n.ref===r.ref)if(bn=!1,r.pendingProps=u=E,zf(n,x))(n.flags&131072)!==0&&(bn=!0);else return r.lanes=n.lanes,Nr(n,r,x)}return Nf(n,r,o,u,x)}function V0(n,r,o,u){var x=u.children,E=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(E=E!==null?E.baseLanes|o:o,n!==null){for(u=r.child=n.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~E}else u=0,r.child=null;return Y0(n,r,E,o,u)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Jc(r,E!==null?E.cachePool:null),E!==null?Zv(r,E):lf(),Jv(r);else return u=r.lanes=536870912,Y0(n,r,E!==null?E.baseLanes|o:o,o,u)}else E!==null?(Jc(r,E.cachePool),Zv(r,E),cs(),r.memoizedState=null):(n!==null&&Jc(r,null),lf(),cs());return Pn(n,r,x,o),r.child}function cl(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Y0(n,r,o,u,x){var E=tf();return E=E===null?null:{parent:_n._currentValue,pool:E},r.memoizedState={baseLanes:o,cachePool:E},n!==null&&Jc(r,null),lf(),Jv(r),n!==null&&Ma(n,r,u,!0),r.childLanes=x,null}function pu(n,r){return r=gu({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function X0(n,r,o){return Ys(r,n.child,null,o),n=pu(r,r.pendingProps),n.flags|=2,ki(r),r.memoizedState=null,n}function yk(n,r,o){var u=r.pendingProps,x=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ht){if(u.mode==="hidden")return n=pu(r,u),r.lanes=536870912,cl(null,n);if(uf(r),(n=Ft)?(n=ly(n,$i),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:ts!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},o=Ov(n),o.return=r,r.child=o,In=r,Ft=null)):n=null,n===null)throw is(r);return r.lanes=536870912,null}return pu(r,u)}var E=n.memoizedState;if(E!==null){var D=E.dehydrated;if(uf(r),x)if(r.flags&256)r.flags&=-257,r=X0(n,r,o);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(s(558));else if(bn||Ma(n,r,o,!1),x=(o&n.childLanes)!==0,bn||x){if(u=Pt,u!==null&&(D=Bt(u,o),D!==0&&D!==E.retryLane))throw E.retryLane=D,$s(n,D),fi(u,n,D),Mf;Eu(),r=X0(n,r,o)}else n=E.treeContext,Ft=Ui(D.nextSibling),In=r,ht=!0,ns=null,$i=!1,n!==null&&Iv(r,n),r=pu(r,u),r.flags|=4096;return r}return n=kr(n.child,{mode:u.mode,children:u.children}),n.ref=r.ref,r.child=n,n.return=r,n}function mu(n,r){var o=r.ref;if(o===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(n===null||n.ref!==o)&&(r.flags|=4194816)}}function Nf(n,r,o,u,x){return Gs(r),o=df(n,r,o,u,void 0,x),u=ff(),n!==null&&!bn?(pf(n,r,x),Nr(n,r,x)):(ht&&u&&qd(r),r.flags|=1,Pn(n,r,o,x),r.child)}function Z0(n,r,o,u,x,E){return Gs(r),r.updateQueue=null,o=e0(r,u,o,x),Qv(n),u=ff(),n!==null&&!bn?(pf(n,r,E),Nr(n,r,E)):(ht&&u&&qd(r),r.flags|=1,Pn(n,r,o,E),r.child)}function J0(n,r,o,u,x){if(Gs(r),r.stateNode===null){var E=Ta,D=o.contextType;typeof D=="object"&&D!==null&&(E=Bn(D)),E=new o(u,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Rf,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=u,E.state=r.memoizedState,E.refs={},rf(r),D=o.contextType,E.context=typeof D=="object"&&D!==null?Bn(D):Ta,E.state=r.memoizedState,D=o.getDerivedStateFromProps,typeof D=="function"&&(Af(r,o,D,u),E.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(D=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),D!==E.state&&Rf.enqueueReplaceState(E,E.state,null),rl(r,u,E,x),il(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(n===null){E=r.stateNode;var U=r.memoizedProps,Q=Zs(o,U);E.props=Q;var le=E.context,fe=o.contextType;D=Ta,typeof fe=="object"&&fe!==null&&(D=Bn(fe));var be=o.getDerivedStateFromProps;fe=typeof be=="function"||typeof E.getSnapshotBeforeUpdate=="function",U=r.pendingProps!==U,fe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(U||le!==D)&&P0(r,E,u,D),ss=!1;var ce=r.memoizedState;E.state=ce,rl(r,u,E,x),il(),le=r.memoizedState,U||ce!==le||ss?(typeof be=="function"&&(Af(r,o,be,u),le=r.memoizedState),(Q=ss||B0(r,o,Q,u,ce,le,D))?(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=u,r.memoizedState=le),E.props=u,E.state=le,E.context=D,u=Q):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{E=r.stateNode,sf(n,r),D=r.memoizedProps,fe=Zs(o,D),E.props=fe,be=r.pendingProps,ce=E.context,le=o.contextType,Q=Ta,typeof le=="object"&&le!==null&&(Q=Bn(le)),U=o.getDerivedStateFromProps,(le=typeof U=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(D!==be||ce!==Q)&&P0(r,E,u,Q),ss=!1,ce=r.memoizedState,E.state=ce,rl(r,u,E,x),il();var ue=r.memoizedState;D!==be||ce!==ue||ss||n!==null&&n.dependencies!==null&&Xc(n.dependencies)?(typeof U=="function"&&(Af(r,o,U,u),ue=r.memoizedState),(fe=ss||B0(r,o,fe,u,ce,ue,Q)||n!==null&&n.dependencies!==null&&Xc(n.dependencies))?(le||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(u,ue,Q),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(u,ue,Q)),typeof E.componentDidUpdate=="function"&&(r.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof E.componentDidUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=ue),E.props=u,E.state=ue,E.context=Q,u=fe):(typeof E.componentDidUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||D===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),u=!1)}return E=u,mu(n,r),u=(r.flags&128)!==0,E||u?(E=r.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:E.render(),r.flags|=1,n!==null&&u?(r.child=Ys(r,n.child,null,x),r.child=Ys(r,null,o,x)):Pn(n,r,o,x),r.memoizedState=E.state,n=r.child):n=Nr(n,r,x),n}function Q0(n,r,o,u){return Us(),r.flags|=256,Pn(n,r,o,u),r.child}var Of={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Df(n){return{baseLanes:n,cachePool:Fv()}}function jf(n,r,o){return n=n!==null?n.childLanes&~o:0,r&&(n|=Ai),n}function eb(n,r,o){var u=r.pendingProps,x=!1,E=(r.flags&128)!==0,D;if((D=E)||(D=n!==null&&n.memoizedState===null?!1:(dn.current&2)!==0),D&&(x=!0,r.flags&=-129),D=(r.flags&32)!==0,r.flags&=-33,n===null){if(ht){if(x?ls(r):cs(),(n=Ft)?(n=ly(n,$i),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:ts!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},o=Ov(n),o.return=r,r.child=o,In=r,Ft=null)):n=null,n===null)throw is(r);return _p(n)?r.lanes=32:r.lanes=536870912,null}var U=u.children;return u=u.fallback,x?(cs(),x=r.mode,U=gu({mode:"hidden",children:U},x),u=Fs(u,x,o,null),U.return=r,u.return=r,U.sibling=u,r.child=U,u=r.child,u.memoizedState=Df(o),u.childLanes=jf(n,D,o),r.memoizedState=Of,cl(null,u)):(ls(r),If(r,U))}var Q=n.memoizedState;if(Q!==null&&(U=Q.dehydrated,U!==null)){if(E)r.flags&256?(ls(r),r.flags&=-257,r=Bf(n,r,o)):r.memoizedState!==null?(cs(),r.child=n.child,r.flags|=128,r=null):(cs(),U=u.fallback,x=r.mode,u=gu({mode:"visible",children:u.children},x),U=Fs(U,x,o,null),U.flags|=2,u.return=r,U.return=r,u.sibling=U,r.child=u,Ys(r,n.child,null,o),u=r.child,u.memoizedState=Df(o),u.childLanes=jf(n,D,o),r.memoizedState=Of,r=cl(null,u));else if(ls(r),_p(U)){if(D=U.nextSibling&&U.nextSibling.dataset,D)var le=D.dgst;D=le,u=Error(s(419)),u.stack="",u.digest=D,Zo({value:u,source:null,stack:null}),r=Bf(n,r,o)}else if(bn||Ma(n,r,o,!1),D=(o&n.childLanes)!==0,bn||D){if(D=Pt,D!==null&&(u=Bt(D,o),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,$s(n,u),fi(D,n,u),Mf;gp(U)||Eu(),r=Bf(n,r,o)}else gp(U)?(r.flags|=192,r.child=n.child,r=null):(n=Q.treeContext,Ft=Ui(U.nextSibling),In=r,ht=!0,ns=null,$i=!1,n!==null&&Iv(r,n),r=If(r,u.children),r.flags|=4096);return r}return x?(cs(),U=u.fallback,x=r.mode,Q=n.child,le=Q.sibling,u=kr(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,le!==null?U=kr(le,U):(U=Fs(U,x,o,null),U.flags|=2),U.return=r,u.return=r,u.sibling=U,r.child=u,cl(null,u),u=r.child,U=n.child.memoizedState,U===null?U=Df(o):(x=U.cachePool,x!==null?(Q=_n._currentValue,x=x.parent!==Q?{parent:Q,pool:Q}:x):x=Fv(),U={baseLanes:U.baseLanes|o,cachePool:x}),u.memoizedState=U,u.childLanes=jf(n,D,o),r.memoizedState=Of,cl(n.child,u)):(ls(r),o=n.child,n=o.sibling,o=kr(o,{mode:"visible",children:u.children}),o.return=r,o.sibling=null,n!==null&&(D=r.deletions,D===null?(r.deletions=[n],r.flags|=16):D.push(n)),r.child=o,r.memoizedState=null,o)}function If(n,r){return r=gu({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function gu(n,r){return n=Ci(22,n,null,r),n.lanes=0,n}function Bf(n,r,o){return Ys(r,n.child,null,o),n=If(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function tb(n,r,o){n.lanes|=r;var u=n.alternate;u!==null&&(u.lanes|=r),Zd(n.return,r,o)}function Pf(n,r,o,u,x,E){var D=n.memoizedState;D===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:x,treeForkCount:E}:(D.isBackwards=r,D.rendering=null,D.renderingStartTime=0,D.last=u,D.tail=o,D.tailMode=x,D.treeForkCount=E)}function nb(n,r,o){var u=r.pendingProps,x=u.revealOrder,E=u.tail;u=u.children;var D=dn.current,U=(D&2)!==0;if(U?(D=D&1|2,r.flags|=128):D&=1,V(dn,D),Pn(n,r,u,o),u=ht?Xo:0,!U&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&tb(n,o,r);else if(n.tag===19)tb(n,o,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(x){case"forwards":for(o=r.child,x=null;o!==null;)n=o.alternate,n!==null&&ru(n)===null&&(x=o),o=o.sibling;o=x,o===null?(x=r.child,r.child=null):(x=o.sibling,o.sibling=null),Pf(r,!1,x,o,E,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,x=r.child,r.child=null;x!==null;){if(n=x.alternate,n!==null&&ru(n)===null){r.child=x;break}n=x.sibling,x.sibling=o,o=x,x=n}Pf(r,!0,o,null,E,u);break;case"together":Pf(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function Nr(n,r,o){if(n!==null&&(r.dependencies=n.dependencies),ds|=r.lanes,(o&r.childLanes)===0)if(n!==null){if(Ma(n,r,o,!1),(o&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,o=kr(n,n.pendingProps),r.child=o,o.return=r;n.sibling!==null;)n=n.sibling,o=o.sibling=kr(n,n.pendingProps),o.return=r;o.sibling=null}return r.child}function zf(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Xc(n)))}function Sk(n,r,o){switch(r.tag){case 3:$(r,r.stateNode.containerInfo),rs(r,_n,n.memoizedState.cache),Us();break;case 27:case 5:ge(r);break;case 4:$(r,r.stateNode.containerInfo);break;case 10:rs(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,uf(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(ls(r),r.flags|=128,null):(o&r.child.childLanes)!==0?eb(n,r,o):(ls(r),n=Nr(n,r,o),n!==null?n.sibling:null);ls(r);break;case 19:var x=(n.flags&128)!==0;if(u=(o&r.childLanes)!==0,u||(Ma(n,r,o,!1),u=(o&r.childLanes)!==0),x){if(u)return nb(n,r,o);r.flags|=128}if(x=r.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),V(dn,dn.current),u)break;return null;case 22:return r.lanes=0,V0(n,r,o,r.pendingProps);case 24:rs(r,_n,n.memoizedState.cache)}return Nr(n,r,o)}function ib(n,r,o){if(n!==null)if(n.memoizedProps!==r.pendingProps)bn=!0;else{if(!zf(n,o)&&(r.flags&128)===0)return bn=!1,Sk(n,r,o);bn=(n.flags&131072)!==0}else bn=!1,ht&&(r.flags&1048576)!==0&&jv(r,Xo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(n=Ks(r.elementType),r.type=n,typeof n=="function")Ud(n)?(u=Zs(n,u),r.tag=1,r=J0(null,r,n,u,o)):(r.tag=0,r=Nf(null,r,n,u,o));else{if(n!=null){var x=n.$$typeof;if(x===k){r.tag=11,r=G0(null,r,n,u,o);break e}else if(x===N){r.tag=14,r=q0(null,r,n,u,o);break e}}throw r=W(n)||n,Error(s(306,r,""))}}return r;case 0:return Nf(n,r,r.type,r.pendingProps,o);case 1:return u=r.type,x=Zs(u,r.pendingProps),J0(n,r,u,x,o);case 3:e:{if($(r,r.stateNode.containerInfo),n===null)throw Error(s(387));u=r.pendingProps;var E=r.memoizedState;x=E.element,sf(n,r),rl(r,u,null,o);var D=r.memoizedState;if(u=D.cache,rs(r,_n,u),u!==E.cache&&Jd(r,[_n],o,!0),il(),u=D.element,E.isDehydrated)if(E={element:u,isDehydrated:!1,cache:D.cache},r.updateQueue.baseState=E,r.memoizedState=E,r.flags&256){r=Q0(n,r,u,o);break e}else if(u!==x){x=Pi(Error(s(424)),r),Zo(x),r=Q0(n,r,u,o);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Ft=Ui(n.firstChild),In=r,ht=!0,ns=null,$i=!0,o=Vv(r,null,u,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Us(),u===x){r=Nr(n,r,o);break e}Pn(n,r,u,o)}r=r.child}return r;case 26:return mu(n,r),n===null?(o=py(r.type,null,r.pendingProps,null))?r.memoizedState=o:ht||(o=r.type,n=r.pendingProps,u=Nu(ve.current).createElement(o),u[Ue]=r,u[Ee]=n,zn(u,o,n),Je(u),r.stateNode=u):r.memoizedState=py(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return ge(r),n===null&&ht&&(u=r.stateNode=hy(r.type,r.pendingProps,ve.current),In=r,$i=!0,x=Ft,_s(r.type)?(vp=x,Ft=Ui(u.firstChild)):Ft=x),Pn(n,r,r.pendingProps.children,o),mu(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ht&&((x=u=Ft)&&(u=Zk(u,r.type,r.pendingProps,$i),u!==null?(r.stateNode=u,In=r,Ft=Ui(u.firstChild),$i=!1,x=!0):x=!1),x||is(r)),ge(r),x=r.type,E=r.pendingProps,D=n!==null?n.memoizedProps:null,u=E.children,fp(x,E)?u=null:D!==null&&fp(x,D)&&(r.flags|=32),r.memoizedState!==null&&(x=df(n,r,dk,null,null,o),Cl._currentValue=x),mu(n,r),Pn(n,r,u,o),r.child;case 6:return n===null&&ht&&((n=o=Ft)&&(o=Jk(o,r.pendingProps,$i),o!==null?(r.stateNode=o,In=r,Ft=null,n=!0):n=!1),n||is(r)),null;case 13:return eb(n,r,o);case 4:return $(r,r.stateNode.containerInfo),u=r.pendingProps,n===null?r.child=Ys(r,null,u,o):Pn(n,r,u,o),r.child;case 11:return G0(n,r,r.type,r.pendingProps,o);case 7:return Pn(n,r,r.pendingProps,o),r.child;case 8:return Pn(n,r,r.pendingProps.children,o),r.child;case 12:return Pn(n,r,r.pendingProps.children,o),r.child;case 10:return u=r.pendingProps,rs(r,r.type,u.value),Pn(n,r,u.children,o),r.child;case 9:return x=r.type._context,u=r.pendingProps.children,Gs(r),x=Bn(x),u=u(x),r.flags|=1,Pn(n,r,u,o),r.child;case 14:return q0(n,r,r.type,r.pendingProps,o);case 15:return K0(n,r,r.type,r.pendingProps,o);case 19:return nb(n,r,o);case 31:return yk(n,r,o);case 22:return V0(n,r,o,r.pendingProps);case 24:return Gs(r),u=Bn(_n),n===null?(x=tf(),x===null&&(x=Pt,E=Qd(),x.pooledCache=E,E.refCount++,E!==null&&(x.pooledCacheLanes|=o),x=E),r.memoizedState={parent:u,cache:x},rf(r),rs(r,_n,x)):((n.lanes&o)!==0&&(sf(n,r),rl(r,null,null,o),il()),x=n.memoizedState,E=r.memoizedState,x.parent!==u?(x={parent:u,cache:u},r.memoizedState=x,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=x),rs(r,_n,u)):(u=E.cache,rs(r,_n,u),u!==x.cache&&Jd(r,[_n],o,!0))),Pn(n,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Or(n){n.flags|=4}function Hf(n,r,o,u,x){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(x&335544128)===x)if(n.stateNode.complete)n.flags|=8192;else if(Lb())n.flags|=8192;else throw Vs=eu,nf}else n.flags&=-16777217}function rb(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!by(r))if(Lb())n.flags|=8192;else throw Vs=eu,nf}function _u(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?He():536870912,n.lanes|=r,Ua|=r)}function ul(n,r){if(!ht)switch(n.tailMode){case"hidden":r=n.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function Ut(n){var r=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(r)for(var x=n.child;x!==null;)o|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=n,x=x.sibling;else for(x=n.child;x!==null;)o|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=n,x=x.sibling;return n.subtreeFlags|=u,n.childLanes=o,r}function xk(n,r,o){var u=r.pendingProps;switch(Kd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(r),null;case 1:return Ut(r),null;case 3:return o=r.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Rr(_n),ae(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(La(r)?Or(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Yd())),Ut(r),null;case 26:var x=r.type,E=r.memoizedState;return n===null?(Or(r),E!==null?(Ut(r),rb(r,E)):(Ut(r),Hf(r,x,null,u,o))):E?E!==n.memoizedState?(Or(r),Ut(r),rb(r,E)):(Ut(r),r.flags&=-16777217):(n=n.memoizedProps,n!==u&&Or(r),Ut(r),Hf(r,x,n,u,o)),null;case 27:if(we(r),o=ve.current,x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&Or(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Ut(r),null}n=ne.current,La(r)?Bv(r):(n=hy(x,u,o),r.stateNode=n,Or(r))}return Ut(r),null;case 5:if(we(r),x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==u&&Or(r);else{if(!u){if(r.stateNode===null)throw Error(s(166));return Ut(r),null}if(E=ne.current,La(r))Bv(r);else{var D=Nu(ve.current);switch(E){case 1:E=D.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:E=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":E=D.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":E=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":E=D.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof u.is=="string"?D.createElement("select",{is:u.is}):D.createElement("select"),u.multiple?E.multiple=!0:u.size&&(E.size=u.size);break;default:E=typeof u.is=="string"?D.createElement(x,{is:u.is}):D.createElement(x)}}E[Ue]=r,E[Ee]=u;e:for(D=r.child;D!==null;){if(D.tag===5||D.tag===6)E.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===r)break e;for(;D.sibling===null;){if(D.return===null||D.return===r)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}r.stateNode=E;e:switch(zn(E,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Or(r)}}return Ut(r),Hf(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,o),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==u&&Or(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(s(166));if(n=ve.current,La(r)){if(n=r.stateNode,o=r.memoizedProps,u=null,x=In,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}n[Ue]=r,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||ey(n.nodeValue,o)),n||is(r,!0)}else n=Nu(n).createTextNode(u),n[Ue]=r,r.stateNode=n}return Ut(r),null;case 31:if(o=r.memoizedState,n===null||n.memoizedState!==null){if(u=La(r),o!==null){if(n===null){if(!u)throw Error(s(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[Ue]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ut(r),n=!1}else o=Yd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return r.flags&256?(ki(r),r):(ki(r),null);if((r.flags&128)!==0)throw Error(s(558))}return Ut(r),null;case 13:if(u=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(x=La(r),u!==null&&u.dehydrated!==null){if(n===null){if(!x)throw Error(s(318));if(x=r.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(s(317));x[Ue]=r}else Us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ut(r),x=!1}else x=Yd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=x),x=!0;if(!x)return r.flags&256?(ki(r),r):(ki(r),null)}return ki(r),(r.flags&128)!==0?(r.lanes=o,r):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=r.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),E=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(E=u.memoizedState.cachePool.pool),E!==x&&(u.flags|=2048)),o!==n&&o&&(r.child.flags|=8192),_u(r,r.updateQueue),Ut(r),null);case 4:return ae(),n===null&&lp(r.stateNode.containerInfo),Ut(r),null;case 10:return Rr(r.type),Ut(r),null;case 19:if(G(dn),u=r.memoizedState,u===null)return Ut(r),null;if(x=(r.flags&128)!==0,E=u.rendering,E===null)if(x)ul(u,!1);else{if(on!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(E=ru(n),E!==null){for(r.flags|=128,ul(u,!1),n=E.updateQueue,r.updateQueue=n,_u(r,n),r.subtreeFlags=0,n=o,o=r.child;o!==null;)Nv(o,n),o=o.sibling;return V(dn,dn.current&1|2),ht&&Tr(r,u.treeForkCount),r.child}n=n.sibling}u.tail!==null&&ft()>xu&&(r.flags|=128,x=!0,ul(u,!1),r.lanes=4194304)}else{if(!x)if(n=ru(E),n!==null){if(r.flags|=128,x=!0,n=n.updateQueue,r.updateQueue=n,_u(r,n),ul(u,!0),u.tail===null&&u.tailMode==="hidden"&&!E.alternate&&!ht)return Ut(r),null}else 2*ft()-u.renderingStartTime>xu&&o!==536870912&&(r.flags|=128,x=!0,ul(u,!1),r.lanes=4194304);u.isBackwards?(E.sibling=r.child,r.child=E):(n=u.last,n!==null?n.sibling=E:r.child=E,u.last=E)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=ft(),n.sibling=null,o=dn.current,V(dn,x?o&1|2:o&1),ht&&Tr(r,u.treeForkCount),n):(Ut(r),null);case 22:case 23:return ki(r),cf(),u=r.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(o&536870912)!==0&&(r.flags&128)===0&&(Ut(r),r.subtreeFlags&6&&(r.flags|=8192)):Ut(r),o=r.updateQueue,o!==null&&_u(r,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==o&&(r.flags|=2048),n!==null&&G(qs),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Rr(_n),Ut(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function wk(n,r){switch(Kd(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Rr(_n),ae(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return we(r),null;case 31:if(r.memoizedState!==null){if(ki(r),r.alternate===null)throw Error(s(340));Us()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(ki(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Us()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return G(dn),null;case 4:return ae(),null;case 10:return Rr(r.type),null;case 22:case 23:return ki(r),cf(),n!==null&&G(qs),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Rr(_n),null;case 25:return null;default:return null}}function sb(n,r){switch(Kd(r),r.tag){case 3:Rr(_n),ae();break;case 26:case 27:case 5:we(r);break;case 4:ae();break;case 31:r.memoizedState!==null&&ki(r);break;case 13:ki(r);break;case 19:G(dn);break;case 10:Rr(r.type);break;case 22:case 23:ki(r),cf(),n!==null&&G(qs);break;case 24:Rr(_n)}}function hl(n,r){try{var o=r.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var x=u.next;o=x;do{if((o.tag&n)===n){u=void 0;var E=o.create,D=o.inst;u=E(),D.destroy=u}o=o.next}while(o!==x)}}catch(U){At(r,r.return,U)}}function us(n,r,o){try{var u=r.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var E=x.next;u=E;do{if((u.tag&n)===n){var D=u.inst,U=D.destroy;if(U!==void 0){D.destroy=void 0,x=r;var Q=o,le=U;try{le()}catch(fe){At(x,Q,fe)}}}u=u.next}while(u!==E)}}catch(fe){At(r,r.return,fe)}}function ab(n){var r=n.updateQueue;if(r!==null){var o=n.stateNode;try{Xv(r,o)}catch(u){At(n,n.return,u)}}}function ob(n,r,o){o.props=Zs(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){At(n,r,u)}}function dl(n,r){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(x){At(n,r,x)}}function pr(n,r){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(x){At(n,r,x)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(x){At(n,r,x)}else o.current=null}function lb(n){var r=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(x){At(n,n.return,x)}}function $f(n,r,o){try{var u=n.stateNode;Gk(u,n.type,o,r),u[Ee]=r}catch(x){At(n,n.return,x)}}function cb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&_s(n.type)||n.tag===4}function Ff(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||cb(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&&_s(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Uf(n,r,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(n),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Te));else if(u!==4&&(u===27&&_s(n.type)&&(o=n.stateNode,r=null),n=n.child,n!==null))for(Uf(n,r,o),n=n.sibling;n!==null;)Uf(n,r,o),n=n.sibling}function vu(n,r,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,r?o.insertBefore(n,r):o.appendChild(n);else if(u!==4&&(u===27&&_s(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(vu(n,r,o),n=n.sibling;n!==null;)vu(n,r,o),n=n.sibling}function ub(n){var r=n.stateNode,o=n.memoizedProps;try{for(var u=n.type,x=r.attributes;x.length;)r.removeAttributeNode(x[0]);zn(r,u,o),r[Ue]=n,r[Ee]=o}catch(E){At(n,n.return,E)}}var Dr=!1,yn=!1,Wf=!1,hb=typeof WeakSet=="function"?WeakSet:Set,Tn=null;function Ck(n,r){if(n=n.containerInfo,hp=zu,n=wv(n),Id(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var x=u.anchorOffset,E=u.focusNode;u=u.focusOffset;try{o.nodeType,E.nodeType}catch{o=null;break e}var D=0,U=-1,Q=-1,le=0,fe=0,be=n,ce=null;t:for(;;){for(var ue;be!==o||x!==0&&be.nodeType!==3||(U=D+x),be!==E||u!==0&&be.nodeType!==3||(Q=D+u),be.nodeType===3&&(D+=be.nodeValue.length),(ue=be.firstChild)!==null;)ce=be,be=ue;for(;;){if(be===n)break t;if(ce===o&&++le===x&&(U=D),ce===E&&++fe===u&&(Q=D),(ue=be.nextSibling)!==null)break;be=ce,ce=be.parentNode}be=ue}o=U===-1||Q===-1?null:{start:U,end:Q}}else o=null}o=o||{start:0,end:0}}else o=null;for(dp={focusedElem:n,selectionRange:o},zu=!1,Tn=r;Tn!==null;)if(r=Tn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Tn=n;else for(;Tn!==null;){switch(r=Tn,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(o=0;o<n.length;o++)x=n[o],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&E!==null){n=void 0,o=r,x=E.memoizedProps,E=E.memoizedState,u=o.stateNode;try{var De=Zs(o.type,x);n=u.getSnapshotBeforeUpdate(De,E),u.__reactInternalSnapshotBeforeUpdate=n}catch(Ge){At(o,o.return,Ge)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,o=n.nodeType,o===9)mp(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":mp(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,Tn=n;break}Tn=r.return}}function db(n,r,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:Ir(n,o),u&4&&hl(5,o);break;case 1:if(Ir(n,o),u&4)if(n=o.stateNode,r===null)try{n.componentDidMount()}catch(D){At(o,o.return,D)}else{var x=Zs(o.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(x,r,n.__reactInternalSnapshotBeforeUpdate)}catch(D){At(o,o.return,D)}}u&64&&ab(o),u&512&&dl(o,o.return);break;case 3:if(Ir(n,o),u&64&&(n=o.updateQueue,n!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Xv(n,r)}catch(D){At(o,o.return,D)}}break;case 27:r===null&&u&4&&ub(o);case 26:case 5:Ir(n,o),r===null&&u&4&&lb(o),u&512&&dl(o,o.return);break;case 12:Ir(n,o);break;case 31:Ir(n,o),u&4&&mb(n,o);break;case 13:Ir(n,o),u&4&&gb(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=Ok.bind(null,o),Qk(n,o))));break;case 22:if(u=o.memoizedState!==null||Dr,!u){r=r!==null&&r.memoizedState!==null||yn,x=Dr;var E=yn;Dr=u,(yn=r)&&!E?Br(n,o,(o.subtreeFlags&8772)!==0):Ir(n,o),Dr=x,yn=E}break;case 30:break;default:Ir(n,o)}}function fb(n){var r=n.alternate;r!==null&&(n.alternate=null,fb(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&je(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 Jt=null,ci=!1;function jr(n,r,o){for(o=o.child;o!==null;)pb(n,r,o),o=o.sibling}function pb(n,r,o){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(kn,o)}catch{}switch(o.tag){case 26:yn||pr(o,r),jr(n,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:yn||pr(o,r);var u=Jt,x=ci;_s(o.type)&&(Jt=o.stateNode,ci=!1),jr(n,r,o),Sl(o.stateNode),Jt=u,ci=x;break;case 5:yn||pr(o,r);case 6:if(u=Jt,x=ci,Jt=null,jr(n,r,o),Jt=u,ci=x,Jt!==null)if(ci)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(o.stateNode)}catch(E){At(o,r,E)}else try{Jt.removeChild(o.stateNode)}catch(E){At(o,r,E)}break;case 18:Jt!==null&&(ci?(n=Jt,ay(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Za(n)):ay(Jt,o.stateNode));break;case 4:u=Jt,x=ci,Jt=o.stateNode.containerInfo,ci=!0,jr(n,r,o),Jt=u,ci=x;break;case 0:case 11:case 14:case 15:us(2,o,r),yn||us(4,o,r),jr(n,r,o);break;case 1:yn||(pr(o,r),u=o.stateNode,typeof u.componentWillUnmount=="function"&&ob(o,r,u)),jr(n,r,o);break;case 21:jr(n,r,o);break;case 22:yn=(u=yn)||o.memoizedState!==null,jr(n,r,o),yn=u;break;default:jr(n,r,o)}}function mb(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Za(n)}catch(o){At(r,r.return,o)}}}function gb(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Za(n)}catch(o){At(r,r.return,o)}}function Ek(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new hb),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new hb),r;default:throw Error(s(435,n.tag))}}function bu(n,r){var o=Ek(n);r.forEach(function(u){if(!o.has(u)){o.add(u);var x=Dk.bind(null,n,u);u.then(x,x)}})}function ui(n,r){var o=r.deletions;if(o!==null)for(var u=0;u<o.length;u++){var x=o[u],E=n,D=r,U=D;e:for(;U!==null;){switch(U.tag){case 27:if(_s(U.type)){Jt=U.stateNode,ci=!1;break e}break;case 5:Jt=U.stateNode,ci=!1;break e;case 3:case 4:Jt=U.stateNode.containerInfo,ci=!0;break e}U=U.return}if(Jt===null)throw Error(s(160));pb(E,D,x),Jt=null,ci=!1,E=x.alternate,E!==null&&(E.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)_b(r,n),r=r.sibling}var Qi=null;function _b(n,r){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ui(r,n),hi(n),u&4&&(us(3,n,n.return),hl(3,n),us(5,n,n.return));break;case 1:ui(r,n),hi(n),u&512&&(yn||o===null||pr(o,o.return)),u&64&&Dr&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var x=Qi;if(ui(r,n),hi(n),u&512&&(yn||o===null||pr(o,o.return)),u&4){var E=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,x=x.ownerDocument||x;t:switch(u){case"title":E=x.getElementsByTagName("title")[0],(!E||E[Gn]||E[Ue]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=x.createElement(u),x.head.insertBefore(E,x.querySelector("head > title"))),zn(E,u,o),E[Ue]=n,Je(E),u=E;break e;case"link":var D=_y("link","href",x).get(u+(o.href||""));if(D){for(var U=0;U<D.length;U++)if(E=D[U],E.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&E.getAttribute("rel")===(o.rel==null?null:o.rel)&&E.getAttribute("title")===(o.title==null?null:o.title)&&E.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){D.splice(U,1);break t}}E=x.createElement(u),zn(E,u,o),x.head.appendChild(E);break;case"meta":if(D=_y("meta","content",x).get(u+(o.content||""))){for(U=0;U<D.length;U++)if(E=D[U],E.getAttribute("content")===(o.content==null?null:""+o.content)&&E.getAttribute("name")===(o.name==null?null:o.name)&&E.getAttribute("property")===(o.property==null?null:o.property)&&E.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&E.getAttribute("charset")===(o.charSet==null?null:o.charSet)){D.splice(U,1);break t}}E=x.createElement(u),zn(E,u,o),x.head.appendChild(E);break;default:throw Error(s(468,u))}E[Ue]=n,Je(E),u=E}n.stateNode=u}else vy(x,n.type,n.stateNode);else n.stateNode=gy(x,u,n.memoizedProps);else E!==u?(E===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):E.count--,u===null?vy(x,n.type,n.stateNode):gy(x,u,n.memoizedProps)):u===null&&n.stateNode!==null&&$f(n,n.memoizedProps,o.memoizedProps)}break;case 27:ui(r,n),hi(n),u&512&&(yn||o===null||pr(o,o.return)),o!==null&&u&4&&$f(n,n.memoizedProps,o.memoizedProps);break;case 5:if(ui(r,n),hi(n),u&512&&(yn||o===null||pr(o,o.return)),n.flags&32){x=n.stateNode;try{Ke(x,"")}catch(De){At(n,n.return,De)}}u&4&&n.stateNode!=null&&(x=n.memoizedProps,$f(n,x,o!==null?o.memoizedProps:x)),u&1024&&(Wf=!0);break;case 6:if(ui(r,n),hi(n),u&4){if(n.stateNode===null)throw Error(s(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(De){At(n,n.return,De)}}break;case 3:if(ju=null,x=Qi,Qi=Ou(r.containerInfo),ui(r,n),Qi=x,hi(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Za(r.containerInfo)}catch(De){At(n,n.return,De)}Wf&&(Wf=!1,vb(n));break;case 4:u=Qi,Qi=Ou(n.stateNode.containerInfo),ui(r,n),hi(n),Qi=u;break;case 12:ui(r,n),hi(n);break;case 31:ui(r,n),hi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 13:ui(r,n),hi(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Su=ft()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 22:x=n.memoizedState!==null;var Q=o!==null&&o.memoizedState!==null,le=Dr,fe=yn;if(Dr=le||x,yn=fe||Q,ui(r,n),yn=fe,Dr=le,hi(n),u&8192)e:for(r=n.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,x&&(o===null||Q||Dr||yn||Js(n)),o=null,r=n;;){if(r.tag===5||r.tag===26){if(o===null){Q=o=r;try{if(E=Q.stateNode,x)D=E.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{U=Q.stateNode;var be=Q.memoizedProps.style,ce=be!=null&&be.hasOwnProperty("display")?be.display:null;U.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(De){At(Q,Q.return,De)}}}else if(r.tag===6){if(o===null){Q=r;try{Q.stateNode.nodeValue=x?"":Q.memoizedProps}catch(De){At(Q,Q.return,De)}}}else if(r.tag===18){if(o===null){Q=r;try{var ue=Q.stateNode;x?oy(ue,!0):oy(Q.stateNode,!1)}catch(De){At(Q,Q.return,De)}}}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;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,bu(n,o))));break;case 19:ui(r,n),hi(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 30:break;case 21:break;default:ui(r,n),hi(n)}}function hi(n){var r=n.flags;if(r&2){try{for(var o,u=n.return;u!==null;){if(cb(u)){o=u;break}u=u.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var x=o.stateNode,E=Ff(n);vu(n,E,x);break;case 5:var D=o.stateNode;o.flags&32&&(Ke(D,""),o.flags&=-33);var U=Ff(n);vu(n,U,D);break;case 3:case 4:var Q=o.stateNode.containerInfo,le=Ff(n);Uf(n,le,Q);break;default:throw Error(s(161))}}catch(fe){At(n,n.return,fe)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function vb(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;vb(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function Ir(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)db(n,r.alternate,r),r=r.sibling}function Js(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:us(4,r,r.return),Js(r);break;case 1:pr(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&ob(r,r.return,o),Js(r);break;case 27:Sl(r.stateNode);case 26:case 5:pr(r,r.return),Js(r);break;case 22:r.memoizedState===null&&Js(r);break;case 30:Js(r);break;default:Js(r)}n=n.sibling}}function Br(n,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,x=n,E=r,D=E.flags;switch(E.tag){case 0:case 11:case 15:Br(x,E,o),hl(4,E);break;case 1:if(Br(x,E,o),u=E,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(le){At(u,u.return,le)}if(u=E,x=u.updateQueue,x!==null){var U=u.stateNode;try{var Q=x.shared.hiddenCallbacks;if(Q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Q.length;x++)Yv(Q[x],U)}catch(le){At(u,u.return,le)}}o&&D&64&&ab(E),dl(E,E.return);break;case 27:ub(E);case 26:case 5:Br(x,E,o),o&&u===null&&D&4&&lb(E),dl(E,E.return);break;case 12:Br(x,E,o);break;case 31:Br(x,E,o),o&&D&4&&mb(x,E);break;case 13:Br(x,E,o),o&&D&4&&gb(x,E);break;case 22:E.memoizedState===null&&Br(x,E,o),dl(E,E.return);break;case 30:break;default:Br(x,E,o)}r=r.sibling}}function Gf(n,r){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Jo(o))}function qf(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Jo(n))}function er(n,r,o,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)bb(n,r,o,u),r=r.sibling}function bb(n,r,o,u){var x=r.flags;switch(r.tag){case 0:case 11:case 15:er(n,r,o,u),x&2048&&hl(9,r);break;case 1:er(n,r,o,u);break;case 3:er(n,r,o,u),x&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Jo(n)));break;case 12:if(x&2048){er(n,r,o,u),n=r.stateNode;try{var E=r.memoizedProps,D=E.id,U=E.onPostCommit;typeof U=="function"&&U(D,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){At(r,r.return,Q)}}else er(n,r,o,u);break;case 31:er(n,r,o,u);break;case 13:er(n,r,o,u);break;case 23:break;case 22:E=r.stateNode,D=r.alternate,r.memoizedState!==null?E._visibility&2?er(n,r,o,u):fl(n,r):E._visibility&2?er(n,r,o,u):(E._visibility|=2,Ha(n,r,o,u,(r.subtreeFlags&10256)!==0||!1)),x&2048&&Gf(D,r);break;case 24:er(n,r,o,u),x&2048&&qf(r.alternate,r);break;default:er(n,r,o,u)}}function Ha(n,r,o,u,x){for(x=x&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var E=n,D=r,U=o,Q=u,le=D.flags;switch(D.tag){case 0:case 11:case 15:Ha(E,D,U,Q,x),hl(8,D);break;case 23:break;case 22:var fe=D.stateNode;D.memoizedState!==null?fe._visibility&2?Ha(E,D,U,Q,x):fl(E,D):(fe._visibility|=2,Ha(E,D,U,Q,x)),x&&le&2048&&Gf(D.alternate,D);break;case 24:Ha(E,D,U,Q,x),x&&le&2048&&qf(D.alternate,D);break;default:Ha(E,D,U,Q,x)}r=r.sibling}}function fl(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=n,u=r,x=u.flags;switch(u.tag){case 22:fl(o,u),x&2048&&Gf(u.alternate,u);break;case 24:fl(o,u),x&2048&&qf(u.alternate,u);break;default:fl(o,u)}r=r.sibling}}var pl=8192;function $a(n,r,o){if(n.subtreeFlags&pl)for(n=n.child;n!==null;)yb(n,r,o),n=n.sibling}function yb(n,r,o){switch(n.tag){case 26:$a(n,r,o),n.flags&pl&&n.memoizedState!==null&&hT(o,Qi,n.memoizedState,n.memoizedProps);break;case 5:$a(n,r,o);break;case 3:case 4:var u=Qi;Qi=Ou(n.stateNode.containerInfo),$a(n,r,o),Qi=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=pl,pl=16777216,$a(n,r,o),pl=u):$a(n,r,o));break;default:$a(n,r,o)}}function Sb(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 ml(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Tn=u,wb(u,n)}Sb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)xb(n),n=n.sibling}function xb(n){switch(n.tag){case 0:case 11:case 15:ml(n),n.flags&2048&&us(9,n,n.return);break;case 3:ml(n);break;case 12:ml(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,yu(n)):ml(n);break;default:ml(n)}}function yu(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Tn=u,wb(u,n)}Sb(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:us(8,r,r.return),yu(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,yu(r));break;default:yu(r)}n=n.sibling}}function wb(n,r){for(;Tn!==null;){var o=Tn;switch(o.tag){case 0:case 11:case 15:us(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Jo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,Tn=u;else e:for(o=n;Tn!==null;){u=Tn;var x=u.sibling,E=u.return;if(fb(u),u===o){Tn=null;break e}if(x!==null){x.return=E,Tn=x;break e}Tn=E}}}var kk={getCacheForType:function(n){var r=Bn(_n),o=r.data.get(n);return o===void 0&&(o=n(),r.data.set(n,o)),o},cacheSignal:function(){return Bn(_n).controller.signal}},Tk=typeof WeakMap=="function"?WeakMap:Map,xt=0,Pt=null,st=null,ct=0,Tt=0,Ti=null,hs=!1,Fa=!1,Kf=!1,Pr=0,on=0,ds=0,Qs=0,Vf=0,Ai=0,Ua=0,gl=null,di=null,Yf=!1,Su=0,Cb=0,xu=1/0,wu=null,fs=null,Cn=0,ps=null,Wa=null,zr=0,Xf=0,Zf=null,Eb=null,_l=0,Jf=null;function Ri(){return(xt&2)!==0&&ct!==0?ct&-ct:P.T!==null?rp():me()}function kb(){if(Ai===0)if((ct&536870912)===0||ht){var n=ji;ji<<=1,(ji&3932160)===0&&(ji=262144),Ai=n}else Ai=536870912;return n=Ei.current,n!==null&&(n.flags|=32),Ai}function fi(n,r,o){(n===Pt&&(Tt===2||Tt===9)||n.cancelPendingCommit!==null)&&(Ga(n,0),ms(n,ct,Ai,!1)),gt(n,o),((xt&2)===0||n!==Pt)&&(n===Pt&&((xt&2)===0&&(Qs|=o),on===4&&ms(n,ct,Ai,!1)),mr(n))}function Tb(n,r,o){if((xt&6)!==0)throw Error(s(327));var u=!o&&(r&127)===0&&(r&n.expiredLanes)===0||pe(n,r),x=u?Lk(n,r):ep(n,r,!0),E=u;do{if(x===0){Fa&&!u&&ms(n,r,0,!1);break}else{if(o=n.current.alternate,E&&!Ak(o)){x=ep(n,r,!1),E=!1;continue}if(x===2){if(E=r,n.errorRecoveryDisabledLanes&E)var D=0;else D=n.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){r=D;e:{var U=n;x=gl;var Q=U.current.memoizedState.isDehydrated;if(Q&&(Ga(U,D).flags|=256),D=ep(U,D,!1),D!==2){if(Kf&&!Q){U.errorRecoveryDisabledLanes|=E,Qs|=E,x=4;break e}E=di,di=x,E!==null&&(di===null?di=E:di.push.apply(di,E))}x=D}if(E=!1,x!==2)continue}}if(x===1){Ga(n,0),ms(n,r,0,!0);break}e:{switch(u=n,E=x,E){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:ms(u,r,Ai,!hs);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(x=Su+300-ft(),10<x)){if(ms(u,r,Ai,!hs),J(u,0,!0)!==0)break e;zr=r,u.timeoutHandle=ry(Ab.bind(null,u,o,di,wu,Yf,r,Ai,Qs,Ua,hs,E,"Throttled",-0,0),x);break e}Ab(u,o,di,wu,Yf,r,Ai,Qs,Ua,hs,E,null,-0,0)}}break}while(!0);mr(n)}function Ab(n,r,o,u,x,E,D,U,Q,le,fe,be,ce,ue){if(n.timeoutHandle=-1,be=r.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Te},yb(r,E,be);var De=(E&62914560)===E?Su-ft():(E&4194048)===E?Cb-ft():0;if(De=dT(be,De),De!==null){zr=E,n.cancelPendingCommit=De(Ib.bind(null,n,r,E,o,u,x,D,U,Q,fe,be,null,ce,ue)),ms(n,E,D,!le);return}}Ib(n,r,E,o,u,x,D,U,Q)}function Ak(n){for(var r=n;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var x=o[u],E=x.getSnapshot;x=x.value;try{if(!wi(E(),x))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;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 ms(n,r,o,u){r&=~Vf,r&=~Qs,n.suspendedLanes|=r,n.pingedLanes&=~r,u&&(n.warmLanes|=r),u=n.expirationTimes;for(var x=r;0<x;){var E=31-Lt(x),D=1<<E;u[E]=-1,x&=~D}o!==0&&Re(n,o,r)}function Cu(){return(xt&6)===0?(vl(0),!1):!0}function Qf(){if(st!==null){if(Tt===0)var n=st.return;else n=st,Ar=Ws=null,mf(n),ja=null,el=0,n=st;for(;n!==null;)sb(n.alternate,n),n=n.return;st=null}}function Ga(n,r){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,Vk(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),zr=0,Qf(),Pt=n,st=o=kr(n.current,null),ct=r,Tt=0,Ti=null,hs=!1,Fa=pe(n,r),Kf=!1,Ua=Ai=Vf=Qs=ds=on=0,di=gl=null,Yf=!1,(r&8)!==0&&(r|=r&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=r;0<u;){var x=31-Lt(u),E=1<<x;r|=n[x],u&=~E}return Pr=r,Gc(),o}function Rb(n,r){Qe=null,P.H=ll,r===Da||r===Qc?(r=Gv(),Tt=3):r===nf?(r=Gv(),Tt=4):Tt=r===Mf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ti=r,st===null&&(on=1,fu(n,Pi(r,n.current)))}function Lb(){var n=Ei.current;return n===null?!0:(ct&4194048)===ct?Fi===null:(ct&62914560)===ct||(ct&536870912)!==0?n===Fi:!1}function Mb(){var n=P.H;return P.H=ll,n===null?ll:n}function Nb(){var n=P.A;return P.A=kk,n}function Eu(){on=4,hs||(ct&4194048)!==ct&&Ei.current!==null||(Fa=!0),(ds&134217727)===0&&(Qs&134217727)===0||Pt===null||ms(Pt,ct,Ai,!1)}function ep(n,r,o){var u=xt;xt|=2;var x=Mb(),E=Nb();(Pt!==n||ct!==r)&&(wu=null,Ga(n,r)),r=!1;var D=on;e:do try{if(Tt!==0&&st!==null){var U=st,Q=Ti;switch(Tt){case 8:Qf(),D=6;break e;case 3:case 2:case 9:case 6:Ei.current===null&&(r=!0);var le=Tt;if(Tt=0,Ti=null,qa(n,U,Q,le),o&&Fa){D=0;break e}break;default:le=Tt,Tt=0,Ti=null,qa(n,U,Q,le)}}Rk(),D=on;break}catch(fe){Rb(n,fe)}while(!0);return r&&n.shellSuspendCounter++,Ar=Ws=null,xt=u,P.H=x,P.A=E,st===null&&(Pt=null,ct=0,Gc()),D}function Rk(){for(;st!==null;)Ob(st)}function Lk(n,r){var o=xt;xt|=2;var u=Mb(),x=Nb();Pt!==n||ct!==r?(wu=null,xu=ft()+500,Ga(n,r)):Fa=pe(n,r);e:do try{if(Tt!==0&&st!==null){r=st;var E=Ti;t:switch(Tt){case 1:Tt=0,Ti=null,qa(n,r,E,1);break;case 2:case 9:if(Uv(E)){Tt=0,Ti=null,Db(r);break}r=function(){Tt!==2&&Tt!==9||Pt!==n||(Tt=7),mr(n)},E.then(r,r);break e;case 3:Tt=7;break e;case 4:Tt=5;break e;case 7:Uv(E)?(Tt=0,Ti=null,Db(r)):(Tt=0,Ti=null,qa(n,r,E,7));break;case 5:var D=null;switch(st.tag){case 26:D=st.memoizedState;case 5:case 27:var U=st;if(D?by(D):U.stateNode.complete){Tt=0,Ti=null;var Q=U.sibling;if(Q!==null)st=Q;else{var le=U.return;le!==null?(st=le,ku(le)):st=null}break t}}Tt=0,Ti=null,qa(n,r,E,5);break;case 6:Tt=0,Ti=null,qa(n,r,E,6);break;case 8:Qf(),on=6;break e;default:throw Error(s(462))}}Mk();break}catch(fe){Rb(n,fe)}while(!0);return Ar=Ws=null,P.H=u,P.A=x,xt=o,st!==null?0:(Pt=null,ct=0,Gc(),on)}function Mk(){for(;st!==null&&!Xn();)Ob(st)}function Ob(n){var r=ib(n.alternate,n,Pr);n.memoizedProps=n.pendingProps,r===null?ku(n):st=r}function Db(n){var r=n,o=r.alternate;switch(r.tag){case 15:case 0:r=Z0(o,r,r.pendingProps,r.type,void 0,ct);break;case 11:r=Z0(o,r,r.pendingProps,r.type.render,r.ref,ct);break;case 5:mf(r);default:sb(o,r),r=st=Nv(r,Pr),r=ib(o,r,Pr)}n.memoizedProps=n.pendingProps,r===null?ku(n):st=r}function qa(n,r,o,u){Ar=Ws=null,mf(r),ja=null,el=0;var x=r.return;try{if(bk(n,x,r,o,ct)){on=1,fu(n,Pi(o,n.current)),st=null;return}}catch(E){if(x!==null)throw st=x,E;on=1,fu(n,Pi(o,n.current)),st=null;return}r.flags&32768?(ht||u===1?n=!0:Fa||(ct&536870912)!==0?n=!1:(hs=n=!0,(u===2||u===9||u===3||u===6)&&(u=Ei.current,u!==null&&u.tag===13&&(u.flags|=16384))),jb(r,n)):ku(r)}function ku(n){var r=n;do{if((r.flags&32768)!==0){jb(r,hs);return}n=r.return;var o=xk(r.alternate,r,Pr);if(o!==null){st=o;return}if(r=r.sibling,r!==null){st=r;return}st=r=n}while(r!==null);on===0&&(on=5)}function jb(n,r){do{var o=wk(n.alternate,n);if(o!==null){o.flags&=32767,st=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(n=n.sibling,n!==null)){st=n;return}st=n=o}while(n!==null);on=6,st=null}function Ib(n,r,o,u,x,E,D,U,Q){n.cancelPendingCommit=null;do Tu();while(Cn!==0);if((xt&6)!==0)throw Error(s(327));if(r!==null){if(r===n.current)throw Error(s(177));if(E=r.lanes|r.childLanes,E|=$d,Ne(n,o,E,D,U,Q),n===Pt&&(st=Pt=null,ct=0),Wa=r,ps=n,zr=o,Xf=E,Zf=x,Eb=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,jk(nn,function(){return $b(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=P.T,P.T=null,x=K.p,K.p=2,D=xt,xt|=4;try{Ck(n,r,o)}finally{xt=D,K.p=x,P.T=u}}Cn=1,Bb(),Pb(),zb()}}function Bb(){if(Cn===1){Cn=0;var n=ps,r=Wa,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=P.T,P.T=null;var u=K.p;K.p=2;var x=xt;xt|=4;try{_b(r,n);var E=dp,D=wv(n.containerInfo),U=E.focusedElem,Q=E.selectionRange;if(D!==U&&U&&U.ownerDocument&&xv(U.ownerDocument.documentElement,U)){if(Q!==null&&Id(U)){var le=Q.start,fe=Q.end;if(fe===void 0&&(fe=le),"selectionStart"in U)U.selectionStart=le,U.selectionEnd=Math.min(fe,U.value.length);else{var be=U.ownerDocument||document,ce=be&&be.defaultView||window;if(ce.getSelection){var ue=ce.getSelection(),De=U.textContent.length,Ge=Math.min(Q.start,De),Dt=Q.end===void 0?Ge:Math.min(Q.end,De);!ue.extend&&Ge>Dt&&(D=Dt,Dt=Ge,Ge=D);var re=Sv(U,Ge),te=Sv(U,Dt);if(re&&te&&(ue.rangeCount!==1||ue.anchorNode!==re.node||ue.anchorOffset!==re.offset||ue.focusNode!==te.node||ue.focusOffset!==te.offset)){var oe=be.createRange();oe.setStart(re.node,re.offset),ue.removeAllRanges(),Ge>Dt?(ue.addRange(oe),ue.extend(te.node,te.offset)):(oe.setEnd(te.node,te.offset),ue.addRange(oe))}}}}for(be=[],ue=U;ue=ue.parentNode;)ue.nodeType===1&&be.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof U.focus=="function"&&U.focus(),U=0;U<be.length;U++){var _e=be[U];_e.element.scrollLeft=_e.left,_e.element.scrollTop=_e.top}}zu=!!hp,dp=hp=null}finally{xt=x,K.p=u,P.T=o}}n.current=r,Cn=2}}function Pb(){if(Cn===2){Cn=0;var n=ps,r=Wa,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=P.T,P.T=null;var u=K.p;K.p=2;var x=xt;xt|=4;try{db(n,r.alternate,r)}finally{xt=x,K.p=u,P.T=o}}Cn=3}}function zb(){if(Cn===4||Cn===3){Cn=0,en();var n=ps,r=Wa,o=zr,u=Eb;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Cn=5:(Cn=0,Wa=ps=null,Hb(n,n.pendingLanes));var x=n.pendingLanes;if(x===0&&(fs=null),mn(o),r=r.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(kn,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=P.T,x=K.p,K.p=2,P.T=null;try{for(var E=n.onRecoverableError,D=0;D<u.length;D++){var U=u[D];E(U.value,{componentStack:U.stack})}}finally{P.T=r,K.p=x}}(zr&3)!==0&&Tu(),mr(n),x=n.pendingLanes,(o&261930)!==0&&(x&42)!==0?n===Jf?_l++:(_l=0,Jf=n):_l=0,vl(0)}}function Hb(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Jo(r)))}function Tu(){return Bb(),Pb(),zb(),$b()}function $b(){if(Cn!==5)return!1;var n=ps,r=Xf;Xf=0;var o=mn(zr),u=P.T,x=K.p;try{K.p=32>o?32:o,P.T=null,o=Zf,Zf=null;var E=ps,D=zr;if(Cn=0,Wa=ps=null,zr=0,(xt&6)!==0)throw Error(s(331));var U=xt;if(xt|=4,xb(E.current),bb(E,E.current,D,o),xt=U,vl(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(kn,E)}catch{}return!0}finally{K.p=x,P.T=u,Hb(n,r)}}function Fb(n,r,o){r=Pi(o,r),r=Lf(n.stateNode,r,2),n=os(n,r,2),n!==null&&(gt(n,2),mr(n))}function At(n,r,o){if(n.tag===3)Fb(n,n,o);else for(;r!==null;){if(r.tag===3){Fb(r,n,o);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(fs===null||!fs.has(u))){n=Pi(o,n),o=U0(2),u=os(r,o,2),u!==null&&(W0(o,u,r,n),gt(u,2),mr(u));break}}r=r.return}}function tp(n,r,o){var u=n.pingCache;if(u===null){u=n.pingCache=new Tk;var x=new Set;u.set(r,x)}else x=u.get(r),x===void 0&&(x=new Set,u.set(r,x));x.has(o)||(Kf=!0,x.add(o),n=Nk.bind(null,n,r,o),r.then(n,n))}function Nk(n,r,o){var u=n.pingCache;u!==null&&u.delete(r),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,Pt===n&&(ct&o)===o&&(on===4||on===3&&(ct&62914560)===ct&&300>ft()-Su?(xt&2)===0&&Ga(n,0):Vf|=o,Ua===ct&&(Ua=0)),mr(n)}function Ub(n,r){r===0&&(r=He()),n=$s(n,r),n!==null&&(gt(n,r),mr(n))}function Ok(n){var r=n.memoizedState,o=0;r!==null&&(o=r.retryLane),Ub(n,o)}function Dk(n,r){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,x=n.memoizedState;x!==null&&(o=x.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(r),Ub(n,o)}function jk(n,r){return wt(n,r)}var Au=null,Ka=null,np=!1,Ru=!1,ip=!1,gs=0;function mr(n){n!==Ka&&n.next===null&&(Ka===null?Au=Ka=n:Ka=Ka.next=n),Ru=!0,np||(np=!0,Bk())}function vl(n,r){if(!ip&&Ru){ip=!0;do for(var o=!1,u=Au;u!==null;){if(n!==0){var x=u.pendingLanes;if(x===0)var E=0;else{var D=u.suspendedLanes,U=u.pingedLanes;E=(1<<31-Lt(42|n)+1)-1,E&=x&~(D&~U),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(o=!0,Kb(u,E))}else E=ct,E=J(u,u===Pt?E:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(E&3)===0||pe(u,E)||(o=!0,Kb(u,E));u=u.next}while(o);ip=!1}}function Ik(){Wb()}function Wb(){Ru=np=!1;var n=0;gs!==0&&Kk()&&(n=gs);for(var r=ft(),o=null,u=Au;u!==null;){var x=u.next,E=Gb(u,r);E===0?(u.next=null,o===null?Au=x:o.next=x,x===null&&(Ka=o)):(o=u,(n!==0||(E&3)!==0)&&(Ru=!0)),u=x}Cn!==0&&Cn!==5||vl(n),gs!==0&&(gs=0)}function Gb(n,r){for(var o=n.suspendedLanes,u=n.pingedLanes,x=n.expirationTimes,E=n.pendingLanes&-62914561;0<E;){var D=31-Lt(E),U=1<<D,Q=x[D];Q===-1?((U&o)===0||(U&u)!==0)&&(x[D]=xe(U,r)):Q<=r&&(n.expiredLanes|=U),E&=~U}if(r=Pt,o=ct,o=J(n,n===r?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===r&&(Tt===2||Tt===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&On(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||pe(n,o)){if(r=o&-o,r===n.callbackPriority)return r;switch(u!==null&&On(u),mn(o)){case 2:case 8:o=Ht;break;case 32:o=nn;break;case 268435456:o=sn;break;default:o=nn}return u=qb.bind(null,n),o=wt(o,u),n.callbackPriority=r,n.callbackNode=o,r}return u!==null&&u!==null&&On(u),n.callbackPriority=2,n.callbackNode=null,2}function qb(n,r){if(Cn!==0&&Cn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Tu()&&n.callbackNode!==o)return null;var u=ct;return u=J(n,n===Pt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Tb(n,u,r),Gb(n,ft()),n.callbackNode!=null&&n.callbackNode===o?qb.bind(null,n):null)}function Kb(n,r){if(Tu())return null;Tb(n,r,!0)}function Bk(){Yk(function(){(xt&6)!==0?wt(Kt,Ik):Wb()})}function rp(){if(gs===0){var n=Na;n===0&&(n=Dn,Dn<<=1,(Dn&261888)===0&&(Dn=256)),gs=n}return gs}function Vb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Qr(""+n)}function Yb(n,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,n.id&&o.setAttribute("form",n.id),r.parentNode.insertBefore(o,r),n=new FormData(n),o.parentNode.removeChild(o),n}function Pk(n,r,o,u,x){if(r==="submit"&&o&&o.stateNode===x){var E=Vb((x[Ee]||null).action),D=u.submitter;D&&(r=(r=D[Ee]||null)?Vb(r.formAction):D.getAttribute("formAction"),r!==null&&(E=r,D=null));var U=new $c("action","action",null,u,x);n.push({event:U,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(gs!==0){var Q=D?Yb(x,D):new FormData(x);Cf(o,{pending:!0,data:Q,method:x.method,action:E},null,Q)}}else typeof E=="function"&&(U.preventDefault(),Q=D?Yb(x,D):new FormData(x),Cf(o,{pending:!0,data:Q,method:x.method,action:E},E,Q))},currentTarget:x}]})}}for(var sp=0;sp<Hd.length;sp++){var ap=Hd[sp],zk=ap.toLowerCase(),Hk=ap[0].toUpperCase()+ap.slice(1);Ji(zk,"on"+Hk)}Ji(kv,"onAnimationEnd"),Ji(Tv,"onAnimationIteration"),Ji(Av,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(nk,"onTransitionRun"),Ji(ik,"onTransitionStart"),Ji(rk,"onTransitionCancel"),Ji(Rv,"onTransitionEnd"),Se("onMouseEnter",["mouseout","mouseover"]),Se("onMouseLeave",["mouseout","mouseover"]),Se("onPointerEnter",["pointerout","pointerover"]),Se("onPointerLeave",["pointerout","pointerover"]),Xt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bl="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(" "),$k=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bl));function Xb(n,r){r=(r&4)!==0;for(var o=0;o<n.length;o++){var u=n[o],x=u.event;u=u.listeners;e:{var E=void 0;if(r)for(var D=u.length-1;0<=D;D--){var U=u[D],Q=U.instance,le=U.currentTarget;if(U=U.listener,Q!==E&&x.isPropagationStopped())break e;E=U,x.currentTarget=le;try{E(x)}catch(fe){Wc(fe)}x.currentTarget=null,E=Q}else for(D=0;D<u.length;D++){if(U=u[D],Q=U.instance,le=U.currentTarget,U=U.listener,Q!==E&&x.isPropagationStopped())break e;E=U,x.currentTarget=le;try{E(x)}catch(fe){Wc(fe)}x.currentTarget=null,E=Q}}}}function at(n,r){var o=r[Vt];o===void 0&&(o=r[Vt]=new Set);var u=n+"__bubble";o.has(u)||(Zb(r,n,2,!1),o.add(u))}function op(n,r,o){var u=0;r&&(u|=4),Zb(o,n,u,r)}var Lu="_reactListening"+Math.random().toString(36).slice(2);function lp(n){if(!n[Lu]){n[Lu]=!0,Et.forEach(function(o){o!=="selectionchange"&&($k.has(o)||op(o,!1,n),op(o,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Lu]||(r[Lu]=!0,op("selectionchange",!1,r))}}function Zb(n,r,o,u){switch(ky(r)){case 2:var x=mT;break;case 8:x=gT;break;default:x=wp}o=x.bind(null,r,o,n),x=void 0,!Td||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(x=!0),u?x!==void 0?n.addEventListener(r,o,{capture:!0,passive:x}):n.addEventListener(r,o,!0):x!==void 0?n.addEventListener(r,o,{passive:x}):n.addEventListener(r,o,!1)}function cp(n,r,o,u,x){var E=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var D=u.tag;if(D===3||D===4){var U=u.stateNode.containerInfo;if(U===x)break;if(D===4)for(D=u.return;D!==null;){var Q=D.tag;if((Q===3||Q===4)&&D.stateNode.containerInfo===x)return;D=D.return}for(;U!==null;){if(D=Z(U),D===null)return;if(Q=D.tag,Q===5||Q===6||Q===26||Q===27){u=E=D;continue e}U=U.parentNode}}u=u.return}Bc(function(){var le=E,fe=Ze(o),be=[];e:{var ce=Lv.get(n);if(ce!==void 0){var ue=$c,De=n;switch(n){case"keypress":if(zc(o)===0)break e;case"keydown":case"keyup":ue=D5;break;case"focusin":De="focus",ue=Md;break;case"focusout":De="blur",ue=Md;break;case"beforeblur":case"afterblur":ue=Md;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=sv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=x5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=B5;break;case kv:case Tv:case Av:ue=E5;break;case Rv:ue=z5;break;case"scroll":case"scrollend":ue=y5;break;case"wheel":ue=$5;break;case"copy":case"cut":case"paste":ue=T5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=ov;break;case"toggle":case"beforetoggle":ue=U5}var Ge=(r&4)!==0,Dt=!Ge&&(n==="scroll"||n==="scrollend"),re=Ge?ce!==null?ce+"Capture":null:ce;Ge=[];for(var te=le,oe;te!==null;){var _e=te;if(oe=_e.stateNode,_e=_e.tag,_e!==5&&_e!==26&&_e!==27||oe===null||re===null||(_e=$o(te,re),_e!=null&&Ge.push(yl(te,_e,oe))),Dt)break;te=te.return}0<Ge.length&&(ce=new ue(ce,De,null,o,fe),be.push({event:ce,listeners:Ge}))}}if((r&7)===0){e:{if(ce=n==="mouseover"||n==="pointerover",ue=n==="mouseout"||n==="pointerout",ce&&o!==Ie&&(De=o.relatedTarget||o.fromElement)&&(Z(De)||De[pt]))break e;if((ue||ce)&&(ce=fe.window===fe?fe:(ce=fe.ownerDocument)?ce.defaultView||ce.parentWindow:window,ue?(De=o.relatedTarget||o.toElement,ue=le,De=De?Z(De):null,De!==null&&(Dt=d(De),Ge=De.tag,De!==Dt||Ge!==5&&Ge!==27&&Ge!==6)&&(De=null)):(ue=null,De=le),ue!==De)){if(Ge=sv,_e="onMouseLeave",re="onMouseEnter",te="mouse",(n==="pointerout"||n==="pointerover")&&(Ge=ov,_e="onPointerLeave",re="onPointerEnter",te="pointer"),Dt=ue==null?ce:Ae(ue),oe=De==null?ce:Ae(De),ce=new Ge(_e,te+"leave",ue,o,fe),ce.target=Dt,ce.relatedTarget=oe,_e=null,Z(fe)===le&&(Ge=new Ge(re,te+"enter",De,o,fe),Ge.target=oe,Ge.relatedTarget=Dt,_e=Ge),Dt=_e,ue&&De)t:{for(Ge=Fk,re=ue,te=De,oe=0,_e=re;_e;_e=Ge(_e))oe++;_e=0;for(var $e=te;$e;$e=Ge($e))_e++;for(;0<oe-_e;)re=Ge(re),oe--;for(;0<_e-oe;)te=Ge(te),_e--;for(;oe--;){if(re===te||te!==null&&re===te.alternate){Ge=re;break t}re=Ge(re),te=Ge(te)}Ge=null}else Ge=null;ue!==null&&Jb(be,ce,ue,Ge,!1),De!==null&&Dt!==null&&Jb(be,Dt,De,Ge,!0)}}e:{if(ce=le?Ae(le):window,ue=ce.nodeName&&ce.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ce.type==="file")var bt=mv;else if(fv(ce))if(gv)bt=Q5;else{bt=Z5;var Be=X5}else ue=ce.nodeName,!ue||ue.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?le&&Jr(le.elementType)&&(bt=mv):bt=J5;if(bt&&(bt=bt(n,le))){pv(be,bt,o,fe);break e}Be&&Be(n,ce,le),n==="focusout"&&le&&ce.type==="number"&&le.memoizedProps.value!=null&&Sa(ce,"number",ce.value)}switch(Be=le?Ae(le):window,n){case"focusin":(fv(Be)||Be.contentEditable==="true")&&(Ca=Be,Bd=le,Yo=null);break;case"focusout":Yo=Bd=Ca=null;break;case"mousedown":Pd=!0;break;case"contextmenu":case"mouseup":case"dragend":Pd=!1,Cv(be,o,fe);break;case"selectionchange":if(tk)break;case"keydown":case"keyup":Cv(be,o,fe)}var et;if(Od)e:{switch(n){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else wa?hv(n,o)&&(ut="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(ut="onCompositionStart");ut&&(lv&&o.locale!=="ko"&&(wa||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&wa&&(et=iv()):(es=fe,Ad="value"in es?es.value:es.textContent,wa=!0)),Be=Mu(le,ut),0<Be.length&&(ut=new av(ut,n,null,o,fe),be.push({event:ut,listeners:Be}),et?ut.data=et:(et=dv(o),et!==null&&(ut.data=et)))),(et=G5?q5(n,o):K5(n,o))&&(ut=Mu(le,"onBeforeInput"),0<ut.length&&(Be=new av("onBeforeInput","beforeinput",null,o,fe),be.push({event:Be,listeners:ut}),Be.data=et)),Pk(be,n,le,o,fe)}Xb(be,r)})}function yl(n,r,o){return{instance:n,listener:r,currentTarget:o}}function Mu(n,r){for(var o=r+"Capture",u=[];n!==null;){var x=n,E=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||E===null||(x=$o(n,o),x!=null&&u.unshift(yl(n,x,E)),x=$o(n,r),x!=null&&u.push(yl(n,x,E))),n.tag===3)return u;n=n.return}return[]}function Fk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Jb(n,r,o,u,x){for(var E=r._reactName,D=[];o!==null&&o!==u;){var U=o,Q=U.alternate,le=U.stateNode;if(U=U.tag,Q!==null&&Q===u)break;U!==5&&U!==26&&U!==27||le===null||(Q=le,x?(le=$o(o,E),le!=null&&D.unshift(yl(o,le,Q))):x||(le=$o(o,E),le!=null&&D.push(yl(o,le,Q)))),o=o.return}D.length!==0&&n.push({event:r,listeners:D})}var Uk=/\r\n?/g,Wk=/\u0000|\uFFFD/g;function Qb(n){return(typeof n=="string"?n:""+n).replace(Uk,`
|
|
9
|
+
`).replace(Wk,"")}function ey(n,r){return r=Qb(r),Qb(n)===r}function Ot(n,r,o,u,x,E){switch(o){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||Ke(n,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&Ke(n,""+u);break;case"className":Si(n,"class",u);break;case"tabIndex":Si(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Si(n,o,u);break;case"style":kt(n,u,E);break;case"data":if(r!=="object"){Si(n,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qr(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){n.setAttribute(o,"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"&&(o==="formAction"?(r!=="input"&&Ot(n,r,"name",x.name,x,null),Ot(n,r,"formEncType",x.formEncType,x,null),Ot(n,r,"formMethod",x.formMethod,x,null),Ot(n,r,"formTarget",x.formTarget,x,null)):(Ot(n,r,"encType",x.encType,x,null),Ot(n,r,"method",x.method,x,null),Ot(n,r,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Qr(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=Te);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=Qr(""+u),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):n.removeAttribute(o);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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":at("beforetoggle",n),at("toggle",n),qn(n,"popover",u);break;case"xlinkActuate":ai(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ai(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ai(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ai(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ai(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ai(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ai(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ai(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ai(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":qn(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Cr.get(o)||o,qn(n,o,u))}}function up(n,r,o,u,x,E){switch(o){case"style":kt(n,u,E);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(o=u.__html,o!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=o}}break;case"children":typeof u=="string"?Ke(n,u):(typeof u=="number"||typeof u=="bigint")&&Ke(n,""+u);break;case"onScroll":u!=null&&at("scroll",n);break;case"onScrollEnd":u!=null&&at("scrollend",n);break;case"onClick":u!=null&&(n.onclick=Te);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yt.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(x=o.endsWith("Capture"),r=o.slice(2,x?o.length-7:void 0),E=n[Ee]||null,E=E!=null?E[o]:null,typeof E=="function"&&n.removeEventListener(r,E,x),typeof u=="function")){typeof E!="function"&&E!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(r,u,x);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):qn(n,o,u)}}}function zn(n,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",n),at("load",n);var u=!1,x=!1,E;for(E in o)if(o.hasOwnProperty(E)){var D=o[E];if(D!=null)switch(E){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ot(n,r,E,D,o,null)}}x&&Ot(n,r,"srcSet",o.srcSet,o,null),u&&Ot(n,r,"src",o.src,o,null);return;case"input":at("invalid",n);var U=E=D=x=null,Q=null,le=null;for(u in o)if(o.hasOwnProperty(u)){var fe=o[u];if(fe!=null)switch(u){case"name":x=fe;break;case"type":D=fe;break;case"checked":Q=fe;break;case"defaultChecked":le=fe;break;case"value":E=fe;break;case"defaultValue":U=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,r));break;default:Ot(n,r,u,fe,o,null)}}Bs(n,E,U,Q,le,D,x,!1);return;case"select":at("invalid",n),u=D=E=null;for(x in o)if(o.hasOwnProperty(x)&&(U=o[x],U!=null))switch(x){case"value":E=U;break;case"defaultValue":D=U;break;case"multiple":u=U;default:Ot(n,r,x,U,o,null)}r=E,o=D,n.multiple=!!u,r!=null?jn(n,!!u,r,!1):o!=null&&jn(n,!!u,o,!0);return;case"textarea":at("invalid",n),E=x=u=null;for(D in o)if(o.hasOwnProperty(D)&&(U=o[D],U!=null))switch(D){case"value":u=U;break;case"defaultValue":x=U;break;case"children":E=U;break;case"dangerouslySetInnerHTML":if(U!=null)throw Error(s(91));break;default:Ot(n,r,D,U,o,null)}xa(n,u,x,E);return;case"option":for(Q in o)o.hasOwnProperty(Q)&&(u=o[Q],u!=null)&&(Q==="selected"?n.selected=u&&typeof u!="function"&&typeof u!="symbol":Ot(n,r,Q,u,o,null));return;case"dialog":at("beforetoggle",n),at("toggle",n),at("cancel",n),at("close",n);break;case"iframe":case"object":at("load",n);break;case"video":case"audio":for(u=0;u<bl.length;u++)at(bl[u],n);break;case"image":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"embed":case"source":case"link":at("error",n),at("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(le in o)if(o.hasOwnProperty(le)&&(u=o[le],u!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Ot(n,r,le,u,o,null)}return;default:if(Jr(r)){for(fe in o)o.hasOwnProperty(fe)&&(u=o[fe],u!==void 0&&up(n,r,fe,u,o,void 0));return}}for(U in o)o.hasOwnProperty(U)&&(u=o[U],u!=null&&Ot(n,r,U,u,o,null))}function Gk(n,r,o,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,E=null,D=null,U=null,Q=null,le=null,fe=null;for(ue in o){var be=o[ue];if(o.hasOwnProperty(ue)&&be!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=be;default:u.hasOwnProperty(ue)||Ot(n,r,ue,null,u,be)}}for(var ce in u){var ue=u[ce];if(be=o[ce],u.hasOwnProperty(ce)&&(ue!=null||be!=null))switch(ce){case"type":E=ue;break;case"name":x=ue;break;case"checked":le=ue;break;case"defaultChecked":fe=ue;break;case"value":D=ue;break;case"defaultValue":U=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,r));break;default:ue!==be&&Ot(n,r,ce,ue,u,be)}}Po(n,D,U,Q,le,fe,E,x);return;case"select":ue=D=U=ce=null;for(E in o)if(Q=o[E],o.hasOwnProperty(E)&&Q!=null)switch(E){case"value":break;case"multiple":ue=Q;default:u.hasOwnProperty(E)||Ot(n,r,E,null,u,Q)}for(x in u)if(E=u[x],Q=o[x],u.hasOwnProperty(x)&&(E!=null||Q!=null))switch(x){case"value":ce=E;break;case"defaultValue":U=E;break;case"multiple":D=E;default:E!==Q&&Ot(n,r,x,E,u,Q)}r=U,o=D,u=ue,ce!=null?jn(n,!!o,ce,!1):!!u!=!!o&&(r!=null?jn(n,!!o,r,!0):jn(n,!!o,o?[]:"",!1));return;case"textarea":ue=ce=null;for(U in o)if(x=o[U],o.hasOwnProperty(U)&&x!=null&&!u.hasOwnProperty(U))switch(U){case"value":break;case"children":break;default:Ot(n,r,U,null,u,x)}for(D in u)if(x=u[D],E=o[D],u.hasOwnProperty(D)&&(x!=null||E!=null))switch(D){case"value":ce=x;break;case"defaultValue":ue=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(s(91));break;default:x!==E&&Ot(n,r,D,x,u,E)}jc(n,ce,ue);return;case"option":for(var De in o)ce=o[De],o.hasOwnProperty(De)&&ce!=null&&!u.hasOwnProperty(De)&&(De==="selected"?n.selected=!1:Ot(n,r,De,null,u,ce));for(Q in u)ce=u[Q],ue=o[Q],u.hasOwnProperty(Q)&&ce!==ue&&(ce!=null||ue!=null)&&(Q==="selected"?n.selected=ce&&typeof ce!="function"&&typeof ce!="symbol":Ot(n,r,Q,ce,u,ue));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 Ge in o)ce=o[Ge],o.hasOwnProperty(Ge)&&ce!=null&&!u.hasOwnProperty(Ge)&&Ot(n,r,Ge,null,u,ce);for(le in u)if(ce=u[le],ue=o[le],u.hasOwnProperty(le)&&ce!==ue&&(ce!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(s(137,r));break;default:Ot(n,r,le,ce,u,ue)}return;default:if(Jr(r)){for(var Dt in o)ce=o[Dt],o.hasOwnProperty(Dt)&&ce!==void 0&&!u.hasOwnProperty(Dt)&&up(n,r,Dt,void 0,u,ce);for(fe in u)ce=u[fe],ue=o[fe],!u.hasOwnProperty(fe)||ce===ue||ce===void 0&&ue===void 0||up(n,r,fe,ce,u,ue);return}}for(var re in o)ce=o[re],o.hasOwnProperty(re)&&ce!=null&&!u.hasOwnProperty(re)&&Ot(n,r,re,null,u,ce);for(be in u)ce=u[be],ue=o[be],!u.hasOwnProperty(be)||ce===ue||ce==null&&ue==null||Ot(n,r,be,ce,u,ue)}function ty(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qk(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var x=o[u],E=x.transferSize,D=x.initiatorType,U=x.duration;if(E&&U&&ty(D)){for(D=0,U=x.responseEnd,u+=1;u<o.length;u++){var Q=o[u],le=Q.startTime;if(le>U)break;var fe=Q.transferSize,be=Q.initiatorType;fe&&ty(be)&&(Q=Q.responseEnd,D+=fe*(Q<U?1:(U-le)/(Q-le)))}if(--u,r+=8*(E+D)/(x.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 hp=null,dp=null;function Nu(n){return n.nodeType===9?n:n.ownerDocument}function ny(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 iy(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 fp(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 pp=null;function Kk(){var n=window.event;return n&&n.type==="popstate"?n===pp?!1:(pp=n,!0):(pp=null,!1)}var ry=typeof setTimeout=="function"?setTimeout:void 0,Vk=typeof clearTimeout=="function"?clearTimeout:void 0,sy=typeof Promise=="function"?Promise:void 0,Yk=typeof queueMicrotask=="function"?queueMicrotask:typeof sy<"u"?function(n){return sy.resolve(null).then(n).catch(Xk)}:ry;function Xk(n){setTimeout(function(){throw n})}function _s(n){return n==="head"}function ay(n,r){var o=r,u=0;do{var x=o.nextSibling;if(n.removeChild(o),x&&x.nodeType===8)if(o=x.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(x),Za(r);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")Sl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,Sl(o);for(var E=o.firstChild;E;){var D=E.nextSibling,U=E.nodeName;E[Gn]||U==="SCRIPT"||U==="STYLE"||U==="LINK"&&E.rel.toLowerCase()==="stylesheet"||o.removeChild(E),E=D}}else o==="body"&&Sl(n.ownerDocument.body);o=x}while(o);Za(r)}function oy(n,r){var o=n;n=0;do{var u=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function mp(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":mp(o),je(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function Zk(n,r,o,u){for(;n.nodeType===1;){var x=o;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){if(!n[Gn])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!==x.rel||n.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||n.getAttribute("title")!==(x.title==null?null:x.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(E=n.getAttribute("src"),(E!==(x.src==null?null:x.src)||n.getAttribute("type")!==(x.type==null?null:x.type)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&E&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var E=x.name==null?null:""+x.name;if(x.type==="hidden"&&n.getAttribute("name")===E)return n}else return n;if(n=Ui(n.nextSibling),n===null)break}return null}function Jk(n,r,o){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Ui(n.nextSibling),n===null))return null;return n}function ly(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Ui(n.nextSibling),n===null))return null;return n}function gp(n){return n.data==="$?"||n.data==="$~"}function _p(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Qk(n,r){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||o.readyState!=="loading")r();else{var u=function(){r(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function Ui(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 vp=null;function cy(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(r===0)return Ui(n.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}n=n.nextSibling}return null}function uy(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return n;r--}else o!=="/$"&&o!=="/&"||r++}n=n.previousSibling}return null}function hy(n,r,o){switch(r=Nu(o),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 Sl(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);je(n)}var Wi=new Map,dy=new Set;function Ou(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Hr=K.d;K.d={f:eT,r:tT,D:nT,C:iT,L:rT,m:sT,X:oT,S:aT,M:lT};function eT(){var n=Hr.f(),r=Cu();return n||r}function tT(n){var r=he(n);r!==null&&r.tag===5&&r.type==="form"?R0(r):Hr.r(n)}var Va=typeof document>"u"?null:document;function fy(n,r,o){var u=Va;if(u&&typeof r=="string"&&r){var x=oi(r);x='link[rel="'+n+'"][href="'+x+'"]',typeof o=="string"&&(x+='[crossorigin="'+o+'"]'),dy.has(x)||(dy.add(x),n={rel:n,crossOrigin:o,href:r},u.querySelector(x)===null&&(r=u.createElement("link"),zn(r,"link",n),Je(r),u.head.appendChild(r)))}}function nT(n){Hr.D(n),fy("dns-prefetch",n,null)}function iT(n,r){Hr.C(n,r),fy("preconnect",n,r)}function rT(n,r,o){Hr.L(n,r,o);var u=Va;if(u&&n&&r){var x='link[rel="preload"][as="'+oi(r)+'"]';r==="image"&&o&&o.imageSrcSet?(x+='[imagesrcset="'+oi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(x+='[imagesizes="'+oi(o.imageSizes)+'"]')):x+='[href="'+oi(n)+'"]';var E=x;switch(r){case"style":E=Ya(n);break;case"script":E=Xa(n)}Wi.has(E)||(n=m({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:n,as:r},o),Wi.set(E,n),u.querySelector(x)!==null||r==="style"&&u.querySelector(xl(E))||r==="script"&&u.querySelector(wl(E))||(r=u.createElement("link"),zn(r,"link",n),Je(r),u.head.appendChild(r)))}}function sT(n,r){Hr.m(n,r);var o=Va;if(o&&n){var u=r&&typeof r.as=="string"?r.as:"script",x='link[rel="modulepreload"][as="'+oi(u)+'"][href="'+oi(n)+'"]',E=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Xa(n)}if(!Wi.has(E)&&(n=m({rel:"modulepreload",href:n},r),Wi.set(E,n),o.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(wl(E)))return}u=o.createElement("link"),zn(u,"link",n),Je(u),o.head.appendChild(u)}}}function aT(n,r,o){Hr.S(n,r,o);var u=Va;if(u&&n){var x=Xe(u).hoistableStyles,E=Ya(n);r=r||"default";var D=x.get(E);if(!D){var U={loading:0,preload:null};if(D=u.querySelector(xl(E)))U.loading=5;else{n=m({rel:"stylesheet",href:n,"data-precedence":r},o),(o=Wi.get(E))&&bp(n,o);var Q=D=u.createElement("link");Je(Q),zn(Q,"link",n),Q._p=new Promise(function(le,fe){Q.onload=le,Q.onerror=fe}),Q.addEventListener("load",function(){U.loading|=1}),Q.addEventListener("error",function(){U.loading|=2}),U.loading|=4,Du(D,r,u)}D={type:"stylesheet",instance:D,count:1,state:U},x.set(E,D)}}}function oT(n,r){Hr.X(n,r);var o=Va;if(o&&n){var u=Xe(o).hoistableScripts,x=Xa(n),E=u.get(x);E||(E=o.querySelector(wl(x)),E||(n=m({src:n,async:!0},r),(r=Wi.get(x))&&yp(n,r),E=o.createElement("script"),Je(E),zn(E,"link",n),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},u.set(x,E))}}function lT(n,r){Hr.M(n,r);var o=Va;if(o&&n){var u=Xe(o).hoistableScripts,x=Xa(n),E=u.get(x);E||(E=o.querySelector(wl(x)),E||(n=m({src:n,async:!0,type:"module"},r),(r=Wi.get(x))&&yp(n,r),E=o.createElement("script"),Je(E),zn(E,"link",n),o.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},u.set(x,E))}}function py(n,r,o,u){var x=(x=ve.current)?Ou(x):null;if(!x)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Ya(o.href),o=Xe(x).hoistableStyles,u=o.get(r),u||(u={type:"style",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=Ya(o.href);var E=Xe(x).hoistableStyles,D=E.get(n);if(D||(x=x.ownerDocument||x,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(n,D),(E=x.querySelector(xl(n)))&&!E._p&&(D.instance=E,D.state.loading=5),Wi.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Wi.set(n,o),E||cT(x,n,o,D.state))),r&&u===null)throw Error(s(528,""));return D}if(r&&u!==null)throw Error(s(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Xa(o),o=Xe(x).hoistableScripts,u=o.get(r),u||(u={type:"script",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Ya(n){return'href="'+oi(n)+'"'}function xl(n){return'link[rel="stylesheet"]['+n+"]"}function my(n){return m({},n,{"data-precedence":n.precedence,precedence:null})}function cT(n,r,o,u){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=n.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),zn(r,"link",o),Je(r),n.head.appendChild(r))}function Xa(n){return'[src="'+oi(n)+'"]'}function wl(n){return"script[async]"+n}function gy(n,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var u=n.querySelector('style[data-href~="'+oi(o.href)+'"]');if(u)return r.instance=u,Je(u),u;var x=m({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),Je(u),zn(u,"style",x),Du(u,o.precedence,n),r.instance=u;case"stylesheet":x=Ya(o.href);var E=n.querySelector(xl(x));if(E)return r.state.loading|=4,r.instance=E,Je(E),E;u=my(o),(x=Wi.get(x))&&bp(u,x),E=(n.ownerDocument||n).createElement("link"),Je(E);var D=E;return D._p=new Promise(function(U,Q){D.onload=U,D.onerror=Q}),zn(E,"link",u),r.state.loading|=4,Du(E,o.precedence,n),r.instance=E;case"script":return E=Xa(o.src),(x=n.querySelector(wl(E)))?(r.instance=x,Je(x),x):(u=o,(x=Wi.get(E))&&(u=m({},o),yp(u,x)),n=n.ownerDocument||n,x=n.createElement("script"),Je(x),zn(x,"link",u),n.head.appendChild(x),r.instance=x);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,Du(u,o.precedence,n));return r.instance}function Du(n,r,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,E=x,D=0;D<u.length;D++){var U=u[D];if(U.dataset.precedence===r)E=U;else if(E!==x)break}E?E.parentNode.insertBefore(n,E.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(n,r.firstChild))}function bp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function yp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var ju=null;function _y(n,r,o){if(ju===null){var u=new Map,x=ju=new Map;x.set(o,u)}else x=ju,u=x.get(o),u||(u=new Map,x.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),x=0;x<o.length;x++){var E=o[x];if(!(E[Gn]||E[Ue]||n==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var D=E.getAttribute(r)||"";D=n+D;var U=u.get(D);U?U.push(E):u.set(D,[E])}}return u}function vy(n,r,o){n=n.ownerDocument||n,n.head.insertBefore(o,r==="title"?n.querySelector("head > title"):null)}function uT(n,r,o){if(o===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 by(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function hT(n,r,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var x=Ya(u.href),E=r.querySelector(xl(x));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=Iu.bind(n),r.then(n,n)),o.state.loading|=4,o.instance=E,Je(E);return}E=r.ownerDocument||r,u=my(u),(x=Wi.get(x))&&bp(u,x),E=E.createElement("link"),Je(E);var D=E;D._p=new Promise(function(U,Q){D.onload=U,D.onerror=Q}),zn(E,"link",u),o.instance=E}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=Iu.bind(n),r.addEventListener("load",o),r.addEventListener("error",o))}}var Sp=0;function dT(n,r){return n.stylesheets&&n.count===0&&Pu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&Pu(n,n.stylesheets),n.unsuspend){var E=n.unsuspend;n.unsuspend=null,E()}},6e4+r);0<n.imgBytes&&Sp===0&&(Sp=62500*qk());var x=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Pu(n,n.stylesheets),n.unsuspend)){var E=n.unsuspend;n.unsuspend=null,E()}},(n.imgBytes>Sp?50:800)+r);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function Iu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Bu=null;function Pu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Bu=new Map,r.forEach(fT,n),Bu=null,Iu.call(n))}function fT(n,r){if(!(r.state.loading&4)){var o=Bu.get(n);if(o)var u=o.get(null);else{o=new Map,Bu.set(n,o);for(var x=n.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<x.length;E++){var D=x[E];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(o.set(D.dataset.precedence,D),u=D)}u&&o.set(null,u)}x=r.instance,D=x.getAttribute("data-precedence"),E=o.get(D)||u,E===u&&o.set(null,x),o.set(D,x),this.count++,u=Iu.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),E?E.parentNode.insertBefore(x,E.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(x,n.firstChild)),r.state.loading|=4}}var Cl={$$typeof:y,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function pT(n,r,o,u,x,E,D,U,Q){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=Ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ct(0),this.hiddenUpdates=Ct(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=E,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function yy(n,r,o,u,x,E,D,U,Q,le,fe,be){return n=new pT(n,r,o,D,Q,le,fe,be,U),r=1,E===!0&&(r|=24),E=Ci(3,null,null,r),n.current=E,E.stateNode=n,r=Qd(),r.refCount++,n.pooledCache=r,r.refCount++,E.memoizedState={element:u,isDehydrated:o,cache:r},rf(E),n}function Sy(n){return n?(n=Ta,n):Ta}function xy(n,r,o,u,x,E){x=Sy(x),u.context===null?u.context=x:u.pendingContext=x,u=as(r),u.payload={element:o},E=E===void 0?null:E,E!==null&&(u.callback=E),o=os(n,u,r),o!==null&&(fi(o,n,r),nl(o,n,r))}function wy(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<r?o:r}}function xp(n,r){wy(n,r),(n=n.alternate)&&wy(n,r)}function Cy(n){if(n.tag===13||n.tag===31){var r=$s(n,67108864);r!==null&&fi(r,n,67108864),xp(n,67108864)}}function Ey(n){if(n.tag===13||n.tag===31){var r=Ri();r=nt(r);var o=$s(n,r);o!==null&&fi(o,n,r),xp(n,r)}}var zu=!0;function mT(n,r,o,u){var x=P.T;P.T=null;var E=K.p;try{K.p=2,wp(n,r,o,u)}finally{K.p=E,P.T=x}}function gT(n,r,o,u){var x=P.T;P.T=null;var E=K.p;try{K.p=8,wp(n,r,o,u)}finally{K.p=E,P.T=x}}function wp(n,r,o,u){if(zu){var x=Cp(u);if(x===null)cp(n,r,u,Hu,o),Ty(n,u);else if(vT(x,n,r,o,u))u.stopPropagation();else if(Ty(n,u),r&4&&-1<_T.indexOf(n)){for(;x!==null;){var E=he(x);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var D=Mt(E.pendingLanes);if(D!==0){var U=E;for(U.pendingLanes|=2,U.entangledLanes|=2;D;){var Q=1<<31-Lt(D);U.entanglements[1]|=Q,D&=~Q}mr(E),(xt&6)===0&&(xu=ft()+500,vl(0))}}break;case 31:case 13:U=$s(E,2),U!==null&&fi(U,E,2),Cu(),xp(E,2)}if(E=Cp(u),E===null&&cp(n,r,u,Hu,o),E===x)break;x=E}x!==null&&u.stopPropagation()}else cp(n,r,u,null,o)}}function Cp(n){return n=Ze(n),Ep(n)}var Hu=null;function Ep(n){if(Hu=null,n=Z(n),n!==null){var r=d(n);if(r===null)n=null;else{var o=r.tag;if(o===13){if(n=p(r),n!==null)return n;n=null}else if(o===31){if(n=c(r),n!==null)return n;n=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return Hu=n,null}function ky(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(tn()){case Kt:return 2;case Ht:return 8;case nn:case pn:return 32;case sn:return 268435456;default:return 32}default:return 32}}var kp=!1,vs=null,bs=null,ys=null,El=new Map,kl=new Map,Ss=[],_T="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 Ty(n,r){switch(n){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":bs=null;break;case"mouseover":case"mouseout":ys=null;break;case"pointerover":case"pointerout":El.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":kl.delete(r.pointerId)}}function Tl(n,r,o,u,x,E){return n===null||n.nativeEvent!==E?(n={blockedOn:r,domEventName:o,eventSystemFlags:u,nativeEvent:E,targetContainers:[x]},r!==null&&(r=he(r),r!==null&&Cy(r)),n):(n.eventSystemFlags|=u,r=n.targetContainers,x!==null&&r.indexOf(x)===-1&&r.push(x),n)}function vT(n,r,o,u,x){switch(r){case"focusin":return vs=Tl(vs,n,r,o,u,x),!0;case"dragenter":return bs=Tl(bs,n,r,o,u,x),!0;case"mouseover":return ys=Tl(ys,n,r,o,u,x),!0;case"pointerover":var E=x.pointerId;return El.set(E,Tl(El.get(E)||null,n,r,o,u,x)),!0;case"gotpointercapture":return E=x.pointerId,kl.set(E,Tl(kl.get(E)||null,n,r,o,u,x)),!0}return!1}function Ay(n){var r=Z(n.target);if(r!==null){var o=d(r);if(o!==null){if(r=o.tag,r===13){if(r=p(o),r!==null){n.blockedOn=r,ot(n.priority,function(){Ey(o)});return}}else if(r===31){if(r=c(o),r!==null){n.blockedOn=r,ot(n.priority,function(){Ey(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function $u(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var o=Cp(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);Ie=u,o.target.dispatchEvent(u),Ie=null}else return r=he(o),r!==null&&Cy(r),n.blockedOn=o,!1;r.shift()}return!0}function Ry(n,r,o){$u(n)&&o.delete(r)}function bT(){kp=!1,vs!==null&&$u(vs)&&(vs=null),bs!==null&&$u(bs)&&(bs=null),ys!==null&&$u(ys)&&(ys=null),El.forEach(Ry),kl.forEach(Ry)}function Fu(n,r){n.blockedOn===r&&(n.blockedOn=null,kp||(kp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,bT)))}var Uu=null;function Ly(n){Uu!==n&&(Uu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uu===n&&(Uu=null);for(var r=0;r<n.length;r+=3){var o=n[r],u=n[r+1],x=n[r+2];if(typeof u!="function"){if(Ep(u||o)===null)continue;break}var E=he(o);E!==null&&(n.splice(r,3),r-=3,Cf(E,{pending:!0,data:x,method:o.method,action:u},u,x))}}))}function Za(n){function r(Q){return Fu(Q,n)}vs!==null&&Fu(vs,n),bs!==null&&Fu(bs,n),ys!==null&&Fu(ys,n),El.forEach(r),kl.forEach(r);for(var o=0;o<Ss.length;o++){var u=Ss[o];u.blockedOn===n&&(u.blockedOn=null)}for(;0<Ss.length&&(o=Ss[0],o.blockedOn===null);)Ay(o),o.blockedOn===null&&Ss.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var x=o[u],E=o[u+1],D=x[Ee]||null;if(typeof E=="function")D||Ly(o);else if(D){var U=null;if(E&&E.hasAttribute("formAction")){if(x=E,D=E[Ee]||null)U=D.formAction;else if(Ep(x)!==null)continue}else U=D.action;typeof U=="function"?o[u+1]=U:(o.splice(u,3),u-=3),Ly(o)}}}function My(){function n(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(D){return x=D})},focusReset:"manual",scroll:"manual"})}function r(){x!==null&&(x(),x=null),u||setTimeout(o,20)}function o(){if(!u&&!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 u=!1,x=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),x!==null&&(x(),x=null)}}}function Tp(n){this._internalRoot=n}Wu.prototype.render=Tp.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));var o=r.current,u=Ri();xy(o,u,n,r,null,null)},Wu.prototype.unmount=Tp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;xy(n.current,2,null,n,null,null),Cu(),r[pt]=null}};function Wu(n){this._internalRoot=n}Wu.prototype.unstable_scheduleHydration=function(n){if(n){var r=me();n={blockedOn:null,target:n,priority:r};for(var o=0;o<Ss.length&&r!==0&&r<Ss[o].priority;o++);Ss.splice(o,0,n),o===0&&Ay(n)}};var Ny=t.version;if(Ny!=="19.2.7")throw Error(s(527,Ny,"19.2.7"));K.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=f(r),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var yT={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Gu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gu.isDisabled&&Gu.supportsFiber)try{kn=Gu.inject(yT),$t=Gu}catch{}}return Rl.createRoot=function(n,r){if(!a(n))throw Error(s(299));var o=!1,u="",x=z0,E=H0,D=$0;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(D=r.onRecoverableError)),r=yy(n,1,!1,null,null,o,u,null,x,E,D,My),n[pt]=r.current,lp(n),new Tp(r)},Rl.hydrateRoot=function(n,r,o){if(!a(n))throw Error(s(299));var u=!1,x="",E=z0,D=H0,U=$0,Q=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(x=o.identifierPrefix),o.onUncaughtError!==void 0&&(E=o.onUncaughtError),o.onCaughtError!==void 0&&(D=o.onCaughtError),o.onRecoverableError!==void 0&&(U=o.onRecoverableError),o.formState!==void 0&&(Q=o.formState)),r=yy(n,1,!0,r,o??null,u,x,Q,E,D,U,My),r.context=Sy(null),o=r.current,u=Ri(),u=nt(u),x=as(u),x.callback=null,os(o,x,u),o=u,r.current.lanes=o,gt(r,o),mr(r),n[pt]=r.current,lp(n),new Wu(r)},Rl.version="19.2.7",Rl}var Uy;function oA(){if(Uy)return Mp.exports;Uy=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(),Mp.exports=aA(),Mp.exports}var lA=oA();var Wy="popstate";function Gy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cA(e={}){function t(s,a){let d=a.state?.masked,{pathname:p,search:c,hash:h}=d||s.location;return Fm("",{pathname:p,search:c,hash:h},a.state&&a.state.usr||null,a.state&&a.state.key||"default",d?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function i(s,a){return typeof a=="string"?a:uc(a)}return hA(t,i,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function or(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uA(){return Math.random().toString(36).substring(2,10)}function qy(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 Fm(e,t,i=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Mo(t):t,state:i,key:t&&t.key||s||uA(),mask:a}}function uc({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 Mo(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 hA(e,t,i,s={}){let{window:a=document.defaultView,v5Compat:d=!1}=s,p=a.history,c="POP",h=null,f=g();f==null&&(f=0,p.replaceState({...p.state,idx:f},""));function g(){return(p.state||{idx:null}).idx}function m(){c="POP";let _=g(),b=_==null?null:_-f;f=_,h&&h({action:c,location:w.location,delta:b})}function S(_,b){c="PUSH";let v=Gy(_)?_:Fm(w.location,_,b);f=g()+1;let y=qy(v,f),k=w.createHref(v.mask||v);try{p.pushState(y,"",k)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;a.location.assign(k)}d&&h&&h({action:c,location:w.location,delta:1})}function C(_,b){c="REPLACE";let v=Gy(_)?_:Fm(w.location,_,b);f=g();let y=qy(v,f),k=w.createHref(v.mask||v);p.replaceState(y,"",k),d&&h&&h({action:c,location:w.location,delta:0})}function T(_){return dA(a,_)}let w={get action(){return c},get location(){return e(a,p)},listen(_){if(h)throw new Error("A history only accepts one active listener");return a.addEventListener(Wy,m),h=_,()=>{a.removeEventListener(Wy,m),h=null}},createHref(_){return t(a,_)},createURL:T,encodeLocation(_){let b=T(_);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:S,replace:C,go(_){return p.go(_)}};return w}function dA(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 a=typeof t=="string"?t:uc(t);return a=a.replace(/ $/,"%20"),!i&&a.startsWith("//")&&(a=s+a),new URL(a,s)}function qx(e,t,i="/"){return fA(e,t,i,!1)}function fA(e,t,i,s,a){let d=typeof t=="string"?Mo(t):t,p=Vr(d.pathname||"/",i);if(p==null)return null;let c=pA(e),h=null,f=kA(p);for(let g=0;h==null&&g<c.length;++g)h=CA(c[g],f,s);return h}function pA(e){let t=Kx(e);return mA(t),t}function Kx(e,t=[],i=[],s="",a=!1){let d=(p,c,h=a,f)=>{let g={relativePath:f===void 0?p.path||"":f,caseSensitive:p.caseSensitive===!0,childrenIndex:c,route:p};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(s)&&h)return;Qt(g.relativePath.startsWith(s),`Absolute route path "${g.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(s.length)}let m=sr([s,g.relativePath]),S=i.concat(g);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 "${m}".`),Kx(p.children,t,S,m,h)),!(p.path==null&&!p.index)&&t.push({path:m,score:xA(m,p.index),routesMeta:S})};return e.forEach((p,c)=>{if(p.path===""||!p.path?.includes("?"))d(p,c);else for(let h of Vx(p.path))d(p,c,!0,h)}),t}function Vx(e){let t=e.split("/");if(t.length===0)return[];let[i,...s]=t,a=i.endsWith("?"),d=i.replace(/\?$/,"");if(s.length===0)return a?[d,""]:[d];let p=Vx(s.join("/")),c=[];return c.push(...p.map(h=>h===""?d:[d,h].join("/"))),a&&c.push(...p),c.map(h=>e.startsWith("/")&&h===""?"/":h)}function mA(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:wA(t.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var gA=/^:[\w-]+$/,_A=3,vA=2,bA=1,yA=10,SA=-2,Ky=e=>e==="*";function xA(e,t){let i=e.split("/"),s=i.length;return i.some(Ky)&&(s+=SA),t&&(s+=vA),i.filter(a=>!Ky(a)).reduce((a,d)=>a+(gA.test(d)?_A:d===""?bA:yA),s)}function wA(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function CA(e,t,i=!1){let{routesMeta:s}=e,a={},d="/",p=[];for(let c=0;c<s.length;++c){let h=s[c],f=c===s.length-1,g=d==="/"?t:t.slice(d.length)||"/",m=Dh({path:h.relativePath,caseSensitive:h.caseSensitive,end:f},g),S=h.route;if(!m&&f&&i&&!s[s.length-1].route.index&&(m=Dh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!m)return null;Object.assign(a,m.params),p.push({params:a,pathname:sr([d,m.pathname]),pathnameBase:LA(sr([d,m.pathnameBase])),route:S}),m.pathnameBase!=="/"&&(d=sr([d,m.pathnameBase]))}return p}function Dh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=EA(e.path,e.caseSensitive,e.end),a=t.match(i);if(!a)return null;let d=a[0],p=d.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:s.reduce((f,{paramName:g,isOptional:m},S)=>{if(g==="*"){let T=c[S]||"";p=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const C=c[S];return m&&!C?f[g]=void 0:f[g]=(C||"").replace(/%2F/g,"/"),f},{}),pathname:d,pathnameBase:p,pattern:e}}function EA(e,t=!1,i=!0){or(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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(p,c,h,f,g)=>{if(s.push({paramName:c,isOptional:h!=null}),h){let m=g.charAt(f+p.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function kA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return or(!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 Vr(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 TA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function AA(e,t="/"){let{pathname:i,search:s="",hash:a=""}=typeof e=="string"?Mo(e):e,d;return i?(i=Yx(i),i.startsWith("/")?d=Vy(i.substring(1),"/"):d=Vy(i,t)):d=t,{pathname:d,search:MA(s),hash:NA(a)}}function Vy(e,t){let i=jh(t).split("/");return e.split("/").forEach(a=>{a===".."?i.length>1&&i.pop():a!=="."&&i.push(a)}),i.length>1?i.join("/"):"/"}function jp(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 RA(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function n_(e){let t=RA(e);return t.map((i,s)=>s===t.length-1?i.pathname:i.pathnameBase)}function ad(e,t,i,s=!1){let a;typeof e=="string"?a=Mo(e):(a={...e},Qt(!a.pathname||!a.pathname.includes("?"),jp("?","pathname","search",a)),Qt(!a.pathname||!a.pathname.includes("#"),jp("#","pathname","hash",a)),Qt(!a.search||!a.search.includes("#"),jp("#","search","hash",a)));let d=e===""||a.pathname==="",p=d?"/":a.pathname,c;if(p==null)c=i;else{let m=t.length-1;if(!s&&p.startsWith("..")){let S=p.split("/");for(;S[0]==="..";)S.shift(),m-=1;a.pathname=S.join("/")}c=m>=0?t[m]:"/"}let h=AA(a,c),f=p&&p!=="/"&&p.endsWith("/"),g=(d||p===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(f||g)&&(h.pathname+="/"),h}var Yx=e=>e.replace(/\/\/+/g,"/"),sr=e=>Yx(e.join("/")),jh=e=>e.replace(/\/+$/,""),LA=e=>jh(e).replace(/^\/*/,"/"),MA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,NA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,OA=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 DA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jA(e){let t=e.map(i=>i.route.path).filter(Boolean);return sr(t)||"/"}var Xx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zx(e,t){let i=e;if(typeof i!="string"||!TA.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,a=!1;if(Xx)try{let d=new URL(window.location.href),p=i.startsWith("//")?new URL(d.protocol+i):new URL(i),c=Vr(p.pathname,t);p.origin===d.origin&&c!=null?i=c+p.search+p.hash:a=!0}catch{or(!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:a,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Jx=["POST","PUT","PATCH","DELETE"];new Set(Jx);var IA=["GET",...Jx];new Set(IA);var No=L.createContext(null);No.displayName="DataRouter";var od=L.createContext(null);od.displayName="DataRouterState";var Qx=L.createContext(!1);function BA(){return L.useContext(Qx)}var ew=L.createContext({isTransitioning:!1});ew.displayName="ViewTransition";var PA=L.createContext(new Map);PA.displayName="Fetchers";var zA=L.createContext(null);zA.displayName="Await";var Oi=L.createContext(null);Oi.displayName="Navigation";var Ac=L.createContext(null);Ac.displayName="Location";var Sr=L.createContext({outlet:null,matches:[],isDataRoute:!1});Sr.displayName="Route";var i_=L.createContext(null);i_.displayName="RouteError";var tw="REACT_ROUTER_ERROR",HA="REDIRECT",$A="ROUTE_ERROR_RESPONSE";function FA(e){if(e.startsWith(`${tw}:${HA}:{`))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 UA(e){if(e.startsWith(`${tw}:${$A}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new OA(t.status,t.statusText,t.data)}catch{}}function WA(e,{relative:t}={}){Qt(Oo(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=L.useContext(Oi),{hash:a,pathname:d,search:p}=Lc(e,{relative:t}),c=d;return i!=="/"&&(c=d==="/"?i:sr([i,d])),s.createHref({pathname:c,search:p,hash:a})}function Oo(){return L.useContext(Ac)!=null}function cr(){return Qt(Oo(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Ac).location}var nw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function iw(e){L.useContext(Oi).static||L.useLayoutEffect(e)}function Rc(){let{isDataRoute:e}=L.useContext(Sr);return e?iR():GA()}function GA(){Qt(Oo(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(No),{basename:t,navigator:i}=L.useContext(Oi),{matches:s}=L.useContext(Sr),{pathname:a}=cr(),d=JSON.stringify(n_(s)),p=L.useRef(!1);return iw(()=>{p.current=!0}),L.useCallback((h,f={})=>{if(or(p.current,nw),!p.current)return;if(typeof h=="number"){i.go(h);return}let g=ad(h,JSON.parse(d),a,f.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:sr([t,g.pathname])),(f.replace?i.replace:i.push)(g,f.state,f)},[t,i,d,a,e])}L.createContext(null);function Lc(e,{relative:t}={}){let{matches:i}=L.useContext(Sr),{pathname:s}=cr(),a=JSON.stringify(n_(i));return L.useMemo(()=>ad(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function qA(e,t){return rw(e,t)}function rw(e,t,i){Qt(Oo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=L.useContext(Oi),{matches:a}=L.useContext(Sr),d=a[a.length-1],p=d?d.params:{},c=d?d.pathname:"/",h=d?d.pathnameBase:"/",f=d&&d.route;{let _=f&&f.path||"";aw(c,!f||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${_}">) 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="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let g=cr(),m;if(t){let _=typeof t=="string"?Mo(t):t;Qt(h==="/"||_.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 "${_.pathname}" was given in the \`location\` prop.`),m=_}else m=g;let S=m.pathname||"/",C=S;if(h!=="/"){let _=h.replace(/^\//,"").split("/");C="/"+S.replace(/^\//,"").split("/").slice(_.length).join("/")}let T=i&&i.state.matches.length?i.state.matches.map(_=>Object.assign(_,{route:i.manifest[_.route.id]||_.route})):qx(e,{pathname:C});or(f||T!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),or(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 "${m.pathname}${m.search}${m.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=ZA(T&&T.map(_=>Object.assign({},_,{params:Object.assign({},p,_.params),pathname:sr([h,s.encodeLocation?s.encodeLocation(_.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:sr([h,s.encodeLocation?s.encodeLocation(_.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),a,i);return t&&w?L.createElement(Ac.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},w):w}function KA(){let e=nR(),t=DA(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)",a={padding:"0.5rem",backgroundColor:s},d={padding:"2px 4px",backgroundColor:s},p=null;return console.error("Error handled by React Router default ErrorBoundary:",e),p=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:d},"ErrorBoundary")," or"," ",L.createElement("code",{style:d},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),i?L.createElement("pre",{style:a},i):null,p)}var VA=L.createElement(KA,null),sw=class extends L.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=UA(e.digest);i&&(e=i)}let t=e!==void 0?L.createElement(Sr.Provider,{value:this.props.routeContext},L.createElement(i_.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?L.createElement(YA,{error:e},t):t}};sw.contextType=Qx;var Ip=new WeakMap;function YA({children:e,error:t}){let{basename:i}=L.useContext(Oi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=FA(t.digest);if(s){let a=Ip.get(t);if(a)throw a;let d=Zx(s.location,i);if(Xx&&!Ip.get(t))if(d.isExternal||s.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:s.replace}));throw Ip.set(t,p),p}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return e}function XA({routeContext:e,match:t,children:i}){let s=L.useContext(No);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(Sr.Provider,{value:e},i)}function ZA(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 a=e,d=s?.errors;if(d!=null){let g=a.findIndex(m=>m.route.id&&d?.[m.route.id]!==void 0);Qt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),a=a.slice(0,Math.min(a.length,g+1))}let p=!1,c=-1;if(i&&s){p=s.renderFallback;for(let g=0;g<a.length;g++){let m=a[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=g),m.route.id){let{loaderData:S,errors:C}=s,T=m.route.loader&&!S.hasOwnProperty(m.route.id)&&(!C||C[m.route.id]===void 0);if(m.route.lazy||T){i.isStatic&&(p=!0),c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}}let h=i?.onError,f=s&&h?(g,m)=>{h(g,{location:s.location,params:s.matches?.[0]?.params??{},pattern:jA(s.matches),errorInfo:m})}:void 0;return a.reduceRight((g,m,S)=>{let C,T=!1,w=null,_=null;s&&(C=d&&m.route.id?d[m.route.id]:void 0,w=m.route.errorElement||VA,p&&(c<0&&S===0?(aw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,_=null):c===S&&(T=!0,_=m.route.hydrateFallbackElement||null)));let b=t.concat(a.slice(0,S+1)),v=()=>{let y;return C?y=w:T?y=_:m.route.Component?y=L.createElement(m.route.Component,null):m.route.element?y=m.route.element:y=g,L.createElement(XA,{match:m,routeContext:{outlet:g,matches:b,isDataRoute:s!=null},children:y})};return s&&(m.route.ErrorBoundary||m.route.errorElement||S===0)?L.createElement(sw,{location:s.location,revalidation:s.revalidation,component:w,error:C,children:v(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:f}):v()},null)}function r_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function JA(e){let t=L.useContext(No);return Qt(t,r_(e)),t}function QA(e){let t=L.useContext(od);return Qt(t,r_(e)),t}function eR(e){let t=L.useContext(Sr);return Qt(t,r_(e)),t}function s_(e){let t=eR(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 tR(){return s_("useRouteId")}function nR(){let e=L.useContext(i_),t=QA("useRouteError"),i=s_("useRouteError");return e!==void 0?e:t.errors?.[i]}function iR(){let{router:e}=JA("useNavigate"),t=s_("useNavigate"),i=L.useRef(!1);return iw(()=>{i.current=!0}),L.useCallback(async(a,d={})=>{or(i.current,nw),i.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...d}))},[e,t])}var Yy={};function aw(e,t,i){!t&&!Yy[e]&&(Yy[e]=!0,or(!1,i))}L.memo(rR);function rR({routes:e,manifest:t,future:i,state:s,isStatic:a,onError:d}){return rw(e,void 0,{manifest:t,state:s,isStatic:a,onError:d})}function Xy({to:e,replace:t,state:i,relative:s}){Qt(Oo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=L.useContext(Oi);or(!a,"<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:d}=L.useContext(Sr),{pathname:p}=cr(),c=Rc(),h=ad(e,n_(d),p,s==="path"),f=JSON.stringify(h);return L.useEffect(()=>{c(JSON.parse(f),{replace:t,state:i,relative:s})},[c,f,s,t,i]),null}function ro(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 sR({basename:e="/",children:t=null,location:i,navigationType:s="POP",navigator:a,static:d=!1,useTransitions:p}){Qt(!Oo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),h=L.useMemo(()=>({basename:c,navigator:a,static:d,useTransitions:p,future:{}}),[c,a,d,p]);typeof i=="string"&&(i=Mo(i));let{pathname:f="/",search:g="",hash:m="",state:S=null,key:C="default",mask:T}=i,w=L.useMemo(()=>{let _=Vr(f,c);return _==null?null:{location:{pathname:_,search:g,hash:m,state:S,key:C,mask:T},navigationType:s}},[c,f,g,m,S,C,s,T]);return or(w!=null,`<Router basename="${c}"> is not able to match the URL "${f}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:L.createElement(Oi.Provider,{value:h},L.createElement(Ac.Provider,{children:t,value:w}))}function aR({children:e,location:t}){return qA(Um(e),t)}function Um(e,t=[]){let i=[];return L.Children.forEach(e,(s,a)=>{if(!L.isValidElement(s))return;let d=[...t,a];if(s.type===L.Fragment){i.push.apply(i,Um(s.props.children,d));return}Qt(s.type===ro,`[${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||d.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=Um(s.props.children,d)),i.push(p)}),i}var gh="get",_h="application/x-www-form-urlencoded";function ld(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function oR(e){return ld(e)&&e.tagName.toLowerCase()==="button"}function lR(e){return ld(e)&&e.tagName.toLowerCase()==="form"}function cR(e){return ld(e)&&e.tagName.toLowerCase()==="input"}function uR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function hR(e,t){return e.button===0&&(!t||t==="_self")&&!uR(e)}var qu=null;function dR(){if(qu===null)try{new FormData(document.createElement("form"),0),qu=!1}catch{qu=!0}return qu}var fR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Bp(e){return e!=null&&!fR.has(e)?(or(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_h}"`),null):e}function pR(e,t){let i,s,a,d,p;if(lR(e)){let c=e.getAttribute("action");s=c?Vr(c,t):null,i=e.getAttribute("method")||gh,a=Bp(e.getAttribute("enctype"))||_h,d=new FormData(e)}else if(oR(e)||cR(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?Vr(h,t):null,i=e.getAttribute("formmethod")||c.getAttribute("method")||gh,a=Bp(e.getAttribute("formenctype"))||Bp(c.getAttribute("enctype"))||_h,d=new FormData(c,e),!dR()){let{name:f,type:g,value:m}=e;if(g==="image"){let S=f?`${f}.`:"";d.append(`${S}x`,"0"),d.append(`${S}y`,"0")}else f&&d.append(f,m)}}else{if(ld(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=gh,s=null,a=_h,p=e}return d&&a==="text/plain"&&(p=d,d=void 0),{action:s,method:i.toLowerCase(),encType:a,formData:d,body:p}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function a_(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ow(e,t,i,s){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:t&&Vr(a.pathname,t)==="/"?a.pathname=`${jh(t)}/_root.${s}`:a.pathname=`${jh(a.pathname)}.${s}`,a}async function mR(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 gR(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 _R(e,t,i){let s=await Promise.all(e.map(async a=>{let d=t.routes[a.route.id];if(d){let p=await mR(d,i);return p.links?p.links():[]}return[]}));return SR(s.flat(1).filter(gR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Zy(e,t,i,s,a,d){let p=(h,f)=>i[f]?h.route.id!==i[f].route.id:!0,c=(h,f)=>i[f].pathname!==h.pathname||i[f].route.path?.endsWith("*")&&i[f].params["*"]!==h.params["*"];return d==="assets"?t.filter((h,f)=>p(h,f)||c(h,f)):d==="data"?t.filter((h,f)=>{let g=s.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(p(h,f)||c(h,f))return!0;if(h.route.shouldRevalidate){let m=h.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function vR(e,t,{includeHydrateFallback:i}={}){return bR(e.map(s=>{let a=t.routes[s.route.id];if(!a)return[];let d=[a.module];return a.clientActionModule&&(d=d.concat(a.clientActionModule)),a.clientLoaderModule&&(d=d.concat(a.clientLoaderModule)),i&&a.hydrateFallbackModule&&(d=d.concat(a.hydrateFallbackModule)),a.imports&&(d=d.concat(a.imports)),d}).flat(1))}function bR(e){return[...new Set(e)]}function yR(e){let t={},i=Object.keys(e).sort();for(let s of i)t[s]=e[s];return t}function SR(e,t){let i=new Set;return new Set(t),e.reduce((s,a)=>{let d=JSON.stringify(yR(a));return i.has(d)||(i.add(d),s.push({key:d,link:a})),s},[])}function o_(){let e=L.useContext(No);return a_(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function xR(){let e=L.useContext(od);return a_(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var l_=L.createContext(void 0);l_.displayName="FrameworkContext";function c_(){let e=L.useContext(l_);return a_(e,"You must render this element inside a <HydratedRouter> element"),e}function wR(e,t){let i=L.useContext(l_),[s,a]=L.useState(!1),[d,p]=L.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:f,onMouseLeave:g,onTouchStart:m}=t,S=L.useRef(null);L.useEffect(()=>{if(e==="render"&&p(!0),e==="viewport"){let w=b=>{b.forEach(v=>{p(v.isIntersecting)})},_=new IntersectionObserver(w,{threshold:.5});return S.current&&_.observe(S.current),()=>{_.disconnect()}}},[e]),L.useEffect(()=>{if(s){let w=setTimeout(()=>{p(!0)},100);return()=>{clearTimeout(w)}}},[s]);let C=()=>{a(!0)},T=()=>{a(!1),p(!1)};return i?e!=="intent"?[d,S,{}]:[d,S,{onFocus:Ll(c,C),onBlur:Ll(h,T),onMouseEnter:Ll(f,C),onMouseLeave:Ll(g,T),onTouchStart:Ll(m,C)}]:[!1,S,{}]}function Ll(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function CR({page:e,...t}){let i=BA(),{router:s}=o_(),a=L.useMemo(()=>qx(s.routes,e,s.basename),[s.routes,e,s.basename]);return a?i?L.createElement(kR,{page:e,matches:a,...t}):L.createElement(TR,{page:e,matches:a,...t}):null}function ER(e){let{manifest:t,routeModules:i}=c_(),[s,a]=L.useState([]);return L.useEffect(()=>{let d=!1;return _R(e,t,i).then(p=>{d||a(p)}),()=>{d=!0}},[e,t,i]),s}function kR({page:e,matches:t,...i}){let s=cr(),{future:a}=c_(),{basename:d}=o_(),p=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=ow(e,d,a.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,f=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?h=!0:f.push(g.route.id);return h&&f.length>0&&c.searchParams.set("_routes",f.join(",")),[c.pathname+c.search]},[d,a.v8_trailingSlashAwareDataRequests,e,s,t]);return L.createElement(L.Fragment,null,p.map(c=>L.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...i})))}function TR({page:e,matches:t,...i}){let s=cr(),{future:a,manifest:d,routeModules:p}=c_(),{basename:c}=o_(),{loaderData:h,matches:f}=xR(),g=L.useMemo(()=>Zy(e,t,f,d,s,"data"),[e,t,f,d,s]),m=L.useMemo(()=>Zy(e,t,f,d,s,"assets"),[e,t,f,d,s]),S=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,_=!1;if(t.forEach(v=>{let y=d.routes[v.route.id];!y||!y.hasLoader||(!g.some(k=>k.route.id===v.route.id)&&v.route.id in h&&p[v.route.id]?.shouldRevalidate||y.hasClientLoader?_=!0:w.add(v.route.id))}),w.size===0)return[];let b=ow(e,c,a.v8_trailingSlashAwareDataRequests,"data");return _&&w.size>0&&b.searchParams.set("_routes",t.filter(v=>w.has(v.route.id)).map(v=>v.route.id).join(",")),[b.pathname+b.search]},[c,a.v8_trailingSlashAwareDataRequests,h,s,d,g,t,e,p]),C=L.useMemo(()=>vR(m,d),[m,d]),T=ER(m);return L.createElement(L.Fragment,null,S.map(w=>L.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),C.map(w=>L.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),T.map(({key:w,link:_})=>L.createElement("link",{key:w,nonce:i.nonce,..._,crossOrigin:_.crossOrigin??i.crossOrigin})))}function AR(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var RR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{RR&&(window.__reactRouterVersion="7.17.0")}catch{}function LR({basename:e,children:t,useTransitions:i,window:s}){let a=L.useRef();a.current==null&&(a.current=cA({window:s,v5Compat:!0}));let d=a.current,[p,c]=L.useState({action:d.action,location:d.location}),h=L.useCallback(f=>{i===!1?c(f):L.startTransition(()=>c(f))},[i]);return L.useLayoutEffect(()=>d.listen(h),[d,h]),L.createElement(sR,{basename:e,children:t,location:p.location,navigationType:p.action,navigator:d,useTransitions:i})}var lw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hc=L.forwardRef(function({onClick:t,discover:i="render",prefetch:s="none",relative:a,reloadDocument:d,replace:p,mask:c,state:h,target:f,to:g,preventScrollReset:m,viewTransition:S,defaultShouldRevalidate:C,...T},w){let{basename:_,navigator:b,useTransitions:v}=L.useContext(Oi),y=typeof g=="string"&&lw.test(g),k=Zx(g,_);g=k.to;let M=WA(g,{relative:a}),A=cr(),N=null;if(c){let F=ad(c,[],A.mask?A.mask.pathname:"/",!0);_!=="/"&&(F.pathname=F.pathname==="/"?_:sr([_,F.pathname])),N=b.createHref(F)}let[R,I,Y]=wR(s,T),z=DR(g,{replace:p,mask:c,state:h,target:f,preventScrollReset:m,relative:a,viewTransition:S,defaultShouldRevalidate:C,useTransitions:v});function q(F){t&&t(F),F.defaultPrevented||z(F)}let B=!(k.isExternal||d),W=L.createElement("a",{...T,...Y,href:(B?N:void 0)||k.absoluteURL||M,onClick:B?q:t,ref:AR(w,I),target:f,"data-discover":!y&&i==="render"?"true":void 0});return R&&!y?L.createElement(L.Fragment,null,W,L.createElement(CR,{page:M})):W});hc.displayName="Link";var MR=L.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:s="",end:a=!1,style:d,to:p,viewTransition:c,children:h,...f},g){let m=Lc(p,{relative:f.relative}),S=cr(),C=L.useContext(od),{navigator:T,basename:w}=L.useContext(Oi),_=C!=null&&zR(m)&&c===!0,b=T.encodeLocation?T.encodeLocation(m).pathname:m.pathname,v=S.pathname,y=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;i||(v=v.toLowerCase(),y=y?y.toLowerCase():null,b=b.toLowerCase()),y&&w&&(y=Vr(y,w)||y);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let M=v===b||!a&&v.startsWith(b)&&v.charAt(k)==="/",A=y!=null&&(y===b||!a&&y.startsWith(b)&&y.charAt(b.length)==="/"),N={isActive:M,isPending:A,isTransitioning:_},R=M?t:void 0,I;typeof s=="function"?I=s(N):I=[s,M?"active":null,A?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(N):d;return L.createElement(hc,{...f,"aria-current":R,className:I,ref:g,style:Y,to:p,viewTransition:c},typeof h=="function"?h(N):h)});MR.displayName="NavLink";var NR=L.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:s,replace:a,state:d,method:p=gh,action:c,onSubmit:h,relative:f,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:S,...C},T)=>{let{useTransitions:w}=L.useContext(Oi),_=BR(),b=PR(c,{relative:f}),v=p.toLowerCase()==="get"?"get":"post",y=typeof c=="string"&&lw.test(c),k=M=>{if(h&&h(M),M.defaultPrevented)return;M.preventDefault();let A=M.nativeEvent.submitter,N=A?.getAttribute("formmethod")||p,R=()=>_(A||M.currentTarget,{fetcherKey:t,method:N,navigate:i,replace:a,state:d,relative:f,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:S});w&&i!==!1?L.startTransition(()=>R()):R()};return L.createElement("form",{ref:T,method:v,action:b,onSubmit:s?h:k,...C,"data-discover":!y&&e==="render"?"true":void 0})});NR.displayName="Form";function OR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cw(e){let t=L.useContext(No);return Qt(t,OR(e)),t}function DR(e,{target:t,replace:i,mask:s,state:a,preventScrollReset:d,relative:p,viewTransition:c,defaultShouldRevalidate:h,useTransitions:f}={}){let g=Rc(),m=cr(),S=Lc(e,{relative:p});return L.useCallback(C=>{if(hR(C,t)){C.preventDefault();let T=i!==void 0?i:uc(m)===uc(S),w=()=>g(e,{replace:T,mask:s,state:a,preventScrollReset:d,relative:p,viewTransition:c,defaultShouldRevalidate:h});f?L.startTransition(()=>w()):w()}},[m,g,S,i,s,a,t,e,d,p,c,h,f])}var jR=0,IR=()=>`__${String(++jR)}__`;function BR(){let{router:e}=cw("useSubmit"),{basename:t}=L.useContext(Oi),i=tR(),s=e.fetch,a=e.navigate;return L.useCallback(async(d,p={})=>{let{action:c,method:h,encType:f,formData:g,body:m}=pR(d,t);if(p.navigate===!1){let S=p.fetcherKey||IR();await s(S,i,p.action||c,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:g,body:m,formMethod:p.method||h,formEncType:p.encType||f,flushSync:p.flushSync})}else await a(p.action||c,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:g,body:m,formMethod:p.method||h,formEncType:p.encType||f,replace:p.replace,state:p.state,fromRouteId:i,flushSync:p.flushSync,viewTransition:p.viewTransition})},[s,a,t,i])}function PR(e,{relative:t}={}){let{basename:i}=L.useContext(Oi),s=L.useContext(Sr);Qt(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),d={...Lc(e||".",{relative:t})},p=cr();if(e==null){d.search=p.search;let c=new URLSearchParams(d.search),h=c.getAll("index");if(h.some(g=>g==="")){c.delete("index"),h.filter(m=>m).forEach(m=>c.append("index",m));let g=c.toString();d.search=g?`?${g}`:""}}return(!e||e===".")&&a.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:sr([i,d.pathname])),uc(d)}function zR(e,{relative:t}={}){let i=L.useContext(ew);Qt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=cw("useViewTransitionState"),a=Lc(e,{relative:t});if(!i.isTransitioning)return!1;let d=Vr(i.currentLocation.pathname,s)||i.currentLocation.pathname,p=Vr(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Dh(a.pathname,p)!=null||Dh(a.pathname,d)!=null}var js=Gx();const HR=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class dt extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function $R(e){const t=await fetch("/api/v1/theaters",{signal:e});await Yn(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new dt(t.status,"Invalid Theater response");return{theaters:i.theaters.map(s=>pw(s,t.status))}}async function FR(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/status${i}`,{signal:t});return await Yn(s),ZR(await s.json(),s.status)}async function UR(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const i=t.size>0?`?${t}`:"",s=await fetch(`/api/v1/updates/release-notes${i}`,{signal:e.signal});return await Yn(s),QR(await s.json(),s.status)}async function WR(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await Yn(t),JR(await t.json(),t.status)}async function uw(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await Yn(i);const s=await i.json();return pw(s,i.status)}async function GR(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 Yn(i),rL(await i.json(),i.status)}async function hw(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 Yn(i);const s=await i.json();if(typeof s.folderGrantId!="string")throw new dt(i.status,"Invalid folder grant response");return s.folderGrantId}async function qR(e,t,i){const s=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t}),signal:i});return await Yn(s),await s.json()}async function KR(e,t,i,s){const a=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t,name:i}),signal:s});return await Yn(a),await a.json()}async function VR(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Yn(i)}async function _i(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/operations${i}`,{signal:t});await Yn(s);const a=await s.json();if(!Array.isArray(a.operations))throw new dt(s.status,"Invalid operations response");return a.operations.map(d=>fw(d,s.status))}async function ia(e,t){const s=await fetch("/api/v1/operations/groups",{signal:t});await Yn(s);const a=await s.json();if(!Array.isArray(a.groups))throw new dt(s.status,"Invalid groups response");return a.groups.map(d=>u_(d,s.status))}async function YR(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await Yn(i);const s=await i.json();return u_(s.group,i.status)}async function Pp(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 Yn(s);const a=await s.json();return u_(a.group,s.status)}async function XR(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Yn(i)}async function dw(e,t,i){return vh(e,{title:t},i)}async function vh(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 Yn(s);const a=await s.json();return fw(a.operation,s.status)}function fw(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"||dc(i)||dc(i.payload))throw new dt(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 u_(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 dt(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function pw(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"||dc(i))throw new dt(t,"Invalid Theater response");return i}function ZR(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 dt(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 JR(e,t){const i=e;if(!i||i.status!=="accepted")throw new dt(t,"Invalid update response");return{status:"accepted"}}function QR(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 dt(t,"Invalid release notes response");return{notes:i.notes.map(s=>eL(s,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function eL(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections)||typeof i.localizationFallback!="boolean")throw new dt(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(s=>tL(s,t)),localizationFallback:i.localizationFallback}}function tL(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 dt(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(s=>nL(s,t))}}function nL(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(s=>typeof s=="string")||typeof i.text!="string"||"product"in i&&!iL(i.product))throw new dt(t,"Invalid release notes response");return"product"in i?{packageTags:i.packageTags,text:i.text,product:i.product}:{packageTags:i.packageTags,text:i.text}}function iL(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function rL(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)||dc(i))throw new dt(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=>sL(s,t)),truncated:i.truncated===!0?!0:void 0}}function sL(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||dc(i))throw new dt(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function dc(e){if(!e||typeof e!="object")return!1;const t=e;return HR.some(i=>i in t)}async function Yn(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 dt(e.status,t)}function Jy(e,t){return e!==null&&e===t?e:null}function aL(e,t){return e&&t}function oL(e,t){return e?!1:t}const lL="__unassigned__";function cL(e){const t=new Map(e.theaters.map(s=>[s.id,s])),i=[];for(const s of e.operations)s.theaterId&&i.push(dL(s,t.get(s.theaterId)));return i}function uL(e,t){const i=mw(t);return i.length===0?e:e.filter(s=>{const a=fL(s);return i.every(d=>a.includes(d))})}function hL(e){const t=[],i=new Map;for(const s of e){const a=s.theaterId??lL,d=i.get(a);if(d!==void 0){const p=t[d];p&&(t[d]={...p,entries:[...p.entries,s]});continue}i.set(a,t.length),t.push({theaterId:s.theaterId,theaterLabel:s.theaterLabel,entries:[s]})}return t}function mw(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function dL(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function fL(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const pL=200,mL=.5,gL="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",_L=["monospace","serif","sans-serif"],ql=new Map;function vL(e,t={}){const i=cd(e);if(!i)return!1;const s=i.toLocaleLowerCase(),a=ql.get(s);if(a!==void 0)return a;const d=t.document??globalThis.document;if(!d)return!1;const p=d.createElement("canvas").getContext("2d");if(!p)return!1;const c=_L.some(h=>{const f=Qy(p,`${gw(i)}, ${h}`),g=Qy(p,h);return Math.abs(f-g)>mL});return bL(s,c,t.maxEntries??pL),c}function gw(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ih(e,t){const i=cd(e);return i?`${gw(i)}, ${t}`:t}function cd(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Qy(e,t){return e.font=`28px ${t}`,e.measureText(gL).width}function bL(e,t,i){if(ql.size>=Math.max(1,i)){const s=ql.keys().next().value;s&&ql.delete(s)}ql.set(e,t)}const go={min:12,max:18,step:1,defaultValue:14},nc={source:"builtin",id:"manrope",size:go.defaultValue},Bh=[{id:"manrope",label:"Fleet UI",name:"Manrope",description:"Balanced · Fleet default",family:'"Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Manrope","Fleet UI"]},{id:"jetbrains-mono",label:"Instrument Mono",name:"JetBrains Mono",description:"Uniform · technical scan",family:'"JetBrains Mono Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["JetBrains Mono","Instrument Mono"]},{id:"source-code-pro",label:"Source Mono",name:"Source Code Pro",description:"Open forms · compact",family:'"Source Code Pro Variable", "Manrope Variable", "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',aliases:["Source Code Pro","Source Mono"]}];function yL(e){if(!e||typeof e!="object")return nc;const t=e,i=SL(t.size);if(t.source==="builtin"&&wL(t.id))return{source:"builtin",id:t.id,size:i};if(t.source==="system"&&typeof t.familyName=="string"){const s=cd(t.familyName);if(s)return{source:"system",familyName:s,size:i}}return nc}function SL(e){return typeof e!="number"||!Number.isInteger(e)||e<go.min||e>go.max?go.defaultValue:e}function _w(e){return e.source==="system"?Ih(e.familyName,Bh[0].family):xL(e.id).family}function xL(e){return Bh.find(t=>t.id===e)??Bh[0]}function wL(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const Wm="fleet-console.activeTheaterId",vw="fleet-console.commissioningSeen",bw="fleet-console.whatsNewSeenVersion",yw="fleet-console.notificationPreferences",Sw=1,CL="instrument",Ku={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Gm=new Set;let e1=0,qm=null,We={connection:"connecting",connectionError:null,activeTheme:CL,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:QL(),codexReader:null,codexReaderExpanded:!1};function fc(){return We}function xw(e){return Gm.add(e),()=>{Gm.delete(e)}}function it(e){We={...We,...e},YL()}function EL(e){We.operationsViewActive!==e&&it({operationsViewActive:e})}function Ph(e){LL(e),it({activeTheme:e})}function Km(e){NL(e)}function kL(e){it({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,...Lw({...We,version:e.version})})}function TL(){it({releaseNotesLoading:!0,releaseNotesError:null})}function AL(e){const t={...We,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:We.selectedReleaseNoteKey&&Nw(e.notes,We.selectedReleaseNoteKey)?We.selectedReleaseNoteKey:Mw(e.notes)};it({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...Lw(t)})}function RL(e){it({releaseNotesLoading:!1,releaseNotesError:e})}function LL(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function ML(){if(!(typeof document>"u"||typeof navigator>"u")&&navigator.userAgent.includes("Electron")){document.documentElement.setAttribute("data-desktop-shell","true");const e=navigator.userAgent.includes("Windows")?"win32":navigator.userAgent.includes("Mac OS X")?"darwin":"linux";document.documentElement.setAttribute("data-desktop-platform",e)}}function NL(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",_w(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function OL(e){const t=Rw(e,We.activeTheaterId);it({theaters:e,activeTheaterId:t})}function DL(e){OL(e.theaters)}function Mi(e){it({operations:e,operationsHydrated:!0})}function jL(e){const t=new Set(e.map(s=>s.id)),i=We.operations.filter(s=>!t.has(s.id));it({operations:[...e,...i],operationsHydrated:!0})}function IL(e){const t=We.operations.findIndex(s=>s.id===e.id);if(t===-1)return;const i=[...We.operations];i[t]=e,it({operations:i})}function ra(e){it({groups:e})}function BL(e){ud(e),it({activeTheaterId:e})}function gi(e){We.activeOperationId!==e&&it({activeOperationId:e})}function PL(e,t){if(t==="idle"){ww(e);return}We.operationStatus[e]!==t&&it({operationStatus:{...We.operationStatus,[e]:t}})}function ww(e){if(!(e in We.operationStatus))return;const t={...We.operationStatus};delete t[e],it({operationStatus:t})}function zL(e){if(!e.operationId)return;const t=We.operations.find(p=>p.id===e.operationId);if(!t)return;const i=t.theaterId??null,s=We.theaters.find(p=>p.id===i)?.label??i??"Unknown",a=t.title,d=ZL(e.kind);e1+=1,it({operationNotifications:{...We.operationNotifications,[e.operationId]:{kind:d,operationId:e.operationId,theaterId:i,theaterLabel:s,operationLabel:a,lastRaisedSeq:e1}}})}function Cw(){it({addingTheater:!0,theaterError:null})}function Ew(e){const t=[e,...We.theaters.filter(i=>i.id!==e.id)];ud(e.id),it({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function HL(){it({addingTheater:!1,theaterError:null})}function Vm(e){it({addingTheater:!1,theaterError:e})}function pc(e){const t=We.operations.find(i=>i.id===e);t&&(ud(t.theaterId),it({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:Aw(We.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function zp(){We.pendingOperationFocus!==null&&it({pendingOperationFocus:null})}function $L(e,t,i){if(e.length===0)return null;const s=t?e.indexOf(t):-1,a=s===-1?i>0?0:e.length-1:(s+i+e.length)%e.length;return e[a]??null}function h_(e,t){if(t.length===0)return[...e].sort(Ym);const i=new Map(t.map((s,a)=>[s,a]));return[...e].sort((s,a)=>{const d=i.get(s.id),p=i.get(a.id);return d!==void 0&&p!==void 0?d-p:d!==void 0?-1:p!==void 0?1:Ym(s,a)})}function kw(e,t,i,s=[]){const a=h_(e,i),d=new Set(s),p=[...t].sort((h,f)=>h.order-f.order||h.createdAt-f.createdAt),c=new Map;for(const h of p)c.set(h.id,[]);c.set(null,[]);for(const h of a){const f=h.groupId??null;f!==null&&c.has(f)?c.get(f).push(h):c.get(null).push(h)}return[...p.filter(h=>!d.has(h.id)).flatMap(h=>c.get(h.id)??[]),...c.get(null)??[]]}function Ym(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Hp(){it({operationSearchOpen:!1})}function Tw(){it({operationSearchOpen:!We.operationSearchOpen})}function FL(){We.releaseNotes.length===0||We.whatsNewOpen||it({whatsNewOpen:!0,selectedReleaseNoteKey:We.selectedReleaseNoteKey??Mw(We.releaseNotes)})}function Vu(){We.whatsNewOpen&&(We.automaticWhatsNewVersion&&i3(We.automaticWhatsNewVersion),it({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function t1(e){Nw(We.releaseNotes,e)&&it({selectedReleaseNoteKey:e})}function Ml(){t3(!0),We.onboardingOpen&&it({onboardingOpen:!1})}function qr(e){it({codexReader:e,codexReaderExpanded:!1})}function bh(){We.codexReader!==null&&it({codexReaderExpanded:!0})}function UL(){it({codexReaderExpanded:!1})}function $p(){it({codexReader:null,codexReaderExpanded:!1})}function n1(){if(We.bootstrapped)return;const e=We.theaters.length===0&&!e3();it({bootstrapped:!0,onboardingOpen:e?!0:We.onboardingOpen})}function i1(e){const t=We.theaters.filter(p=>p.id!==e),i=Rw(t,We.activeTheaterId===e?null:We.activeTheaterId),s=XL(We.operationNotifications,e),a=new Set(We.operations.filter(p=>p.theaterId===e).map(p=>p.id)),d=We.activeOperationId&&a.has(We.activeOperationId)?null:We.activeOperationId;ud(i),it({theaters:t,activeTheaterId:i,activeOperationId:d,operationNotifications:s})}function WL(e){const t=Aw(We.operationNotifications,e);t!==We.operationNotifications&&it({operationNotifications:t})}function GL(e){const t={...We.notificationPreferences,globalMute:e};f_(t),it({notificationPreferences:t})}function qL(e){const t={...We.notificationPreferences,dnd:e};f_(t),it({notificationPreferences:t})}function KL(e){const t={...We.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...We.notificationPreferences,mutedTheaterIds:t};f_(i),it({notificationPreferences:i})}function VL(e){return cL(e)}function YL(){for(const e of Gm)e()}function Aw(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function XL(e,t){let i=!1;const s={};for(const[a,d]of Object.entries(e)){if(d.theaterId===t){i=!0;continue}s[a]=d}return i?s:e}function Rw(e,t){const i=new Set(e.map(a=>a.id)),s=JL();return s&&i.has(s)?s:t&&i.has(t)?t:e[0]?.id??null}function ZL(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function Lw(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||n3()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:d_(i.version,t)}}function Mw(e){return e[0]?d_(e[0].version,0):null}function Nw(e,t){return e.some((i,s)=>d_(i.version,s)===t)}function d_(e,t){return`${e}:${t}`}function JL(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Wm)}catch{return null}}function ud(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Wm,e):window.localStorage.removeItem(Wm)}catch{}}function QL(){if(typeof window>"u")return Ku;try{const e=window.localStorage.getItem(yw);if(!e)return Ku;const t=JSON.parse(e);return r3(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Ku}catch{return Ku}}function e3(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vw)==="1"}catch{return!1}}function t3(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(vw,"1")}catch{}}function n3(){if(qm!==null)return qm;if(typeof window>"u")return null;try{return window.localStorage.getItem(bw)}catch{return null}}function i3(e){if(qm=e,!(typeof window>"u"))try{window.localStorage.setItem(bw,e)}catch{}}function f_(e){if(!(typeof window>"u"))try{window.localStorage.setItem(yw,JSON.stringify({version:Sw,preferences:e}))}catch{}}function r3(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==Sw||!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"}function ur(){return L.useSyncExternalStore(xw,fc,fc)}const s3=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{combos:[["Mod","B"]],description:"Toggle the left sidebar"},{combos:[["Mod","Alt","B"]],description:"Toggle the right activity rail"},{combos:[["Esc"]],description:"Close the open overlay or menu"}]},{title:"Operations",entries:[{combos:[["Esc"]],description:"Close the carrier job stream"},{combos:[["Shift","Enter"]],description:"Insert a newline in the terminal instead of submitting"},{combos:[["Enter"],["Esc"]],description:"Confirm or cancel a session rename"},{combos:[["↑"],["↓"]],description:"Move between Theater, Theme, and launch menu items"}]},{title:"Map",entries:[{combos:[["Alt","←"],["Alt","→"]],description:"Focus the previous / next Operation"},{combos:[["Alt","F"]],description:"Toggle Formation view"},{combos:[["Drag"]],description:"Pan the operations map"},{combos:[["Shift","Drag"]],description:"Draw a new Operation terminal"},{combos:[["Space","Drag"]],description:"Pan even while a terminal has focus"},{combos:[["Scroll"]],description:"Zoom the map in or out"},{combos:[["Right-click"]],description:"Open the canvas actions menu"},{combos:[["Double-click"]],description:"Focus an Operation from its title bar; rename from its name"},{combos:[["Click"]],description:"Clear terminal focus on the empty canvas"}]},{title:"Codex",entries:[{combos:[["Mod","K"]],description:"Toggle the command palette"},{combos:[["↑"],["↓"]],description:"Move through command palette results"},{combos:[["Enter"]],description:"Open the selected result"},{combos:[["Tab"]],description:"Move focus within the command palette"},{combos:[["Esc"]],description:"Close the command palette or diagram lightbox"},{combos:[["+"],["−"],["0"]],description:"Zoom the diagram lightbox in / out / reset"},{combos:[["F"]],description:"Fit the diagram lightbox to the viewport"}]}],Kl="data-keyboard-shortcuts-open",a3='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ow(){return document.body.getAttribute(Kl)==="true"}function o3(){return!Ow()}function l3({onClose:e}){const t=L.useRef(null);L.useEffect(()=>{const s=t.current,a=document.querySelector(".console-shell"),d=document.body.getAttribute(Kl);return document.body.setAttribute(Kl,"true"),a&&(a.inert=!0),s?.focus(),()=>{d===null?document.body.removeAttribute(Kl):document.body.setAttribute(Kl,d),a&&(a.inert=!1)}},[e]);const i=s=>{if(s.key==="Escape"){s.preventDefault(),e();return}if(s.key!=="Tab")return;const a=[...t.current?.querySelectorAll(a3)??[]];if(a.length===0){s.preventDefault(),t.current?.focus();return}const d=a[0],p=a[a.length-1],c=document.activeElement;(c===t.current||!t.current?.contains(c)||(s.shiftKey?c===d:c===p))&&(s.preventDefault(),(s.shiftKey?p:d)?.focus())};return js.createPortal(l.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:l.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:i,onMouseDown:s=>s.stopPropagation(),children:[l.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[l.jsx("strong",{children:"Keyboard Shortcuts"}),l.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),s3.map(s=>l.jsxs("section",{className:"keyboard-shortcuts-group",children:[l.jsx("h3",{children:s.title}),l.jsx("dl",{children:s.entries.map(a=>l.jsxs("div",{children:[l.jsx("dt",{children:a.combos.map((d,p)=>l.jsxs("span",{children:[p>0?" or ":null,d.map(c=>l.jsx("kbd",{children:c==="Mod"?"⌘/Ctrl":c},c))]},d.join("+")))}),l.jsx("dd",{children:a.description})]},`${s.title}:${a.description}`))})]},s.title))]})}),document.body)}const c3=1400,u3="https://github.com/sbluemin/fleet-harness",h3="https://github.com/sbluemin/fleet-harness/stargazers",d3="https://api.github.com/repos/sbluemin/fleet-harness",p_="fleet-console.github-stars",f3=360*60*1e3,r1='[role="menuitem"]:not([disabled])';function p3(){const e=ur();return l.jsxs("div",{className:"side-bar-brand-foot",children:[l.jsx(g3,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),l.jsx(_3,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function m3({className:e="brand-foot-home"}){return l.jsxs(hc,{className:e,to:"/operations","aria-label":"Operations",children:[l.jsx(A3,{}),l.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function g3({latestVersion:e,updateAvailable:t}){const i=L.useRef(null),s=L.useRef(null),a=L.useRef(null),[d,p]=L.useState(!1),c=Rc();Dw(i,s,a,d,p);const h=f=>{p(!1),c(f),window.requestAnimationFrame(()=>{const g=document.querySelector("main h2, h2");g?.focus?.(),g&&document.activeElement!==g&&(g.setAttribute("tabindex","-1"),g.focus())})};return l.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[l.jsxs("button",{ref:s,type:"button",className:"brand-foot-system-trigger",onClick:()=>p(f=>!f),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"System Menu",title:"System Menu",children:[l.jsx(s1,{}),l.jsx("span",{children:"System Menu"})]}),d?l.jsxs("div",{ref:a,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/settings"),children:[l.jsx(s1,{}),l.jsx("span",{children:"Settings"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/carrier-settings"),children:[l.jsx(R3,{}),l.jsx("span",{children:"Carriers"})]}),t?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),l.jsx(v3,{latestVersion:e})]}):null]}):null]})}function _3({releaseDisabled:e,version:t}){const i=L.useRef(null),s=L.useRef(null),a=L.useRef(null),[d,p]=L.useState(!1),[c,h]=L.useState(!1);return Dw(i,s,a,d,p),l.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[l.jsx("button",{ref:s,type:"button",className:"brand-foot-help-trigger",onClick:()=>p(f=>!f),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"Help",title:"Help",children:l.jsx(L3,{})}),d?l.jsxs("div",{ref:a,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[l.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{p(!1),FL()},children:[l.jsx(M3,{}),l.jsx("span",{children:"What's New"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{p(!1),h(!0)},children:[l.jsx(N3,{}),l.jsx("span",{children:"Keyboard Shortcuts"})]}),l.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),l.jsx(b3,{menuItem:!0,version:t})]}):null,c?l.jsx(l3,{onClose:()=>{h(!1),s.current?.focus()}}):null]})}function Dw(e,t,i,s,a){L.useEffect(()=>{if(!s)return;const d=window.requestAnimationFrame(()=>{i.current?.querySelector(r1)?.focus()}),p=h=>{h.target instanceof Node&&e.current?.contains(h.target)||a(!1)},c=h=>{if(h.key==="Escape"){a(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(h.key))return;const f=[...i.current?.querySelectorAll(r1)??[]];if(f.length===0)return;h.preventDefault();const g=f.findIndex(S=>S===document.activeElement),m=h.key==="Home"||h.key==="ArrowDown"&&g===f.length-1?0:h.key==="End"||h.key==="ArrowUp"&&g<=0?f.length-1:h.key==="ArrowDown"?g+1:g-1;f[m]?.focus()};return window.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",c,!0),()=>{window.cancelAnimationFrame(d),window.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",c,!0)}},[i,s,e,a,t])}function v3({latestVersion:e}){const[t,i]=L.useState("idle"),[s,a]=L.useState(null),d=L.useRef(null),p=y3(t,s,e);L.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]);const c=async()=>{if(!p.disabled){d.current!==null&&(window.clearTimeout(d.current),d.current=null),i("applying"),a(null);try{if((await WR()).status!=="accepted"){i("error"),a("invalid_response");return}i("accepted"),d.current=window.setTimeout(()=>{d.current=null,i("completed")},c3)}catch(h){const f=h instanceof dt?h.message:"network_error";a(f),i(x3(f)?"blocked":"error")}}};return l.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${p.tone}`,onClick:c,disabled:p.disabled,title:p.title,"aria-live":"polite",children:p.label})}function b3({menuItem:e=!1,version:t}){const i=w3(),s=i.count!==null;return l.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[l.jsx("a",{className:"brand-foot-github-link",href:u3,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:l.jsx(O3,{})}),l.jsxs("a",{className:"brand-foot-github-stars",href:h3,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":s?`GitHub stars ${i.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[l.jsx(D3,{}),s?l.jsx("span",{className:"brand-foot-github-stars-count",children:T3(i.count)}):null]}),l.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function y3(e,t,i){const s=i?`Latest version ${i}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?S3(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:s,tone:"warn",disabled:!1}}function S3(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",tone:"blocked",disabled:!0}:e==="managed_runtime_update_requires_relaunch"?{label:"Update and Restart",title:"This managed Console installation updates through Fleet Console Desktop. Use Desktop Update and Restart.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"Busy",title:"Another update is already in progress.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"Current",title:"The server re-check found no update to apply.",tone:"blocked",disabled:!0}:{label:"Blocked",title:"The console is not ready to start an update. Try again shortly.",tone:"error",disabled:!1}}function x3(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function w3(){const[e,t]=L.useState(()=>{const i=C3();return i===null?{count:null,status:"idle"}:{count:i,status:"ready"}});return L.useEffect(()=>{if(E3())return;let i=!1;return t(s=>s.status==="ready"?s:{...s,status:"loading"}),fetch(d3,{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 a=typeof s.stargazers_count=="number"?s.stargazers_count:null;if(a===null){t(d=>({count:d.count,status:d.count===null?"error":"ready"}));return}k3(a),t({count:a,status:"ready"})}).catch(()=>{i||t(s=>({count:s.count,status:s.count===null?"error":"ready"}))}),()=>{i=!0}},[]),e}function C3(){try{const e=window.localStorage.getItem(p_);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function E3(){try{const e=window.localStorage.getItem(p_);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<f3}catch{return!1}}function k3(e){try{window.localStorage.setItem(p_,JSON.stringify({count:e,at:Date.now()}))}catch{}}function T3(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function A3(){return l.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),l.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),l.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),l.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),l.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),l.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function R3(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),l.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),l.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),l.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function s1(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),l.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function L3(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function M3(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function N3(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function O3(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 D3(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 j3=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class ar extends Error{status;constructor(t,i){super(i),this.status=t}}async function I3(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await dd(i),Iw(await i.json(),i.status)}async function jw(e,t,i){t!==null&&Bw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:i});return await dd(s),Iw(await s.json(),s.status)}async function B3(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await dd(i),z3(await i.json(),i.status)}async function P3(e,t,i){t!==null&&Bw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:i});return await dd(s),H3(await s.json(),s.status)}function Iw(e,t=200){mc(e,t);const i=e;if(i.kind!=="root"&&i.kind!=="worktree"&&i.kind!=="directory"||!Pw(i.label))throw new ar(t,"Invalid path context response");if(i.relPath!==null&&(typeof i.relPath!="string"||!hd(i.relPath)))throw new ar(t,"Invalid path context response");if(i.kind==="root"!=(i.relPath===null))throw new ar(t,"Invalid path context response");return{kind:i.kind,relPath:i.relPath,label:i.label}}function z3(e,t=200){mc(e,t);const i=e;if(typeof i.isGitRepo!="boolean"||!Array.isArray(i.worktrees))throw new ar(t,"Invalid worktrees response");return{isGitRepo:i.isGitRepo,worktrees:i.worktrees.map(s=>{mc(s,t);const a=s;if(typeof a.relPath!="string"||!hd(a.relPath)||a.branch!==null&&typeof a.branch!="string"||typeof a.isCurrent!="boolean")throw new ar(t,"Invalid worktrees response");return{relPath:a.relPath,branch:a.branch,isCurrent:a.isCurrent}})}}function H3(e,t=200){mc(e,t);const i=e;if(!Array.isArray(i.directories))throw new ar(t,"Invalid directories response");return i.directories.map(s=>{mc(s,t);const a=s;if(typeof a.relPath!="string"||!hd(a.relPath)||!Pw(a.label))throw new ar(t,"Invalid directories response");return{relPath:a.relPath,label:a.label}})}function Bw(e){if(!hd(e))throw new ar(400,"Invalid relative path")}function hd(e){return e.length>0&&e.length<=4096&&!e.includes("\0")&&!e.includes("\\")&&!e.startsWith("/")&&!/^[A-Za-z]:/.test(e)&&!e.split("/").some(t=>t===""||t==="."||t==="..")}function Pw(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function mc(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new ar(t,"Invalid path context response");for(const i of Object.keys(e))if(j3.has(i.toLowerCase()))throw new ar(t,"Unsafe path context response")}async function dd(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ar(e.status,t)}function $3({theaterId:e,parentPath:t,selectedRelPath:i,isDisabled:s,loadDirectories:a,onSelect:d}){const[p,c]=L.useState(null),[h,f]=L.useState(null);return L.useEffect(()=>{const g=new AbortController;return c(null),f(null),a(t,g.signal).then(c).catch(m=>{g.signal.aborted||f(m instanceof Error?m.message:"Unable to load directories")}),()=>g.abort()},[e,t,a]),h?L.createElement("div",{className:"rail-context-tree-status"},h):p?L.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},p.map(g=>L.createElement(zw,{key:g.relPath,directory:g,theaterId:e,depth:0,selectedRelPath:i,isDisabled:s,loadDirectories:a,onSelect:d}))):L.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function zw({directory:e,theaterId:t,depth:i,selectedRelPath:s,isDisabled:a,loadDirectories:d,onSelect:p}){const[c,h]=L.useState(!1),[f,g]=L.useState(null),[m,S]=L.useState(!1),C=L.useCallback(()=>{if(c){h(!1);return}if(h(!0),f)return;const _=new AbortController;S(!0),d(e.relPath,_.signal).then(g).catch(()=>g([])).finally(()=>S(!1))},[f,e.relPath,c,d]),T=L.createElement("div",{className:`rail-context-tree-row${i>0?" is-nested":""}`,style:{paddingLeft:`${i*16}px`}},L.createElement("button",{className:`rail-context-expand${c?" is-expanded":""}`,type:"button",disabled:a,"aria-label":`${c?"Collapse":"Expand"} ${e.label}`,onClick:C},"▸"),L.createElement("button",{className:`rail-context-select${s===e.relPath?" is-selected":""}`,type:"button",disabled:a,onClick:()=>p(e.relPath)},L.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),L.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),L.createElement("span",{className:"rail-context-row-label"},e.label))),w=c&&f?.map(_=>L.createElement(zw,{key:_.relPath,directory:_,theaterId:t,depth:i+1,selectedRelPath:s,isDisabled:a,loadDirectories:d,onSelect:p}));return L.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":c},T,c&&m?L.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,w)}const Hw=L.forwardRef(function({className:t,theaterId:i,theaterLabel:s,context:a,isMutating:d,onSelect:p,onClose:c},h){const[f,g]=L.useState(null);L.useEffect(()=>{const C=new AbortController;return B3(i,C.signal).then(g).catch(()=>g({isGitRepo:!1,worktrees:[]})),()=>C.abort()},[i]),L.useEffect(()=>{const C=T=>{T.key==="Escape"&&c()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);const m=L.useCallback((C,T)=>P3(i,C,T),[i]),S=L.useCallback(C=>{d||p(C)},[d,p]);return l.jsxs("div",{ref:h,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[l.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),l.jsxs("button",{className:`rail-context-row${a.relPath===null?" is-selected":""}`,type:"button",disabled:d,onClick:()=>S(null),children:[l.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),l.jsx("span",{className:"rail-context-row-label",children:s}),l.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),l.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[l.jsx("h3",{children:"DIRECTORIES"}),l.jsx($3,{theaterId:i,parentPath:null,selectedRelPath:a.relPath,isDisabled:d,loadDirectories:m,onSelect:S},`${i}:${a.relPath??"root"}`)]}),f?.isGitRepo?l.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[l.jsx("h3",{children:"WORKTREES"}),f.worktrees.map(C=>l.jsxs("button",{className:`rail-context-row${a.relPath===C.relPath?" is-selected":""}`,type:"button",title:C.relPath,disabled:d,onClick:()=>S(C.relPath),children:[l.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),l.jsx("span",{className:"rail-context-row-label",children:C.relPath.split("/").at(-1)}),C.branch?l.jsx("span",{className:"rail-context-row-secondary",children:C.branch}):null]},C.relPath))]}):null,l.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),Xm="fleet-console.rail.activePanelId",$w="fleet-console.rail.chromeExpanded",Zm=new Set,la=new Map,Jm=new Map,_o=new Map,ic=new Map;let zh=null,Vl=0,mt={activeRailPanelId:X3(),railChromeExpanded:Z3(),rightRailWidth:44,panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function F3(e,t,i){return!e||t===null||i}function Mc(e){return Zm.add(e),()=>{Zm.delete(e)}}function Nc(){return mt}function U3(e){const t=mt.activeRailPanelId===e?null:e;vi({...mt,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),Vw(t)}function W3(){mt.activeRailPanelId!==null&&(vi({...mt,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),Vw(null))}function G3(e){mt.railChromeExpanded!==e&&(vi({...mt,railChromeExpanded:e,isPathContextDeckOpen:!1}),J3(e))}function Fw(){G3(!mt.railChromeExpanded)}function a1(e){const t=Number.isFinite(e)?Math.max(0,e):0;mt.rightRailWidth!==t&&vi({...mt,rightRailWidth:t})}function q3(e,t){if(e!==mt.activeRailPanelId)return;const i=t===null||!Number.isFinite(t)?0:t,s=Math.max(0,Math.round(i)),a=typeof window<"u"?Math.min(s,Math.max(0,window.innerWidth-548)):s;a!==mt.panelExtraWidth&&vi({...mt,panelExtraWidth:a})}function Uw(e){zh?.abort(),zh=null,Vl+=1;const t=e?la.get(e):void 0;vi({...mt,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&Yw(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function K3(e,t){mt.pathContextTheaterId!==e&&Uw(e),zh?.abort();const i=new AbortController;zh=i;const s=++Vl,a=ic.get(e)??0;la.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),mt.pathContextTheaterId===e&&vi({...mt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(Jm.get(e)??Promise.resolve()),i.signal.aborted||s!==Vl)return;const d=await t(i.signal);if(i.signal.aborted||s!==Vl||a!==(ic.get(e)??0))return;const p={context:d,isHydrated:!0,isLoading:!1,error:null};la.set(e,p),mt.pathContextTheaterId===e&&vi({...mt,pathContext:d,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(d){if(i.signal.aborted||s!==Vl||a!==(ic.get(e)??0))return;const p=d instanceof Error?d.message:"Unable to load path context";la.set(e,{context:null,isHydrated:!1,isLoading:!1,error:p}),mt.pathContextTheaterId===e&&vi({...mt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:p})}}async function Ww(e,t){if(mt.pathContextTheaterId!==e)return null;ic.set(e,(ic.get(e)??0)+1),eM(e);const s=(Jm.get(e)??Promise.resolve()).then(()=>Q3(e,t));return Jm.set(e,s.then(()=>{})),s}function yh(e){e!==mt.isPathContextDeckOpen&&vi({...mt,isPathContextDeckOpen:e})}function Gw(){return L.useSyncExternalStore(Mc,Nc).activeRailPanelId}function qw(){return L.useSyncExternalStore(Mc,Nc).railChromeExpanded}function V3(){return L.useSyncExternalStore(Mc,Nc).rightRailWidth}function Y3(){return L.useSyncExternalStore(Mc,Nc).panelExtraWidth}function Kw(){return L.useSyncExternalStore(Mc,Nc)}function X3(){try{return localStorage.getItem(Xm)}catch{return null}}function Z3(){try{return localStorage.getItem($w)!=="0"}catch{return!0}}function Vw(e){try{e===null?localStorage.removeItem(Xm):localStorage.setItem(Xm,e)}catch{}}function J3(e){try{localStorage.setItem($w,e?"1":"0")}catch{}}async function Q3(e,t){try{const i=await t(new AbortController().signal),s={context:i,isHydrated:!0,isLoading:!1,error:null};return la.set(e,s),mt.pathContextTheaterId===e&&vi({...mt,pathContext:i,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),i}catch(i){const s=i instanceof Error?i.message:"Unable to save path context",a=la.get(e);return la.set(e,{context:a?.context??null,isHydrated:a?.isHydrated??!1,isLoading:!1,error:s}),mt.pathContextTheaterId===e&&vi({...mt,pathContextError:s}),null}finally{tM(e)}}function Yw(e){return(_o.get(e)??0)>0}function eM(e){_o.set(e,(_o.get(e)??0)+1),mt.pathContextTheaterId===e&&vi({...mt,pathContextMutationInProgress:!0,pathContextError:null})}function tM(e){const t=(_o.get(e)??1)-1;t>0?_o.set(e,t):_o.delete(e),mt.pathContextTheaterId===e&&vi({...mt,pathContextMutationInProgress:Yw(e)})}function vi(e){mt=e;for(const t of Zm)t()}function Xw(e){const{sizeRange:t}=e,[i,s]=L.useState(""),[a,d]=L.useState(e.size),p=L.useRef(Promise.resolve()),c=L.useId(),h=L.useMemo(()=>nM(e),[e]),f=L.useMemo(()=>iM(h,i),[h,i]),g=L.useMemo(()=>f.map((A,N)=>({row:A,index:N})),[f]),[m,S]=L.useState(()=>rM(h,e.selected)),C=h.find(A=>Hh(A.selection,e.selected))??null,T=g[Math.min(m,Math.max(0,g.length-1))]?.row??null,w=`${c}-built-ins`,_=`${c}-installed`;L.useEffect(()=>{d(e.size)},[e.size]),L.useEffect(()=>{m>=g.length&&S(Math.max(0,g.length-1))},[m,g.length]);const b=L.useCallback(A=>{const N=l1(A,t);d(N),p.current=p.current.catch(()=>{}).then(()=>e.onSizeCommit(N))},[e.onSizeCommit,t]),v=L.useCallback(A=>{f.length&&S(N=>(N+A+f.length)%f.length)},[f.length]),y=L.useCallback(()=>{T&&!T.unavailable&&e.onSelectionChange(T.selection)},[T,e]),k=L.useCallback((A,N)=>{S(A),e.onSelectionChange(N)},[e]),M=A=>{A.key==="ArrowDown"?(A.preventDefault(),v(1)):A.key==="ArrowUp"?(A.preventDefault(),v(-1)):A.key==="Home"?(A.preventDefault(),S(0)):A.key==="End"?(A.preventDefault(),S(Math.max(0,f.length-1))):(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),y())};return l.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:l.jsxs("div",{className:"fc-font-browser__panes",children:[l.jsxs("div",{className:"fc-font-browser__chooser",children:[l.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${c}-search`,children:"Search fonts"}),l.jsx("input",{id:`${c}-search`,className:"fc-font-browser__search",type:"search",value:i,disabled:e.disabled,placeholder:"Search installed fonts",onChange:A=>{s(A.currentTarget.value),S(0)}}),e.loading?l.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?l.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,l.jsxs("div",{id:c,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":T?Zw(c,m):void 0,"aria-busy":e.loading||void 0,onKeyDown:M,children:[l.jsx(o1,{groupId:w,label:"Built-in",rows:g.filter(({row:A})=>A.source==="builtin"),activeRow:T,selected:e.selected,listboxId:c,disabled:e.disabled,onSelect:k}),l.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),l.jsx(o1,{groupId:_,label:"Installed on this machine",rows:g.filter(({row:A})=>A.source==="system"),activeRow:T,selected:e.selected,listboxId:c,disabled:e.disabled,onSelect:k}),!e.loading&&!g.length?l.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),l.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[l.jsxs("div",{className:"fc-font-browser__preview-head",children:[l.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),l.jsx("span",{className:`fc-font-browser__availability${C?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:C?.unavailable?"Unavailable":"Available"})]}),l.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:C?.previewFamily??e.fallbackStack,fontSize:`${a}px`},children:e.previewText}),l.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[l.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||a<=t.min,onClick:()=>b(a-t.step),"aria-label":"Decrease font size",children:"−"}),l.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[a,"px"]}),l.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||a>=t.max,onClick:()=>b(a+t.step),"aria-label":"Increase font size",children:"+"})]}),l.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:a,disabled:e.disabled,"aria-label":"Font size slider",onChange:A=>d(l1(Number(A.currentTarget.value),t)),onPointerUp:A=>b(Number(A.currentTarget.value)),onKeyUp:A=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(A.key)&&b(Number(A.currentTarget.value))}})]})]})})}function o1({groupId:e,label:t,rows:i,activeRow:s,selected:a,listboxId:d,disabled:p,onSelect:c}){return l.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[l.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),i.map(({row:h,index:f})=>l.jsxs("button",{id:Zw(d,f),type:"button",className:`fc-font-browser__row${Hh(h.selection,s?.selection??null)?" is-active":""}${h.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Hh(h.selection,a),disabled:p||h.unavailable,onClick:()=>c(f,h.selection),children:[l.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:h.previewFamily},children:h.label}),h.description?l.jsx("span",{className:"fc-font-browser__row-meta",children:h.description}):null,h.unavailable?l.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},h.id))]})}function nM(e){const t=new Set,i=e.builtIns.flatMap(d=>{const p=[d.id,d.label,...d.aliases??[]].map(rc);return p.some(c=>t.has(c))?[]:(p.forEach(c=>t.add(c)),[{id:`builtin-${d.id}`,label:d.label,family:d.family,previewFamily:d.family,source:"builtin",selection:{source:"builtin",id:d.id},description:d.description,unavailable:!1}])}),s=e.installedFonts.map(d=>({id:`system-${rc(d.family)}`,label:d.family,family:d.family,previewFamily:Ih(d.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:d.family},description:d.monospace?"Monospace":"System font",unavailable:!vL(d.family)})),a=e.selected.source==="system"?e.selected.familyName:null;return a!==null&&!s.some(d=>d.family===a)&&s.unshift({id:`system-${rc(a)}`,label:e.selectedSystemFont??a,family:a,previewFamily:Ih(a,e.fallbackStack),source:"system",selection:{source:"system",familyName:a},description:"Saved system font",unavailable:!0}),[...i,...s]}function iM(e,t){const i=rc(t);return i?e.filter(s=>rc(`${s.label} ${s.description??""}`).includes(i)):e}function rc(e){return e.trim().toLocaleLowerCase()}function Zw(e,t){return`${e}-option-${t}`}function rM(e,t){const i=e.findIndex(s=>Hh(s.selection,t));return i>=0?i:0}function Hh(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function l1(e,t){if(!Number.isFinite(e))return t.defaultValue;const i=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,i))}const sM="/api/v1/settings/fonts/system";class co extends Error{status;constructor(t,i=null){super(t),this.name="SystemFontsFetchError",this.status=i}}function aM(e){if(!Qw(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new co("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(oM)}}async function Jw(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new co("System font fetching is unavailable in this environment.");let i;try{i=await t(sM,{method:"GET",signal:e.signal})}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?a:new co("System fonts could not be loaded.")}if(!i.ok)throw new co("System fonts could not be loaded.",i.status);let s;try{s=await i.json()}catch{throw new co("System font response is not valid JSON.",i.status)}return aM(s)}function oM(e){if(!Qw(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new co("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function lM(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Qw(e,t){return lM(e)&&Object.keys(e).length===t.length&&t.every(i=>Object.hasOwn(e,i))}const c1=250,cM=5e3,u1=1,uM=1013,hM=4e3,dM=4001;function fM(e){const t=new AbortController,i=new TextEncoder;let s=c1,a=null,d=null,p=null,c=!1;const h=()=>{d?.dispose(),d=null},f=(S,C)=>{p={cols:S,rows:C},a?.readyState===u1&&a.send(JSON.stringify({type:"resize",cols:S,rows:C}))},g=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:S}=await mM(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await m(pM(S,e.location,e.wsPath),e),s=c1}catch(S){if(t.signal.aborted)return;e.onStatus?.("connecting",S instanceof Error?S.message:String(S))}await _M(s,t.signal),s=Math.min(s*2,cM)}},m=async(S,C)=>{await new Promise((T,w)=>{const _=(C.webSocketFactory??gM)(S);a=_,_.binaryType="arraybuffer",_.onopen=()=>{C.onStatus?.("live"),h(),d=C.terminal.onData(b=>{_.readyState===u1&&_.send(i.encode(b))}),p&&f(p.cols,p.rows)},_.onmessage=b=>{b.data instanceof ArrayBuffer&&C.terminal.write(new Uint8Array(b.data))},_.onerror=()=>{w(new Error("Terminal WebSocket error"))},_.onclose=b=>{h(),a===_&&(a=null);const v=b?.code;v===hM?(t.abort(),C.onStatus?.("closed","terminal_replaced")):v===dM?(t.abort(),C.onStatus?.("closed","terminal_closed"),C.onExit?.()):v===uM&&(t.abort(),C.onStatus?.("closed","terminal_unavailable")),T()}})};return{start:()=>{c||(c=!0,g())},resize:f,dispose:()=>{t.abort(),h(),e.onStatus?.("closed"),a?.close(),a=null}}}function pM(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function mM(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 a=await s.json();if(typeof a.ticket!="string"||typeof a.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:a.ticket,ttlMs:a.ttlMs}}function gM(e){return new WebSocket(e)}async function _M(e,t){await new Promise(i=>{const s=()=>{clearTimeout(a),t.removeEventListener("abort",s),i()},a=setTimeout(s,e);t.addEventListener("abort",s)})}var Fp={exports:{}},h1;function vM(){return h1||(h1=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(a){this._terminal=a}dispose(){}fit(){const a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;const d=this._terminal._core;this._terminal.rows===a.rows&&this._terminal.cols===a.cols||(d._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const a=this._terminal._core,d=a._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const p=this._terminal.options.scrollback===0?0:a.viewport.scrollBarWidth,c=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(c.getPropertyValue("height")),f=Math.max(0,parseInt(c.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),m=h-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),S=f-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(S/d.css.cell.width)),rows:Math.max(1,Math.floor(m/d.css.cell.height))}}}})(),i})()))})(Fp)),Fp.exports}var bM=vM(),Sh={exports:{}},yM=Sh.exports,d1;function SM(){return d1||(d1=1,(function(e,t){(function(i,s){e.exports=s()})(yM,(()=>(()=>{var i={433:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV11=void 0;const f=h(938),g=[[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]],m=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],S=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],C=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let T;function w(_,b){let v,y=0,k=b.length-1;if(_<b[0][0]||_>b[k][1])return!1;for(;k>=y;)if(v=y+k>>1,_>b[v][1])y=v+1;else{if(!(_<b[v][0]))return!0;k=v-1}return!1}c.UnicodeV11=class{constructor(){if(this.version="11",!T){T=new Uint8Array(65536),T.fill(1),T[0]=0,T.fill(0,1,32),T.fill(0,127,160);for(let _=0;_<g.length;++_)T.fill(0,g[_][0],g[_][1]+1);for(let _=0;_<S.length;++_)T.fill(2,S[_][0],S[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?T[_]:w(_,m)?0:w(_,C)?2:1}charProperties(_,b){let v=this.wcwidth(_),y=v===0&&b!==0;if(y){const k=f.UnicodeService.extractWidth(b);k===0?y=!1:k>v&&(v=k)}return f.UnicodeService.createPropertyValue(0,v,y)}}},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 f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,f){return h((g=>f.fire(g)))},c.runAndSubscribe=function(h,f){return f(void 0),h((g=>f(g)))}},490:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const f=h(938),g=[[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]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<g.length;++C)S.fill(0,g[C][0],g[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let _,b=0,v=w.length-1;if(T<w[0][0]||T>w[v][1])return!1;for(;v>=b;)if(_=b+v>>1,T>w[_][1])b=_+1;else{if(!(T<w[_][0]))return!0;v=_-1}return!1})(C,m)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),_=w===0&&T!==0;if(_){const b=f.UnicodeService.extractWidth(T);b===0?_=!1:b>w&&(w=b)}return f.UnicodeService.createPropertyValue(0,w,_)}}},938:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const f=h(345),g=h(490);class m{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 f.EventEmitter,this.onChange=this._onChange.event;const C=new g.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 _=C.length;for(let b=0;b<_;++b){let v=C.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=_)return T+this.wcwidth(v);const M=C.charCodeAt(b);56320<=M&&M<=57343?v=1024*(v-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(v,w);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(w)),T+=k,w=y}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}c.UnicodeService=m}},s={};function a(p){var c=s[p];if(c!==void 0)return c.exports;var h=s[p]={exports:{}};return i[p](h,h.exports,a),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Unicode11Addon=void 0;const c=a(433);p.Unicode11Addon=class{activate(h){h.unicode.register(new c.UnicodeV11)}dispose(){}}})(),d})()))})(Sh)),Sh.exports}var xM=SM();var wM=(e,t,i,s)=>{for(var a=t,d=e.length-1,p;d>=0;d--)(p=e[d])&&(a=p(a)||a);return a},CM=(e,t)=>(i,s)=>t(i,s,e),EM=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?f1.isErrorNoTelemetry(e)?new f1(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)}},kM=new EM;function Up(e){TM(e)||kM.onUnexpectedError(e)}var Qm="Canceled";function TM(e){return e instanceof AM?!0:e instanceof Error&&e.name===Qm&&e.message===Qm}var AM=class extends Error{constructor(){super(Qm),this.name=this.message}},f1=class eg extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof eg)return t;let i=new eg;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},RM;(e=>{function t(d){return d<0}e.isLessThan=t;function i(d){return d<=0}e.isLessThanOrEqual=i;function s(d){return d>0}e.isGreaterThan=s;function a(d){return d===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(RM||={});function LM(e,t){let i=this,s=!1,a;return function(){return s||(s=!0,t||(a=e.apply(i,arguments))),a}}var eC;(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*a(k){yield k}e.single=a;function d(k){return t(k)?k:a(k)}e.wrap=d;function p(k){return k||i}e.from=p;function*c(k){for(let M=k.length-1;M>=0;M--)yield k[M]}e.reverse=c;function h(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=h;function f(k){return k[Symbol.iterator]().next().value}e.first=f;function g(k,M){let A=0;for(let N of k)if(M(N,A++))return!0;return!1}e.some=g;function m(k,M){for(let A of k)if(M(A))return A}e.find=m;function*S(k,M){for(let A of k)M(A)&&(yield A)}e.filter=S;function*C(k,M){let A=0;for(let N of k)yield M(N,A++)}e.map=C;function*T(k,M){let A=0;for(let N of k)yield*M(N,A++)}e.flatMap=T;function*w(...k){for(let M of k)yield*M}e.concat=w;function _(k,M,A){let N=A;for(let R of k)N=M(N,R);return N}e.reduce=_;function*b(k,M,A=k.length){for(M<0&&(M+=k.length),A<0?A+=k.length:A>k.length&&(A=k.length);M<A;M++)yield k[M]}e.slice=b;function v(k,M=Number.POSITIVE_INFINITY){let A=[];if(M===0)return[A,k];let N=k[Symbol.iterator]();for(let R=0;R<M;R++){let I=N.next();if(I.done)return[A,e.empty()];A.push(I.value)}return[A,{[Symbol.iterator](){return N}}]}e.consume=v;async function y(k){let M=[];for await(let A of k)M.push(A);return Promise.resolve(M)}e.asyncToArray=y})(eC||={});function tC(e){if(eC.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 nC(...e){return Vn(()=>tC(e))}function Vn(e){return{dispose:LM(()=>{e()})}}var iC=class rC{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{tC(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?rC.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)}};iC.DISABLE_DISPOSED_WARNING=!1;var vo=iC,lr=class{constructor(){this._store=new vo,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)}};lr.None=Object.freeze({dispose(){}});var Nl=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}},m_=typeof process<"u"&&"title"in process,fd=m_?"node":navigator.userAgent,MM=m_?"node":navigator.platform,NM=fd.includes("Firefox"),OM=fd.includes("Edge"),sC=/^((?!chrome|android).)*safari/i.test(fd);function DM(){if(!sC)return 0;let e=fd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}MM.indexOf("Linux")>=0;var jM="",Rn=0,Ln=0,Mn=0,hn=0,qi={css:"#00000000",rgba:0},ii;(e=>{function t(a,d,p,c){return c!==void 0?`#${ea(a)}${ea(d)}${ea(p)}${ea(c)}`:`#${ea(a)}${ea(d)}${ea(p)}`}e.toCss=t;function i(a,d,p,c=255){return(a<<24|d<<16|p<<8|c)>>>0}e.toRgba=i;function s(a,d,p,c){return{css:e.toCss(a,d,p,c),rgba:e.toRgba(a,d,p,c)}}e.toColor=s})(ii||={});var Yl;(e=>{function t(h,f){if(hn=(f.rgba&255)/255,hn===1)return{css:f.css,rgba:f.rgba};let g=f.rgba>>24&255,m=f.rgba>>16&255,S=f.rgba>>8&255,C=h.rgba>>24&255,T=h.rgba>>16&255,w=h.rgba>>8&255;Rn=C+Math.round((g-C)*hn),Ln=T+Math.round((m-T)*hn),Mn=w+Math.round((S-w)*hn);let _=ii.toCss(Rn,Ln,Mn),b=ii.toRgba(Rn,Ln,Mn);return{css:_,rgba:b}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,f,g){let m=ca.ensureContrastRatio(h.rgba,f.rgba,g);if(m)return ii.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function a(h){let f=(h.rgba|255)>>>0;return[Rn,Ln,Mn]=ca.toChannels(f),{css:ii.toCss(Rn,Ln,Mn),rgba:f}}e.opaque=a;function d(h,f){return hn=Math.round(f*255),[Rn,Ln,Mn]=ca.toChannels(h.rgba),{css:ii.toCss(Rn,Ln,Mn,hn),rgba:ii.toRgba(Rn,Ln,Mn,hn)}}e.opacity=d;function p(h,f){return hn=h.rgba&255,d(h,hn*f/255)}e.multiplyOpacity=p;function c(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=c})(Yl||={});var IM;(e=>{let t,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let d=a.getContext("2d",{willReadFrequently:!0});d&&(t=d,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Rn=parseInt(a.slice(1,2).repeat(2),16),Ln=parseInt(a.slice(2,3).repeat(2),16),Mn=parseInt(a.slice(3,4).repeat(2),16),ii.toColor(Rn,Ln,Mn);case 5:return Rn=parseInt(a.slice(1,2).repeat(2),16),Ln=parseInt(a.slice(2,3).repeat(2),16),Mn=parseInt(a.slice(3,4).repeat(2),16),hn=parseInt(a.slice(4,5).repeat(2),16),ii.toColor(Rn,Ln,Mn,hn);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let d=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(d)return Rn=parseInt(d[1]),Ln=parseInt(d[2]),Mn=parseInt(d[3]),hn=Math.round((d[5]===void 0?1:parseFloat(d[5]))*255),ii.toColor(Rn,Ln,Mn,hn);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Rn,Ln,Mn,hn]=t.getImageData(0,0,1,1).data,hn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ii.toRgba(Rn,Ln,Mn,hn),css:a}}e.toColor=s})(IM||={});var ei;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,a,d){let p=s/255,c=a/255,h=d/255,f=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),g=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return f*.2126+g*.7152+m*.0722}e.relativeLuminance2=i})(ei||={});var ca;(e=>{function t(p,c){if(hn=(c&255)/255,hn===1)return c;let h=c>>24&255,f=c>>16&255,g=c>>8&255,m=p>>24&255,S=p>>16&255,C=p>>8&255;return Rn=m+Math.round((h-m)*hn),Ln=S+Math.round((f-S)*hn),Mn=C+Math.round((g-C)*hn),ii.toRgba(Rn,Ln,Mn)}e.blend=t;function i(p,c,h){let f=ei.relativeLuminance(p>>8),g=ei.relativeLuminance(c>>8);if($r(f,g)<h){if(g<f){let C=s(p,c,h),T=$r(f,ei.relativeLuminance(C>>8));if(T<h){let w=a(p,c,h),_=$r(f,ei.relativeLuminance(w>>8));return T>_?C:w}return C}let m=a(p,c,h),S=$r(f,ei.relativeLuminance(m>>8));if(S<h){let C=s(p,c,h),T=$r(f,ei.relativeLuminance(C>>8));return S>T?m:C}return m}}e.ensureContrastRatio=i;function s(p,c,h){let f=p>>24&255,g=p>>16&255,m=p>>8&255,S=c>>24&255,C=c>>16&255,T=c>>8&255,w=$r(ei.relativeLuminance2(S,C,T),ei.relativeLuminance2(f,g,m));for(;w<h&&(S>0||C>0||T>0);)S-=Math.max(0,Math.ceil(S*.1)),C-=Math.max(0,Math.ceil(C*.1)),T-=Math.max(0,Math.ceil(T*.1)),w=$r(ei.relativeLuminance2(S,C,T),ei.relativeLuminance2(f,g,m));return(S<<24|C<<16|T<<8|255)>>>0}e.reduceLuminance=s;function a(p,c,h){let f=p>>24&255,g=p>>16&255,m=p>>8&255,S=c>>24&255,C=c>>16&255,T=c>>8&255,w=$r(ei.relativeLuminance2(S,C,T),ei.relativeLuminance2(f,g,m));for(;w<h&&(S<255||C<255||T<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),w=$r(ei.relativeLuminance2(S,C,T),ei.relativeLuminance2(f,g,m));return(S<<24|C<<16|T<<8|255)>>>0}e.increaseLuminance=a;function d(p){return[p>>24&255,p>>16&255,p>>8&255,p&255]}e.toChannels=d})(ca||={});function ea(e){let t=e.toString(16);return t.length<2?"0"+t:t}function $r(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Sn(e){if(!e)throw new Error("value must not be falsy");return e}function g_(e){return 57508<=e&&e<=57558}function BM(e){return 57520<=e&&e<=57527}function PM(e){return 57344<=e&&e<=63743}function zM(e){return 9472<=e&&e<=9631}function HM(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 $M(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!HM(e)&&!g_(e)&&!PM(e)}function aC(e){return g_(e)||zM(e)}function FM(){return{css:{canvas:Yu(),cell:Yu()},device:{canvas:Yu(),cell:Yu(),char:{width:0,height:0,left:0,top:0}}}}function Yu(){return{width:0,height:0}}function UM(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Hn=0,An=0,gr=!1,Fr=!1,Xu=!1,pi,Wp=0,WM=class{constructor(e,t,i,s,a,d){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=a,this._themeService=d,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,An=0,Hn=0,Fr=!1,gr=!1,Xu=!1,pi=this._themeService.colors,Wp=0,e.getCode()!==0&&e.extended.underlineStyle===4){let a=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Wp=t*s%(Math.round(a)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",a=>{a.backgroundColorRGB&&(An=a.backgroundColorRGB.rgba>>8&16777215,Fr=!0),a.foregroundColorRGB&&(Hn=a.foregroundColorRGB.rgba>>8&16777215,gr=!0)}),Xu=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Xu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:An=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:An=(this.result.fg&16777215)<<8|255;break;default:An=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:An=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:An=(this.result.bg&16777215)<<8|255;break}An=ca.blend(An,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else An=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Fr=!0,pi.selectionForeground&&(Hn=pi.selectionForeground.rgba>>8&16777215,gr=!0),aC(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Hn=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Hn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Hn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Hn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Hn=(this.result.fg&16777215)<<8|255;break;default:Hn=this._themeService.colors.foreground.rgba}Hn=ca.blend(Hn,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}gr=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",a=>{a.backgroundColorRGB&&(An=a.backgroundColorRGB.rgba>>8&16777215,Fr=!0),a.foregroundColorRGB&&(Hn=a.foregroundColorRGB.rgba>>8&16777215,gr=!0)}),Fr&&(Xu?An=e.bg&-16777216&-134217729|An|50331648:An=e.bg&-16777216|An|50331648),gr&&(Hn=e.fg&-16777216&-67108865|Hn|50331648),this.result.fg&67108864&&(Fr&&!gr&&((this.result.bg&50331648)===0?Hn=this.result.fg&-134217728|pi.background.rgba>>8&16777215&16777215|50331648:Hn=this.result.fg&-134217728|this.result.bg&67108863,gr=!0),!Fr&&gr&&((this.result.fg&50331648)===0?An=this.result.bg&-67108864|pi.foreground.rgba>>8&16777215&16777215|50331648:An=this.result.bg&-67108864|this.result.fg&67108863,Fr=!0)),pi=void 0,this.result.bg=Fr?An:this.result.bg,this.result.fg=gr?Hn:this.result.fg,this.result.ext&=536870911,this.result.ext|=Wp<<29&3758096384}},GM=.5,oC=NM||OM?"bottom":"ideographic",qM={"▀":[{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}]},KM={"░":[[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]]},VM={"─":{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`}},gc={"":{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}};gc[""]=gc[""];gc[""]=gc[""];function YM(e,t,i,s,a,d,p,c){let h=qM[t];if(h)return XM(e,h,i,s,a,d),!0;let f=KM[t];if(f)return ZM(e,f,i,s,a,d),!0;let g=VM[t];if(g)return JM(e,g,i,s,a,d,c),!0;let m=gc[t];return m?(QM(e,m,i,s,a,d,p,c),!0):!1}function XM(e,t,i,s,a,d){for(let p=0;p<t.length;p++){let c=t[p],h=a/8,f=d/8;e.fillRect(i+c.x*h,s+c.y*f,c.w*h,c.h*f)}}var p1=new Map;function ZM(e,t,i,s,a,d){let p=p1.get(t);p||(p=new Map,p1.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 f=t[0].length,g=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=f,m.height=g;let S=Sn(m.getContext("2d")),C=new ImageData(f,g),T,w,_,b;if(c.startsWith("#"))T=parseInt(c.slice(1,3),16),w=parseInt(c.slice(3,5),16),_=parseInt(c.slice(5,7),16),b=c.length>7&&parseInt(c.slice(7,9),16)||1;else if(c.startsWith("rgba"))[T,w,_,b]=c.substring(5,c.length-1).split(",").map(v=>parseFloat(v));else throw new Error(`Unexpected fillStyle color format "${c}" when drawing pattern glyph`);for(let v=0;v<g;v++)for(let y=0;y<f;y++)C.data[(v*f+y)*4]=T,C.data[(v*f+y)*4+1]=w,C.data[(v*f+y)*4+2]=_,C.data[(v*f+y)*4+3]=t[v][y]*(b*255);S.putImageData(C,0,0),h=Sn(e.createPattern(m,null)),p.set(c,h)}e.fillStyle=h,e.fillRect(i,s,a,d)}function JM(e,t,i,s,a,d,p){e.strokeStyle=e.fillStyle;for(let[c,h]of Object.entries(t)){e.beginPath(),e.lineWidth=p*Number.parseInt(c);let f;if(typeof h=="function"){let g=.15/d*a;f=h(.15,g)}else f=h;for(let g of f.split(" ")){let m=g[0],S=lC[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let C=g.substring(1).split(",");!C[0]||!C[1]||S(e,cC(C,a,d,i,s,!0,p))}e.stroke(),e.closePath()}}function QM(e,t,i,s,a,d,p,c){let h=new Path2D;h.rect(i,s,a,d),e.clip(h),e.beginPath();let f=p/12;e.lineWidth=c*f;for(let g of t.d.split(" ")){let m=g[0],S=lC[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let C=g.substring(1).split(",");!C[0]||!C[1]||S(e,cC(C,a,d,i,s,!1,c,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function m1(e,t,i=0){return Math.max(Math.min(e,t),i)}var lC={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 cC(e,t,i,s,a,d,p,c=0,h=0){let f=e.map(g=>parseFloat(g)||parseInt(g));if(f.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<f.length;g+=2)f[g]*=t-c*p-h*p,d&&f[g]!==0&&(f[g]=m1(Math.round(f[g]+.5)-.5,t,0)),f[g]+=s+c*p;for(let g=1;g<f.length;g+=2)f[g]*=i,d&&f[g]!==0&&(f[g]=m1(Math.round(f[g]+.5)-.5,i,0)),f[g]+=a;return f}var g1=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={}}},_1=class{constructor(){this._data=new g1}set(e,t,i,s,a){this._data.get(e,t)||this._data.set(e,t,new g1),this._data.get(e,t).set(i,s,a)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},uC=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(),a=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),a=e.timeRemaining(),i*1.5>a){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=a}this.clear()}},e6=class extends uC{_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())}}},t6=class extends uC{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},n6=!m_&&"requestIdleCallback"in window?t6:e6,uo=class hC{constructor(){this.fg=0,this.bg=0,this.extended=new dC}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 hC;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}},dC=class fC{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 fC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},i6=globalThis.performance&&typeof globalThis.performance.now=="function",r6=class pC{static create(t){return new pC(t)}constructor(t){this._now=i6&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Kr;(e=>{e.None=()=>lr.None;function t(q,B){return m(q,()=>{},0,void 0,!0,void 0,B)}e.defer=t;function i(q){return(B,W=null,F)=>{let P=!1,K;return K=q(X=>{if(!P)return K?K.dispose():P=!0,B.call(W,X)},null,F),P&&K.dispose(),K}}e.once=i;function s(q,B,W){return f((F,P=null,K)=>q(X=>F.call(P,B(X)),null,K),W)}e.map=s;function a(q,B,W){return f((F,P=null,K)=>q(X=>{B(X),F.call(P,X)},null,K),W)}e.forEach=a;function d(q,B,W){return f((F,P=null,K)=>q(X=>B(X)&&F.call(P,X),null,K),W)}e.filter=d;function p(q){return q}e.signal=p;function c(...q){return(B,W=null,F)=>{let P=nC(...q.map(K=>K(X=>B.call(W,X))));return g(P,F)}}e.any=c;function h(q,B,W,F){let P=W;return s(q,K=>(P=B(P,K),P),F)}e.reduce=h;function f(q,B){let W,F={onWillAddFirstListener(){W=q(P.fire,P)},onDidRemoveLastListener(){W?.dispose()}},P=new Gt(F);return B?.add(P),P.event}function g(q,B){return B instanceof Array?B.push(q):B&&B.add(q),q}function m(q,B,W=100,F=!1,P=!1,K,X){let O,H,j,G=0,V,ne={leakWarningThreshold:K,onWillAddFirstListener(){O=q(ve=>{G++,H=B(H,ve),F&&!j&&(ie.fire(H),H=void 0),V=()=>{let ee=H;H=void 0,j=void 0,(!F||G>1)&&ie.fire(ee),G=0},typeof W=="number"?(clearTimeout(j),j=setTimeout(V,W)):j===void 0&&(j=0,queueMicrotask(V))})},onWillRemoveListener(){P&&G>0&&V?.()},onDidRemoveLastListener(){V=void 0,O.dispose()}},ie=new Gt(ne);return X?.add(ie),ie.event}e.debounce=m;function S(q,B=0,W){return e.debounce(q,(F,P)=>F?(F.push(P),F):[P],B,void 0,!0,void 0,W)}e.accumulate=S;function C(q,B=(F,P)=>F===P,W){let F=!0,P;return d(q,K=>{let X=F||!B(K,P);return F=!1,P=K,X},W)}e.latch=C;function T(q,B,W){return[e.filter(q,B,W),e.filter(q,F=>!B(F),W)]}e.split=T;function w(q,B=!1,W=[],F){let P=W.slice(),K=q(H=>{P?P.push(H):O.fire(H)});F&&F.add(K);let X=()=>{P?.forEach(H=>O.fire(H)),P=null},O=new Gt({onWillAddFirstListener(){K||(K=q(H=>O.fire(H)),F&&F.add(K))},onDidAddFirstListener(){P&&(B?setTimeout(X):X())},onDidRemoveLastListener(){K&&K.dispose(),K=null}});return F&&F.add(O),O.event}e.buffer=w;function _(q,B){return(W,F,P)=>{let K=B(new v);return q(function(X){let O=K.evaluate(X);O!==b&&W.call(F,O)},void 0,P)}}e.chain=_;let b=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(W=>(B(W),W)),this}filter(B){return this.steps.push(W=>B(W)?W:b),this}reduce(B,W){let F=W;return this.steps.push(P=>(F=B(F,P),F)),this}latch(B=(W,F)=>W===F){let W=!0,F;return this.steps.push(P=>{let K=W||!B(P,F);return W=!1,F=P,K?P:b}),this}evaluate(B){for(let W of this.steps)if(B=W(B),B===b)break;return B}}function y(q,B,W=F=>F){let F=(...O)=>X.fire(W(...O)),P=()=>q.on(B,F),K=()=>q.removeListener(B,F),X=new Gt({onWillAddFirstListener:P,onDidRemoveLastListener:K});return X.event}e.fromNodeEventEmitter=y;function k(q,B,W=F=>F){let F=(...O)=>X.fire(W(...O)),P=()=>q.addEventListener(B,F),K=()=>q.removeEventListener(B,F),X=new Gt({onWillAddFirstListener:P,onDidRemoveLastListener:K});return X.event}e.fromDOMEventEmitter=k;function M(q){return new Promise(B=>i(q)(B))}e.toPromise=M;function A(q){let B=new Gt;return q.then(W=>{B.fire(W)},()=>{B.fire(void 0)}).finally(()=>{B.dispose()}),B.event}e.fromPromise=A;function N(q,B){return q(W=>B.fire(W))}e.forward=N;function R(q,B,W){return B(W),q(F=>B(F))}e.runAndSubscribe=R;class I{constructor(B,W){this._observable=B,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{B.addObserver(this)},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new Gt(F),W&&W.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,W){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(q,B){return new I(q,B).emitter.event}e.fromObservable=Y;function z(q){return(B,W,F)=>{let P=0,K=!1,X={beginUpdate(){P++},endUpdate(){P--,P===0&&(q.reportChanges(),K&&(K=!1,B.call(W)))},handlePossibleChange(){},handleChange(){K=!0}};q.addObserver(X),q.reportChanges();let O={dispose(){q.removeObserver(X)}};return F instanceof vo?F.add(O):Array.isArray(F)&&F.push(O),O}}e.fromObservableLight=z})(Kr||={});var tg=class ng{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${ng._idPool++}`,ng.all.add(this)}start(t){this._stopWatch=new r6,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}}};tg.all=new Set,tg._idPool=0;var s6=tg,a6=-1,mC=class gC{constructor(t,i,s=(gC._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 a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[d,p]=this.getMostFrequentStack(),c=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${p}):`;console.warn(c),console.warn(d);let h=new c6(c,d);this._errorHandler(h)}return()=>{let d=this._stacks.get(t.value)||0;this._stacks.set(t.value,d-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,a]of this._stacks)(!t||i<a)&&(t=[s,a],i=a);return t}};mC._idPool=1;var o6=mC,l6=class _C{constructor(t){this.value=t}static create(){let t=new Error;return new _C(t.stack??"")}print(){console.warn(this.value.split(`
|
|
16
|
+
`).slice(2).join(`
|
|
17
|
+
`))}},c6=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},u6=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},h6=0,Gp=class{constructor(t){this.value=t,this.id=h6++}},d6=2,f6,Gt=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new o6(t?.onListenerError??Up,this._options?.leakWarningThreshold??a6):void 0,this._perfMon=this._options?._profName?new s6(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],f=new u6(`${c}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||Up)(f),lr.None}if(this._disposed)return lr.None;i&&(t=t.bind(i));let a=new Gp(t),d;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=l6.create(),d=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Gp?(this._deliveryQueue??=new p6,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let p=Vn(()=>{d?.(),this._removeListener(a)});return s instanceof vo?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 a=this._deliveryQueue.current===this;if(this._size*d6<=i.length){let d=0;for(let p=0;p<i.length;p++)i[p]?i[d++]=i[p]:a&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=d}}_deliver(t,i){if(!t)return;let s=this._options?.onListenerError||Up;if(!s){t.value(i);return}try{t.value(i)}catch(a){s(a)}}_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 Gp)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}},p6=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}},v1={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}},Ol=2,Dl,Es=class so{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new _1,this._cacheMapCombined=new _1,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new uo,this._textureSize=512,this._onAddTextureAtlasCanvas=new Gt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Gt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=vC(t,this._config.deviceCellWidth*4+Ol*2,this._config.deviceCellHeight+Ol*2),this._tmpCtx=Sn(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 n6;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(so.maxAtlasPages&&this._pages.length>=Math.max(4,so.maxAtlasPages)){let i=this._pages.filter(f=>f.canvas.width*2<=(so.maxTextureSize||4096)).sort((f,g)=>g.canvas.width!==f.canvas.width?g.canvas.width-f.canvas.width:g.percentageUsed-f.percentageUsed),s=-1,a=0;for(let f=0;f<i.length;f++)if(i[f].canvas.width!==a)s=f,a=i[f].canvas.width;else if(f-s===3)break;let d=i.slice(s,s+4),p=d.map(f=>f.glyphs[0].texturePage).sort((f,g)=>f>g?1:-1),c=this.pages.length-d.length,h=this._mergePages(d,c);h.version++;for(let f=p.length-1;f>=0;f--)this._deletePage(p[f]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new qp(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,a=new qp(this._document,s,t);for(let[d,p]of t.entries()){let c=d*p.canvas.width%s,h=Math.floor(d/2)*p.canvas.height;a.ctx.drawImage(p.canvas,c,h);for(let g of p.glyphs)g.texturePage=i,g.sizeClipSpace.x=g.size.x/s,g.sizeClipSpace.y=g.size.y/s,g.texturePosition.x+=c,g.texturePosition.y+=h,g.texturePositionClipSpace.x=g.texturePosition.x/s,g.texturePositionClipSpace.y=g.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(p.canvas);let f=this._activePages.indexOf(p);f!==-1&&this._activePages.splice(f,1)}return a}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let a of s.glyphs)a.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,a,d,p){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,a,d,p)}getRasterizedGlyph(t,i,s,a,d,p){return this._getFromCacheMap(this._cacheMap,t,i,s,a,d,p)}_getFromCacheMap(t,i,s,a,d,p,c){return Dl=t.get(i,s,a,d),Dl||(Dl=this._drawToCache(i,s,a,d,p,c),t.set(i,s,a,d,Dl)),Dl}_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,a){if(this._config.allowTransparency)return qi;let d;switch(t){case 16777216:case 33554432:d=this._getColorFromAnsiIndex(i);break;case 50331648:let p=uo.toColorRGB(i);d=ii.toColor(p[0],p[1],p[2]);break;default:s?d=Yl.opaque(this._config.colors.foreground):d=this._config.colors.background;break}return this._config.allowTransparency||(d=Yl.opaque(d)),d}_getForegroundColor(t,i,s,a,d,p,c,h,f,g){let m=this._getMinimumContrastColor(t,i,s,a,d,p,c,f,h,g);if(m)return m;let S;switch(d){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&p<8&&(p+=8),S=this._getColorFromAnsiIndex(p);break;case 50331648:let C=uo.toColorRGB(p);S=ii.toColor(C[0],C[1],C[2]);break;default:c?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Yl.opaque(S)),h&&(S=Yl.multiplyOpacity(S,GM)),S}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,a){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&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,a,d,p,c,h,f,g){if(this._config.minimumContrastRatio===1||g)return;let m=this._getContrastCache(f),S=m.getColor(t,a);if(S!==void 0)return S||void 0;let C=this._resolveBackgroundRgba(i,s,c),T=this._resolveForegroundRgba(d,p,c,h),w=ca.ensureContrastRatio(C,T,this._config.minimumContrastRatio/(f?2:1));if(!w){m.setColor(t,a,null);return}let _=ii.toColor(w>>24&255,w>>16&255,w>>8&255);return m.setColor(t,a,_),_}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,a,d,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)+Ol*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let f=Math.min(this._config.deviceCellHeight+Ol*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=a,!!this._workAttributeData.isInvisible())return v1;let g=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),C=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),w=!!this._workAttributeData.isStrikethrough(),_=!!this._workAttributeData.isOverline(),b=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(m){let H=b;b=y,y=H;let j=v;v=k,k=j}let M=this._getBackgroundColor(k,y,m,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let A=g?this._config.fontWeightBold:this._config.fontWeight,N=C?"italic":"";this._tmpCtx.font=`${N} ${A} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=oC;let R=c.length===1&&g_(c.charCodeAt(0)),I=c.length===1&&BM(c.charCodeAt(0)),Y=this._getForegroundColor(i,k,y,s,v,b,m,S,g,aC(c.charCodeAt(0)));this._tmpCtx.fillStyle=Y.css;let z=I?0:Ol*2,q=!1;this._config.customGlyphs!==!1&&(q=YM(this._tmpCtx,c,z,z,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let B=!R,W;if(typeof t=="number"?W=this._unicodeService.wcwidth(t):W=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=H%2===1?.5:0;if(this._tmpCtx.lineWidth=H,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())B=!1,this._tmpCtx.strokeStyle=`rgb(${uo.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{B=!1;let ee=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ee<8&&(ee+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ee).css}this._tmpCtx.beginPath();let G=z,V=Math.ceil(z+this._config.deviceCharHeight)-j-(d?H*2:0),ne=V+H,ie=V+H*2,ve=this._workAttributeData.getUnderlineVariantOffset();for(let ee=0;ee<W;ee++){this._tmpCtx.save();let $=G+ee*this._config.deviceCellWidth,ae=G+(ee+1)*this._config.deviceCellWidth,ge=$+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo($,V),this._tmpCtx.lineTo(ae,V),this._tmpCtx.moveTo($,ie),this._tmpCtx.lineTo(ae,ie);break;case 3:let we=H<=1?ie:Math.ceil(z+this._config.deviceCharHeight-H/2)-j,de=H<=1?V:Math.ceil(z+this._config.deviceCharHeight+H/2)-j,Ce=new Path2D;Ce.rect($,V,this._config.deviceCellWidth,ie-V),this._tmpCtx.clip(Ce),this._tmpCtx.moveTo($-this._config.deviceCellWidth/2,ne),this._tmpCtx.bezierCurveTo($-this._config.deviceCellWidth/2,de,$,de,$,ne),this._tmpCtx.bezierCurveTo($,we,ge,we,ge,ne),this._tmpCtx.bezierCurveTo(ge,de,ae,de,ae,ne),this._tmpCtx.bezierCurveTo(ae,we,ae+this._config.deviceCellWidth/2,we,ae+this._config.deviceCellWidth/2,ne);break;case 4:let Le=ve===0?0:ve>=H?H*2-ve:H-ve;ve>=H||Le===0?(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo($+Le,V),this._tmpCtx.lineTo(ae,V)):(this._tmpCtx.setLineDash([Math.round(H),Math.round(H)]),this._tmpCtx.moveTo($,V),this._tmpCtx.lineTo($+Le,V),this._tmpCtx.moveTo($+Le+H,V),this._tmpCtx.lineTo(ae,V)),ve=UM(ae-$,H,ve);break;case 5:let Me=.6,qe=.3,ke=ae-$,ye=Math.floor(Me*ke),Oe=Math.floor(qe*ke),wt=ke-ye-Oe;this._tmpCtx.setLineDash([ye,Oe,wt]),this._tmpCtx.moveTo($,V),this._tmpCtx.lineTo(ae,V);break;default:this._tmpCtx.moveTo($,V),this._tmpCtx.lineTo(ae,V);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!q&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ee=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ee&&ee.actualBoundingBoxDescent>0){this._tmpCtx.save();let $=new Path2D;$.rect(G,V-Math.ceil(H/2),this._config.deviceCellWidth*W,ie-V+Math.ceil(H/2)),this._tmpCtx.clip($),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(c,z,z+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(_){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),j=H%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(z,z+j),this._tmpCtx.lineTo(z+this._config.deviceCharWidth*W,z+j),this._tmpCtx.stroke()}if(q||this._tmpCtx.fillText(c,z,z+this._config.deviceCharHeight),c==="_"&&!this._config.allowTransparency){let H=Kp(this._tmpCtx.getImageData(z,z,this._config.deviceCellWidth,this._config.deviceCellHeight),M,Y,B);if(H)for(let j=1;j<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,z,z+this._config.deviceCharHeight-j),H=Kp(this._tmpCtx.getImageData(z,z,this._config.deviceCellWidth,this._config.deviceCellHeight),M,Y,B),!!H);j++);}if(w){let H=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),j=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=H,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(z,z+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.lineTo(z+this._config.deviceCharWidth*W,z+Math.floor(this._config.deviceCharHeight/2)-j),this._tmpCtx.stroke()}this._tmpCtx.restore();let F=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=m6(F):P=Kp(F,M,Y,B),P)return v1;let K=this._findGlyphBoundingBox(F,this._workBoundingBox,h,I,q,z),X,O;for(;;){if(this._activePages.length===0){let H=this._createNewPage();X=H,O=H.currentRow,O.height=K.size.y;break}X=this._activePages[this._activePages.length-1],O=X.currentRow;for(let H of this._activePages)K.size.y<=H.currentRow.height&&(X=H,O=H.currentRow);for(let H=this._activePages.length-1;H>=0;H--)for(let j of this._activePages[H].fixedRows)j.height<=O.height&&K.size.y<=j.height&&(X=this._activePages[H],O=j);if(K.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new qp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),X=this._overflowSizePage,O=this._overflowSizePage.currentRow,O.x+K.size.x>=X.canvas.width&&(O.x=0,O.y+=O.height,O.height=0);break}if(O.y+K.size.y>=X.canvas.height||O.height>K.size.y+2){let H=!1;if(X.currentRow.y+X.currentRow.height+K.size.y>=X.canvas.height){let j;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+K.size.y<G.canvas.height){j=G;break}if(j)X=j;else if(so.maxAtlasPages&&this._pages.length>=so.maxAtlasPages&&O.y+K.size.y<=X.canvas.height&&O.height>=K.size.y&&O.x+K.size.x<=X.canvas.width)H=!0;else{let G=this._createNewPage();X=G,O=G.currentRow,O.height=K.size.y,H=!0}}H||(X.currentRow.height>0&&X.fixedRows.push(X.currentRow),O={x:0,y:X.currentRow.y+X.currentRow.height,height:K.size.y},X.fixedRows.push(O),X.currentRow={x:0,y:O.y+O.height,height:0})}if(O.x+K.size.x<=X.canvas.width)break;O===X.currentRow?(O.x=0,O.y+=O.height,O.height=0):X.fixedRows.splice(X.fixedRows.indexOf(O),1)}return K.texturePage=this._pages.indexOf(X),K.texturePosition.x=O.x,K.texturePosition.y=O.y,K.texturePositionClipSpace.x=O.x/X.canvas.width,K.texturePositionClipSpace.y=O.y/X.canvas.height,K.sizeClipSpace.x/=X.canvas.width,K.sizeClipSpace.y/=X.canvas.height,O.height=Math.max(O.height,K.size.y),O.x+=K.size.x,X.ctx.putImageData(F,K.texturePosition.x-this._workBoundingBox.left,K.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,K.size.x,K.size.y),X.addGlyph(K),X.version++,K}_findGlyphBoundingBox(t,i,s,a,d,p){i.top=0;let c=a?this._config.deviceCellHeight:this._tmpCanvas.height,h=a?this._config.deviceCellWidth:s,f=!1;for(let g=0;g<c;g++){for(let m=0;m<h;m++){let S=g*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.top=g,f=!0;break}}if(f)break}i.left=0,f=!1;for(let g=0;g<p+h;g++){for(let m=0;m<c;m++){let S=m*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.left=g,f=!0;break}}if(f)break}i.right=h,f=!1;for(let g=p+h-1;g>=p;g--){for(let m=0;m<c;m++){let S=m*this._tmpCanvas.width*4+g*4+3;if(t.data[S]!==0){i.right=g,f=!0;break}}if(f)break}i.bottom=c,f=!1;for(let g=c-1;g>=0;g--){for(let m=0;m<h;m++){let S=g*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.bottom=g,f=!0;break}}if(f)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+(a||d?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+p+(a||d?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},qp=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=vC(e,t,t),this.ctx=Sn(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 Kp(e,t,i,s){let a=t.rgba>>>24,d=t.rgba>>>16&255,p=t.rgba>>>8&255,c=i.rgba>>>24,h=i.rgba>>>16&255,f=i.rgba>>>8&255,g=Math.floor((Math.abs(a-c)+Math.abs(d-h)+Math.abs(p-f))/12),m=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===a&&e.data[S+1]===d&&e.data[S+2]===p||s&&Math.abs(e.data[S]-a)+Math.abs(e.data[S+1]-d)+Math.abs(e.data[S+2]-p)<g?e.data[S+3]=0:m=!1;return m}function m6(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function vC(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function g6(e,t,i,s,a,d,p,c){let h={foreground:d.foreground,background:d.background,cursor:qi,cursorAccent:qi,selectionForeground:qi,selectionBackgroundTransparent:qi,selectionBackgroundOpaque:qi,selectionInactiveBackgroundTransparent:qi,selectionInactiveBackgroundOpaque:qi,overviewRulerBorder:qi,scrollbarSliderBackground:qi,scrollbarSliderHoverBackground:qi,scrollbarSliderActiveBackground:qi,ansi:d.ansi.slice(),contrastCache:d.contrastCache,halfContrastCache:d.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:p,deviceMaxTextureSize:c,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:h}}function b1(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 _6(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Yi=[];function bC(e,t,i,s,a,d,p,c,h){let f=g6(s,a,d,p,t,i,c,h);for(let S=0;S<Yi.length;S++){let C=Yi[S],T=C.ownedBy.indexOf(e);if(T>=0){if(b1(C.config,f))return C.atlas;C.ownedBy.length===1?(C.atlas.dispose(),Yi.splice(S,1)):C.ownedBy.splice(T,1);break}}for(let S=0;S<Yi.length;S++){let C=Yi[S];if(b1(C.config,f))return C.ownedBy.push(e),C.atlas}let g=e._core,m={atlas:new Es(document,f,g.unicodeService),config:f,ownedBy:[e]};return Yi.push(m),m.atlas}function y1(e){for(let t=0;t<Yi.length;t++){let i=Yi[t].ownedBy.indexOf(e);if(i!==-1){Yi[t].ownedBy.length===1?(Yi[t].atlas.dispose(),Yi.splice(t,1)):Yi[t].ownedBy.splice(i,1);break}}}var Zu=600,v6=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=Zu){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Zu-(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=Zu-(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})},Zu)},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 S1(e,t,i){let s=new t.ResizeObserver(a=>{let d=a.find(h=>h.target===e);if(!d)return;if(!("devicePixelContentBoxSize"in d)){s?.disconnect(),s=void 0;return}let p=d.devicePixelContentBoxSize[0].inlineSize,c=d.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 Vn(()=>s?.disconnect())}function b6(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var x1=class yC extends uo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new dC,this.combinedData=""}static fromCharData(t){let i=new yC;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?b6(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 a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(s-55296)*1024+a-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()]}},SC=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function xC(e,t,i){let s=Sn(e.createProgram());if(e.attachShader(s,Sn(w1(e,e.VERTEX_SHADER,t))),e.attachShader(s,Sn(w1(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 w1(e,t,i){let s=Sn(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 y6(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let a=0;a<e.length;a++)s[a]=e[a];return s}var S6=class{constructor(e){this.texture=e,this.version=-1}},x6=`#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 w6(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 ks=11,Ja=ks*Float32Array.BYTES_PER_ELEMENT,C6=2,ln=0,Wt,Vp=0,jl=0,E6=class extends lr{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 a=this._gl;Es.maxAtlasPages===void 0&&(Es.maxAtlasPages=Math.min(32,Sn(a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS))),Es.maxTextureSize=Sn(a.getParameter(a.MAX_TEXTURE_SIZE))),this._program=Sn(xC(a,x6,w6(Es.maxAtlasPages))),this._register(Vn(()=>a.deleteProgram(this._program))),this._projectionLocation=Sn(a.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Sn(a.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Sn(a.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),p=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(p))),a.bindBuffer(a.ARRAY_BUFFER,p),a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(h))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,h),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this._attributesBuffer=Sn(a.createBuffer()),this._register(Vn(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,2,a.FLOAT,!1,Ja,0),a.vertexAttribDivisor(2,1),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,a.FLOAT,!1,Ja,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(3,1),a.enableVertexAttribArray(4),a.vertexAttribPointer(4,1,a.FLOAT,!1,Ja,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(4,1),a.enableVertexAttribArray(5),a.vertexAttribPointer(5,2,a.FLOAT,!1,Ja,5*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(5,1),a.enableVertexAttribArray(6),a.vertexAttribPointer(6,2,a.FLOAT,!1,Ja,7*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(6,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Ja,9*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.useProgram(this._program);let f=new Int32Array(Es.maxAtlasPages);for(let g=0;g<Es.maxAtlasPages;g++)f[g]=g;a.uniform1iv(this._textureLocation,f),a.uniformMatrix4fv(this._projectionLocation,!1,SC),this._atlasTextures=[];for(let g=0;g<Es.maxAtlasPages;g++){let m=new S6(Sn(a.createTexture()));this._register(Vn(()=>a.deleteTexture(m.texture))),a.activeTexture(a.TEXTURE0+g),a.bindTexture(a.TEXTURE_2D,m.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[g]=m}a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,s,a,d,p,c,h){this._updateCell(this._vertices.attributes,e,t,i,s,a,d,p,c,h)}_updateCell(e,t,i,s,a,d,p,c,h,f){if(ln=(i*this._terminal.cols+t)*ks,s===0||s===void 0){e.fill(0,ln,ln+ks-1-C6);return}this._atlas&&(c&&c.length>1?Wt=this._atlas.getRasterizedGlyphCombinedChar(c,a,d,p,!1,this._terminal.element):Wt=this._atlas.getRasterizedGlyph(s,a,d,p,!1,this._terminal.element),Vp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),a!==f&&Wt.offset.x>Vp?(jl=Wt.offset.x-Vp,e[ln]=-(Wt.offset.x-jl)+this._dimensions.device.char.left,e[ln+1]=-Wt.offset.y+this._dimensions.device.char.top,e[ln+2]=(Wt.size.x-jl)/this._dimensions.device.canvas.width,e[ln+3]=Wt.size.y/this._dimensions.device.canvas.height,e[ln+4]=Wt.texturePage,e[ln+5]=Wt.texturePositionClipSpace.x+jl/this._atlas.pages[Wt.texturePage].canvas.width,e[ln+6]=Wt.texturePositionClipSpace.y,e[ln+7]=Wt.sizeClipSpace.x-jl/this._atlas.pages[Wt.texturePage].canvas.width,e[ln+8]=Wt.sizeClipSpace.y):(e[ln]=-Wt.offset.x+this._dimensions.device.char.left,e[ln+1]=-Wt.offset.y+this._dimensions.device.char.top,e[ln+2]=Wt.size.x/this._dimensions.device.canvas.width,e[ln+3]=Wt.size.y/this._dimensions.device.canvas.height,e[ln+4]=Wt.texturePage,e[ln+5]=Wt.texturePositionClipSpace.x,e[ln+6]=Wt.texturePositionClipSpace.y,e[ln+7]=Wt.sizeClipSpace.x,e[ln+8]=Wt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&$M(s,h,Wt.size.x,this._dimensions.device.cell.width)&&(e[ln+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ks;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 a=0;a<e.cols;a++)this._vertices.attributes[i+9]=a/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=ks}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 a=0;a<e.lineLengths.length;a++){let d=a*this._terminal.cols*ks,p=this._vertices.attributes.subarray(d,d+e.lineLengths[a]*ks);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 a=0;a<this._atlas.pages.length;a++)this._atlas.pages[a].version!==this._atlasTextures[a].version&&this._bindAtlasPageTexture(t,this._atlas,a);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/ks)}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}},k6=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 a=e.buffers.active.ydisp,d=t[1]-a,p=i[1]-a,c=Math.max(d,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=d,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 T6(){return new k6}var $h=4,xh=1,wh=2,Yp=3,A6=2147483648,R6=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=T6()}resize(e,t){let i=e*t*$h;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)}},L6=`#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
|
+
}`,M6=`#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
|
+
}`,Gr=8,Xp=Gr*Float32Array.BYTES_PER_ELEMENT,N6=20*Gr,C1=class{constructor(){this.attributes=new Float32Array(N6),this.count=0}},Ur=0,E1=0,k1=0,T1=0,A1=0,R1=0,L1=0,O6=class extends lr{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new C1,this._verticesCursor=new C1;let a=this._gl;this._program=Sn(xC(a,L6,M6)),this._register(Vn(()=>a.deleteProgram(this._program))),this._projectionLocation=Sn(a.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),p=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(p))),a.bindBuffer(a.ARRAY_BUFFER,p),a.bufferData(a.ARRAY_BUFFER,d,a.STATIC_DRAW),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let c=new Uint8Array([0,1,2,3]),h=a.createBuffer();this._register(Vn(()=>a.deleteBuffer(h))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,h),a.bufferData(a.ELEMENT_ARRAY_BUFFER,c,a.STATIC_DRAW),this._attributesBuffer=Sn(a.createBuffer()),this._register(Vn(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,a.FLOAT,!1,Xp,0),a.vertexAttribDivisor(0,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Xp,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,4,a.FLOAT,!1,Xp,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(f=>{this._updateCachedColors(f),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,SC),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,a,d,p,c,h,f,g,m,S,C,T;for(a=0;a<t.rows;a++){for(p=-1,c=0,h=0,f=!1,d=0;d<t.cols;d++)g=(a*t.cols+d)*$h,m=e.cells[g+xh],S=e.cells[g+wh],C=!!(S&67108864),(m!==c||S!==h&&(f||C))&&((c!==0||f&&h!==0)&&(T=s++*Gr,this._updateRectangle(i,T,h,c,p,d,a)),p=d,c=m,h=S,f=C);(c!==0||f&&h!==0)&&(T=s++*Gr,this._updateRectangle(i,T,h,c,p,t.cols,a))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,a=0;(i.style==="bar"||i.style==="outline")&&(s=a++*Gr,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=a++*Gr,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=a++*Gr,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=a++*Gr,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=a}_updateRectangle(e,t,i,s,a,d,p){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Ur=(i&16777215)<<8;break;default:Ur=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Ur=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Ur=(s&16777215)<<8;break;default:Ur=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=y6(e.attributes,this._terminal.rows*this._terminal.cols*Gr)),E1=a*this._dimensions.device.cell.width,k1=p*this._dimensions.device.cell.height,T1=(Ur>>24&255)/255,A1=(Ur>>16&255)/255,R1=(Ur>>8&255)/255,L1=1,this._addRectangle(e.attributes,t,E1,k1,(d-a)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,T1,A1,R1,L1)}_addRectangle(e,t,i,s,a,d,p,c,h,f){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=a/this._dimensions.device.canvas.width,e[t+3]=d/this._dimensions.device.canvas.height,e[t+4]=p,e[t+5]=c,e[t+6]=h,e[t+7]=f}_addRectangleFloat(e,t,i,s,a,d,p){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=a/this._dimensions.device.canvas.width,e[t+3]=d/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])}},D6=class extends lr{constructor(e,t,i,s,a,d,p,c){super(),this._container=t,this._alpha=a,this._coreBrowserService=d,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(Vn(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Sn(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=bC(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=oC,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}`}},j6=class extends D6{constructor(e,t,i,s,a,d,p){super(i,e,"link",t,!0,a,d,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&&_6(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()}},sa=typeof window=="object"?window:globalThis,ig=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Gt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Gt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};ig.INSTANCE=new ig;var wC=ig;function I6(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}wC.INSTANCE.onDidChangeZoomLevel;wC.INSTANCE.onDidChangeFullscreen;var Do=typeof navigator=="object"?navigator.userAgent:"";Do.indexOf("Firefox")>=0;Do.indexOf("AppleWebKit")>=0;var B6=Do.indexOf("Chrome")>=0;!B6&&Do.indexOf("Safari")>=0;Do.indexOf("Electron/")>=0;Do.indexOf("Android")>=0;var Zp=!1;if(typeof sa.matchMedia=="function"){let e=sa.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=sa.matchMedia("(display-mode: fullscreen)");Zp=e.matches,I6(sa,e,({matches:i})=>{Zp&&t.matches||(Zp=i)})}var ho="en",Jp=!1,CC=!1,Ju,Ch=ho,M1=ho,P6,Wr,ua=globalThis,Li;typeof ua.vscode<"u"&&typeof ua.vscode.process<"u"?Li=ua.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Li=process);var z6=typeof Li?.versions?.electron=="string",H6=z6&&Li?.type==="renderer";if(typeof Li=="object"){Li.platform,Li.platform,Jp=Li.platform==="linux",Jp&&Li.env.SNAP&&Li.env.SNAP_REVISION,Li.env.CI||Li.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ju=ho,Ch=ho;let e=Li.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Ju=t.userLocale,M1=t.osLocale,Ch=t.resolvedLanguage||ho,P6=t.languagePack?.translationsConfigFile}catch{}CC=!0}else typeof navigator=="object"&&!H6?(Wr=navigator.userAgent,Wr.indexOf("Windows")>=0,Wr.indexOf("Macintosh")>=0,(Wr.indexOf("Macintosh")>=0||Wr.indexOf("iPad")>=0||Wr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Jp=Wr.indexOf("Linux")>=0,Wr?.indexOf("Mobi")>=0,Ch=globalThis._VSCODE_NLS_LANGUAGE||ho,Ju=navigator.language.toLowerCase(),M1=Ju):console.error("Unable to resolve platform.");var N1=CC,yr=Wr,ws=Ch,$6;(e=>{function t(){return ws}e.value=t;function i(){return ws.length===2?ws==="en":ws.length>=3?ws[0]==="e"&&ws[1]==="n"&&ws[2]==="-":!1}e.isDefaultVariant=i;function s(){return ws==="en"}e.isDefault=s})($6||={});var F6=typeof ua.postMessage=="function"&&!ua.importScripts;(()=>{if(F6){let e=[];ua.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,a=e.length;s<a;s++){let d=e[s];if(d.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),d.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),ua.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var U6=!!(yr&&yr.indexOf("Chrome")>=0);yr&&yr.indexOf("Firefox")>=0;!U6&&yr&&yr.indexOf("Safari")>=0;yr&&yr.indexOf("Edg/")>=0;yr&&yr.indexOf("Android")>=0;var Qa=typeof navigator=="object"?navigator:{};N1||document.queryCommandSupported&&document.queryCommandSupported("copy")||Qa&&Qa.clipboard&&Qa.clipboard.writeText,N1||Qa&&Qa.clipboard&&Qa.clipboard.readText;var __=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}},Qp=new __,O1=new __,D1=new __;new Array(230);var W6;(e=>{function t(c){return Qp.keyCodeToStr(c)}e.toString=t;function i(c){return Qp.strToKeyCode(c)}e.fromString=i;function s(c){return O1.keyCodeToStr(c)}e.toUserSettingsUS=s;function a(c){return D1.keyCodeToStr(c)}e.toUserSettingsGeneral=a;function d(c){return O1.strToKeyCode(c)||D1.strToKeyCode(c)}e.fromUserSettings=d;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 Qp.keyCodeToStr(c)}e.toElectronAccelerator=p})(W6||={});var EC=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),G6;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof q6?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:EC})})(G6||={});var q6=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?EC:(this._emitter||(this._emitter=new Gt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},K6;(e=>{async function t(s){let a,d=await Promise.all(s.map(p=>p.then(c=>c,c=>{a||(a=c)})));if(typeof a<"u")throw a;return d}e.settled=t;function i(s){return new Promise(async(a,d)=>{try{await s(a,d)}catch(p){d(p)}})}e.withAsyncBody=i})(K6||={});var j1=class Ki{static fromArray(t){return new Ki(i=>{i.emitMany(t)})}static fromPromise(t){return new Ki(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ki(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Ki(async i=>{await Promise.all(t.map(async s=>{for await(let a of s)i.emitOne(a)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Gt,queueMicrotask(async()=>{let s={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(s)),this.resolve()}catch(a){this.reject(a)}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 Kr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ki(async s=>{for await(let a of t)s.emitOne(i(a))})}map(t){return Ki.map(this,t)}static filter(t,i){return new Ki(async s=>{for await(let a of t)i(a)&&s.emitOne(a)})}filter(t){return Ki.filter(this,t)}static coalesce(t){return Ki.filter(t,i=>!!i)}coalesce(){return Ki.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Ki.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())}};j1.EMPTY=j1.fromArray([]);var{getWindow:V6}=(function(){let e=new Map,t={window:sa,disposables:new vo};e.set(sa.vscodeWindowId,t);let i=new Gt,s=new Gt,a=new Gt;function d(p,c){return(typeof p=="number"?e.get(p):void 0)??(c?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:s.event,registerWindow(p){if(e.has(p.vscodeWindowId))return lr.None;let c=new vo,h={window:p,disposables:c.add(new vo)};return e.set(p.vscodeWindowId,h),c.add(Vn(()=>{e.delete(p.vscodeWindowId),s.fire(p)})),c.add(rg(p,X6.BEFORE_UNLOAD,()=>{a.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:d,getWindow(p){let c=p;if(c?.ownerDocument?.defaultView)return c.ownerDocument.defaultView.window;let h=p;return h?.view?h.view.window:sa},getDocument(p){return V6(p).document}}})(),Y6=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function rg(e,t,i,s){return new Y6(e,t,i,s)}var X6={BEFORE_UNLOAD:"beforeunload"},Z6=class extends lr{constructor(e,t,i,s,a,d,p,c,h){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=a,this._decorationService=d,this._optionsService=p,this._themeService=c,this._cursorBlinkStateManager=new Nl,this._charAtlasDisposable=this._register(new Nl),this._observerDisposable=this._register(new Nl),this._model=new R6,this._workCell=new x1,this._workCell2=new x1,this._rectangleRenderer=this._register(new Nl),this._glyphRenderer=this._register(new Nl),this._onChangeTextureAtlas=this._register(new Gt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Gt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Gt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Gt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Gt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let f={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",f),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new WM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new j6(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,p,this._themeService)],this.dimensions=FM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(p.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(rg(this._canvas,"webglcontextlost",g=>{console.log("webglcontextlost event received"),g.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(g)},3e3)})),this._register(rg(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,y1(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=S1(this._canvas,this._coreBrowserService.window,(g,m)=>this._setCanvasDevicePixelDimensions(g,m)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=S1(this._canvas,g,(m,S)=>this._setCanvasDevicePixelDimensions(m,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Vn(()=>{for(let g of this._renderLayers)g.dispose();this._canvas.parentElement?.removeChild(this._canvas),y1(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 O6(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new E6(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=bC(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=nC(Kr.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Kr.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 v6(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,a,d,p,c,h,f,g=0,m=!0,S,C,T,w,_,b,v,y,k;e=I1(e,i.rows-1,0),t=I1(t,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=A-i.buffer.ydisp,R=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),I=-1,Y=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let z=!1;for(d=e;d<=t;d++)for(p=d+i.buffer.ydisp,c=i.buffer.lines.get(p),this._model.lineLengths[d]=0,T=A===p,g=0,h=this._characterJoinerService.getJoinedCharacters(p),y=0;y<i.cols;y++){if(a=this._cellColorResolver.result.bg,c.loadCell(y,s),y===0&&(a=this._cellColorResolver.result.bg),f=!1,m=y>=g,S=y,h.length>0&&y===h[0][0]&&m){C=h.shift();let q=this._model.selection.isCellSelected(this._terminal,C[0],p);for(v=C[0]+1;v<C[1];v++)m&&=q===this._model.selection.isCellSelected(this._terminal,v,p);m&&=!T||R<C[0]||R>=C[1],m?(f=!0,s=new J6(s,c.translateToString(!0,C[0],C[1]),C[1]-C[0]),S=C[1]-1):g=C[1]}if(w=s.getChars(),_=s.getCode(),v=(d*i.cols+y)*$h,this._cellColorResolver.resolve(s,y,p,this.dimensions.device.cell.width),Y&&p===A&&(y===R&&(this._model.cursor={x:R,y:N,width:s.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},I=R+s.getWidth()-1),y>=R&&y<=I&&(this._coreBrowserService.isFocused&&M==="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)),_!==0&&(this._model.lineLengths[d]=y+1),!(this._model.cells[v]===_&&this._model.cells[v+xh]===this._cellColorResolver.result.bg&&this._model.cells[v+wh]===this._cellColorResolver.result.fg&&this._model.cells[v+Yp]===this._cellColorResolver.result.ext)&&(z=!0,w.length>1&&(_|=A6),this._model.cells[v]=_,this._model.cells[v+xh]=this._cellColorResolver.result.bg,this._model.cells[v+wh]=this._cellColorResolver.result.fg,this._model.cells[v+Yp]=this._cellColorResolver.result.ext,b=s.getWidth(),this._glyphRenderer.value.updateCell(y,d,_,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,w,b,a),f)){for(s=this._workCell,y++;y<=S;y++)k=(d*i.cols+y)*$h,this._glyphRenderer.value.updateCell(y,d,0,0,0,0,jM,0,0),this._model.cells[k]=0,this._model.cells[k+xh]=this._cellColorResolver.result.bg,this._model.cells[k+wh]=this._cellColorResolver.result.fg,this._model.cells[k+Yp]=this._cellColorResolver.result.ext;y--}}z&&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})}},J6=class extends uo{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 I1(e,t,i=0){return Math.max(Math.min(e,t),i)}var B1="di$target",P1="di$dependencies",em=new Map;function xr(e){if(em.has(e))return em.get(e);let t=function(i,s,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Q6(t,i,a)};return t._id=e,em.set(e,t),t}function Q6(e,t,i){t[B1]===t?t[P1].push({id:e,index:i}):(t[P1]=[{id:e,index:i}],t[B1]=t)}xr("BufferService");xr("CoreMouseService");xr("CoreService");xr("CharsetService");xr("InstantiationService");xr("LogService");var e4=xr("OptionsService");xr("OscLinkService");xr("UnicodeService");xr("DecorationService");var t4={trace:0,debug:1,info:2,warn:3,error:4,off:5},n4="xterm.js: ",z1=class extends lr{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=t4[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?"":n4)+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)}};z1=wM([CM(0,e4)],z1);var i4=class extends lr{constructor(e){if(sC&&DM()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Gt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Gt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Gt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Gt),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,a=t,d=a._renderService,p=a._characterJoinerService,c=a._charSizeService,h=a._coreBrowserService,f=a._decorationService;a._logService;let g=a._themeService;this._renderer=this._register(new Z6(e,p,c,h,i,f,s,g,this._preserveDrawingBuffer)),this._register(Kr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Kr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Kr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Kr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),d.setRenderer(this._renderer),this._register(Vn(()=>{if(this._terminal._core._store._isDisposed)return;let m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},tm={exports:{}},H1;function r4(){return H1||(H1=1,(function(e,t){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,c,h){var f=this&&this.__decorate||function(v,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(A=v[I])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.AccessibilityManager=void 0;const m=h(9042),S=h(9924),C=h(844),T=h(4725),w=h(2585),_=h(3656);let b=c.AccessibilityManager=class extends C.Disposable{constructor(v,y,k,M){super(),this._terminal=v,this._coreBrowserService=k,this._renderService=M,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 A=0;A<this._terminal.rows;A++)this._rowElements[A]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[A]);if(this._topBoundaryFocusListener=A=>this._handleBoundaryFocus(A,0),this._bottomBoundaryFocusListener=A=>this._handleBoundaryFocus(A,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((A=>this._handleResize(A.rows)))),this.register(this._terminal.onRender((A=>this._refreshRows(A.start,A.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((A=>this._handleChar(A)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
75
|
+
`)))),this.register(this._terminal.onA11yTab((A=>this._handleTab(A)))),this.register(this._terminal.onKey((A=>this._handleKey(A.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,_.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let y=0;y<v;y++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
|
|
76
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,y){this._liveRegionDebouncer.refresh(v,y,this._terminal.rows)}_renderRows(v,y){const k=this._terminal.buffer,M=k.lines.length.toString();for(let A=v;A<=y;A++){const N=k.lines.get(k.ydisp+A),R=[],I=N?.translateToString(!0,void 0,void 0,R)||"",Y=(k.ydisp+A+1).toString(),z=this._rowElements[A];z&&(I.length===0?(z.innerText=" ",this._rowColumns.set(z,[0,1])):(z.textContent=I,this._rowColumns.set(z,R)),z.setAttribute("aria-posinset",Y),z.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,y){const k=v.target,M=this._rowElements[y===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==M)return;let A,N;if(y===0?(A=k,N=this._rowElements.pop(),this._rowContainer.removeChild(N)):(A=this._rowElements.shift(),N=k,this._rowContainer.removeChild(A)),A.removeEventListener("focus",this._topBoundaryFocusListener),N.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:v.anchorNode,offset:v.anchorOffset},k={node:v.focusNode,offset:v.focusOffset};if((y.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===k.node&&y.offset>k.offset)&&([y,k]=[k,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const M=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:M,offset:M.textContent?.length??0}),!this._rowContainer.contains(k.node))return;const A=({node:I,offset:Y})=>{const z=I instanceof Text?I.parentNode:I;let q=parseInt(z?.getAttribute("aria-posinset"),10)-1;if(isNaN(q))return console.warn("row is invalid. Race condition?"),null;const B=this._rowColumns.get(z);if(!B)return console.warn("columns is null. Race condition?"),null;let W=Y<B.length?B[Y]:B.slice(-1)[0]+1;return W>=this._terminal.cols&&(++q,W=0),{row:q,column:W}},N=A(y),R=A(k);if(N&&R){if(N.row>R.row||N.row===R.row&&N.column>=R.column)throw new Error("invalid range");this._terminal.select(N.column,N.row,(R.row-N.row)*this._terminal.cols-N.column+R.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};c.AccessibilityManager=b=f([g(1,w.IInstantiationService),g(2,T.ICoreBrowserService),g(3,T.IRenderService)],b)},3614:(p,c)=>{function h(S){return S.replace(/\r?\n/g,"\r")}function f(S,C){return C?"\x1B[200~"+S+"\x1B[201~":S}function g(S,C,T,w){S=f(S=h(S),T.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(S,!0),C.value=""}function m(S,C,T){const w=T.getBoundingClientRect(),_=S.clientX-w.left-10,b=S.clientY-w.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${_}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=f,c.copyHandler=function(S,C){S.clipboardData&&S.clipboardData.setData("text/plain",C.selectionText),S.preventDefault()},c.handlePasteEvent=function(S,C,T,w){S.stopPropagation(),S.clipboardData&&g(S.clipboardData.getData("text/plain"),C,T,w)},c.paste=g,c.moveTextAreaUnderMouseCursor=m,c.rightClickHandler=function(S,C,T,w,_){m(S,C,T),_&&w.rightClickSelect(S),C.value=w.selectionText,C.select()}},7239:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ColorContrastCache=void 0;const f=h(1505);c.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(g,m,S){this._css.set(g,m,S)}getCss(g,m){return this._css.get(g,m)}setColor(g,m,S){this._color.set(g,m,S)}getColor(g,m){return this._color.get(g,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.addDisposableDomListener=void 0,c.addDisposableDomListener=function(h,f,g,m){h.addEventListener(f,g,m);let S=!1;return{dispose:()=>{S||(S=!0,h.removeEventListener(f,g,m))}}}},3551:function(p,c,h){var f=this&&this.__decorate||function(b,v,y,k){var M,A=arguments.length,N=A<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(v,y,N):M(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Linkifier=void 0;const m=h(3656),S=h(8460),C=h(844),T=h(2585),w=h(4725);let _=c.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(b,v,y,k,M){super(),this._element=b,this._mouseService=v,this._renderService=y,this._bufferService=k,this._linkProviderService=M,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const y=b.composedPath();for(let k=0;k<y.length;k++){const M=y[k];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((k=>{k?.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let y=!1;for(const[k,M]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(k)&&(y=this._checkLinkProviderResult(k,b,y)):M.provideLinks(b.y,(A=>{if(this._isMouseOut)return;const N=A?.map((R=>({link:R})));this._activeProviderReplies?.set(k,N),y=this._checkLinkProviderResult(k,b,y),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,v){const y=new Set;for(let k=0;k<v.size;k++){const M=v.get(k);if(M)for(let A=0;A<M.length;A++){const N=M[A],R=N.link.range.start.y<b?0:N.link.range.start.x,I=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let Y=R;Y<=I;Y++){if(y.has(Y)){M.splice(A--,1);break}y.add(Y)}}}}_checkLinkProviderResult(b,v,y){if(!this._activeProviderReplies)return y;const k=this._activeProviderReplies.get(b);let M=!1;for(let A=0;A<b;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(M=!0);if(!M&&k){const A=k.find((N=>this._linkAtPosition(N.link,v)));A&&(y=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let A=0;A<this._activeProviderReplies.size;A++){const N=this._activeProviderReplies.get(A)?.find((R=>this._linkAtPosition(R.link,v)));if(N){y=!0,this._handleNewLink(N);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const v=this._positionFromMouseEvent(b,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,v){this._currentLink&&this._lastMouseEvent&&(!b||!v||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(b.link,v)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:y=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:y=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const k=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(k,M),this._lastMouseEvent)){const A=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);A&&this._askForLink(A,!1)}}))))}_linkHover(b,v,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(y,v.text)}_fireUnderlineEvent(b,v){const y=b.range,k=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-k-1,y.end.x,y.end.y-k-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(b,v,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(y,v.text)}_linkAtPosition(b,v){const y=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,M=v.y*this._bufferService.cols+v.x;return y<=M&&M<=k}_positionFromMouseEvent(b,v,y){const k=y.getCoords(b,v,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,v,y,k,M){return{x1:b,y1:v,x2:y,y2:k,cols:this._bufferService.cols,fg:M}}};c.Linkifier=_=f([g(1,w.IMouseService),g(2,w.IRenderService),g(3,T.IBufferService),g(4,w.ILinkProviderService)],_)},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 f=this&&this.__decorate||function(w,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,v);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(w,_){return function(b,v){_(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkProvider=void 0;const m=h(511),S=h(2585);let C=c.OscLinkProvider=class{constructor(w,_,b){this._bufferService=w,this._optionsService=_,this._oscLinkService=b}provideLinks(w,_){const b=this._bufferService.buffer.lines.get(w-1);if(!b)return void _(void 0);const v=[],y=this._optionsService.rawOptions.linkHandler,k=new m.CellData,M=b.getTrimmedLength();let A=-1,N=-1,R=!1;for(let I=0;I<M;I++)if(N!==-1||b.hasContent(I)){if(b.loadCell(I,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=I,A=k.extended.urlId;continue}R=k.extended.urlId!==A}else N!==-1&&(R=!0);if(R||N!==-1&&I===M-1){const Y=this._oscLinkService.getLinkData(A)?.uri;if(Y){const z={start:{x:N+1,y:w},end:{x:I+(R||I!==M-1?0:1),y:w}};let q=!1;if(!y?.allowNonHttpProtocols)try{const B=new URL(Y);["http:","https:"].includes(B.protocol)||(q=!0)}catch{q=!0}q||v.push({text:Y,range:z,activate:(B,W)=>y?y.activate(B,W,z):T(0,W),hover:(B,W)=>y?.hover?.(B,W,z),leave:(B,W)=>y?.leave?.(B,W,z)})}R=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=I,A=k.extended.urlId):(N=-1,A=-1)}}_(v)}};function T(w,_){if(confirm(`Do you want to navigate to ${_}?
|
|
77
|
+
|
|
78
|
+
WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=_}else console.warn("Opening link blocked as opener could not be cleared")}}c.OscLinkProvider=C=f([g(0,S.IBufferService),g(1,S.IOptionsService),g(2,S.IOscLinkService)],C)},6193:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.RenderDebouncer=void 0,c.RenderDebouncer=class{constructor(h,f){this._renderCallback=h,this._coreBrowserService=f,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,f,g){this._rowCount=g,h=h!==void 0?h:0,f=f!==void 0?f: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,f):f,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),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f),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 f=h(3614),g=h(3656),m=h(3551),S=h(9042),C=h(3730),T=h(1680),w=h(3107),_=h(5744),b=h(2950),v=h(1296),y=h(428),k=h(4269),M=h(5114),A=h(8934),N=h(3230),R=h(9312),I=h(4725),Y=h(6731),z=h(8055),q=h(8969),B=h(8460),W=h(844),F=h(6114),P=h(8437),K=h(2584),X=h(7399),O=h(5941),H=h(9074),j=h(2585),G=h(5435),V=h(4567),ne=h(779);class ie extends q.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(ee={}){super(ee),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new W.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(H.DecorationService),this._instantiationService.setService(j.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ne.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows((($,ae)=>this.refresh($,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport(($=>this._reportWindowsOptions($)))),this.register(this._inputHandler.onColor(($=>this._handleColorEvent($)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(($=>this._afterResize($.cols,$.rows)))),this.register((0,W.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(ee){if(this._themeService)for(const $ of ee){let ae,ge="";switch($.index){case 256:ae="foreground",ge="10";break;case 257:ae="background",ge="11";break;case 258:ae="cursor",ge="12";break;default:ae="ansi",ge="4;"+$.index}switch($.type){case 0:const we=z.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[$.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${ge};${(0,O.toRgbString)(we)}${K.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((de=>de.ansi[$.index]=z.channels.toColor(...$.color)));else{const de=ae;this._themeService.modifyColors((Ce=>Ce[de]=z.channels.toColor(...$.color)))}break;case 2:this._themeService.restoreColor($.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(ee){ee?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(ee){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.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(K.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 ee=this.buffer.ybase+this.buffer.y,$=this.buffer.lines.get(ee);if(!$)return;const ae=Math.min(this.buffer.x,this.cols-1),ge=this._renderService.dimensions.css.cell.height,we=$.getWidth(ae),de=this._renderService.dimensions.css.cell.width*we,Ce=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=Ce+"px",this.textarea.style.width=de+"px",this.textarea.style.height=ge+"px",this.textarea.style.lineHeight=ge+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",($=>{this.hasSelection()&&(0,f.copyHandler)($,this._selectionService)})));const ee=$=>(0,f.handlePasteEvent)($,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",ee)),this.register((0,g.addDisposableDomListener)(this.element,"paste",ee)),F.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",($=>{$.button===2&&(0,f.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",($=>{(0,f.rightClickHandler)($,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),F.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",($=>{$.button===1&&(0,f.moveTextAreaUnderMouseCursor)($,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",(ee=>this._keyUp(ee)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",(ee=>this._keyDown(ee)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",(ee=>this._keyPress(ee)),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",(ee=>this._compositionHelper.compositionupdate(ee)))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,g.addDisposableDomListener)(this.textarea,"input",(ee=>this._inputEvent(ee)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(ee){if(!ee)throw new Error("Terminal requires a parent element.");if(ee.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=ee.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"),ee.appendChild(this.element);const $=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),$.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,g.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),$.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),F.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(M.CoreBrowserService,this.textarea,ee.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(Y.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.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(A.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild($);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((ae=>this.scrollLines(ae.amount,ae.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(R.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),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(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(v.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const ee=this,$=this.element;function ae(de){const Ce=ee._mouseService.getMouseReportCoords(de,ee.screenElement);if(!Ce)return!1;let Le,Me;switch(de.overrideType||de.type){case"mousemove":Me=32,de.buttons===void 0?(Le=3,de.button!==void 0&&(Le=de.button<3?de.button:3)):Le=1&de.buttons?0:4&de.buttons?1:2&de.buttons?2:3;break;case"mouseup":Me=0,Le=de.button<3?de.button:3;break;case"mousedown":Me=1,Le=de.button<3?de.button:3;break;case"wheel":if(ee._customWheelEventHandler&&ee._customWheelEventHandler(de)===!1||ee.viewport.getLinesScrolled(de)===0)return!1;Me=de.deltaY<0?0:1,Le=4;break;default:return!1}return!(Me===void 0||Le===void 0||Le>4)&&ee.coreMouseService.triggerMouseEvent({col:Ce.col,row:Ce.row,x:Ce.x,y:Ce.y,button:Le,action:Me,ctrl:de.ctrlKey,alt:de.altKey,shift:de.shiftKey})}const ge={mouseup:null,wheel:null,mousedrag:null,mousemove:null},we={mouseup:de=>(ae(de),de.buttons||(this._document.removeEventListener("mouseup",ge.mouseup),ge.mousedrag&&this._document.removeEventListener("mousemove",ge.mousedrag)),this.cancel(de)),wheel:de=>(ae(de),this.cancel(de,!0)),mousedrag:de=>{de.buttons&&ae(de)},mousemove:de=>{de.buttons||ae(de)}};this.register(this.coreMouseService.onProtocolChange((de=>{de?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(de)),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&de?ge.mousemove||($.addEventListener("mousemove",we.mousemove),ge.mousemove=we.mousemove):($.removeEventListener("mousemove",ge.mousemove),ge.mousemove=null),16&de?ge.wheel||($.addEventListener("wheel",we.wheel,{passive:!1}),ge.wheel=we.wheel):($.removeEventListener("wheel",ge.wheel),ge.wheel=null),2&de?ge.mouseup||(ge.mouseup=we.mouseup):(this._document.removeEventListener("mouseup",ge.mouseup),ge.mouseup=null),4&de?ge.mousedrag||(ge.mousedrag=we.mousedrag):(this._document.removeEventListener("mousemove",ge.mousedrag),ge.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)($,"mousedown",(de=>{if(de.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(de))return ae(de),ge.mouseup&&this._document.addEventListener("mouseup",ge.mouseup),ge.mousedrag&&this._document.addEventListener("mousemove",ge.mousedrag),this.cancel(de)}))),this.register((0,g.addDisposableDomListener)($,"wheel",(de=>{if(!ge.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(de)===!1)return!1;if(!this.buffer.hasScrollback){const Ce=this.viewport.getLinesScrolled(de);if(Ce===0)return;const Le=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(de.deltaY<0?"A":"B");let Me="";for(let qe=0;qe<Math.abs(Ce);qe++)Me+=Le;return this.coreService.triggerDataEvent(Me,!0),this.cancel(de,!0)}return this.viewport.handleWheel(de)?this.cancel(de):void 0}}),{passive:!1})),this.register((0,g.addDisposableDomListener)($,"touchstart",(de=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(de),this.cancel(de)}),{passive:!0})),this.register((0,g.addDisposableDomListener)($,"touchmove",(de=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(de)?void 0:this.cancel(de)}),{passive:!1}))}refresh(ee,$){this._renderService?.refreshRows(ee,$)}updateCursorStyle(ee){this._selectionService?.shouldColumnSelect(ee)?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(ee,$,ae=0){ae===1?(super.scrollLines(ee,$,ae),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(ee)}paste(ee){(0,f.paste)(ee,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(ee){this._customKeyEventHandler=ee}attachCustomWheelEventHandler(ee){this._customWheelEventHandler=ee}registerLinkProvider(ee){return this._linkProviderService.registerLinkProvider(ee)}registerCharacterJoiner(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const $=this._characterJoinerService.register(ee);return this.refresh(0,this.rows-1),$}deregisterCharacterJoiner(ee){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(ee)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(ee){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+ee)}registerDecoration(ee){return this._decorationService.registerDecoration(ee)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(ee,$,ae){this._selectionService.setSelection(ee,$,ae)}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(ee,$){this._selectionService?.selectLines(ee,$)}_keyDown(ee){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;const $=this.browser.isMac&&this.options.macOptionIsMeta&&ee.altKey;if(!$&&!this._compositionHelper.keydown(ee))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;$||ee.key!=="Dead"&&ee.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,X.evaluateKeyboardEvent)(ee,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(ee),ae.type===3||ae.type===2){const ge=this.rows-1;return this.scrollLines(ae.type===2?-ge:ge),this.cancel(ee,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,ee)||(ae.cancel&&this.cancel(ee,!0),!ae.key||!!(ee.key&&!ee.ctrlKey&&!ee.altKey&&!ee.metaKey&&ee.key.length===1&&ee.key.charCodeAt(0)>=65&&ee.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==K.C0.ETX&&ae.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||ee.altKey||ee.ctrlKey?this.cancel(ee,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(ee,$){const ae=ee.isMac&&!this.options.macOptionIsMeta&&$.altKey&&!$.ctrlKey&&!$.metaKey||ee.isWindows&&$.altKey&&$.ctrlKey&&!$.metaKey||ee.isWindows&&$.getModifierState("AltGraph");return $.type==="keypress"?ae:ae&&(!$.keyCode||$.keyCode>47)}_keyUp(ee){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1||((function($){return $.keyCode===16||$.keyCode===17||$.keyCode===18})(ee)||this.focus(),this.updateCursorStyle(ee),this._keyPressHandled=!1)}_keyPress(ee){let $;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(ee)===!1)return!1;if(this.cancel(ee),ee.charCode)$=ee.charCode;else if(ee.which===null||ee.which===void 0)$=ee.keyCode;else{if(ee.which===0||ee.charCode===0)return!1;$=ee.which}return!(!$||(ee.altKey||ee.ctrlKey||ee.metaKey)&&!this._isThirdLevelShift(this.browser,ee)||($=String.fromCharCode($),this._onKey.fire({key:$,domEvent:ee}),this._showCursor(),this.coreService.triggerDataEvent($,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(ee){if(ee.data&&ee.inputType==="insertText"&&(!ee.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const $=ee.data;return this.coreService.triggerDataEvent($,!0),this.cancel(ee),!0}return!1}resize(ee,$){ee!==this.cols||$!==this.rows?super.resize(ee,$):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(ee,$){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 ee=1;ee<this.rows;ee++)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 ee=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=ee,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(ee){if(this._renderService)switch(ee){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const $=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${ae};${$}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ge=this._renderService.dimensions.css.cell.width.toFixed(0),we=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${we};${ge}t`)}}cancel(ee,$){if(this.options.cancelEvents||$)return ee.preventDefault(),ee.stopPropagation(),!1}}c.Terminal=ie},9924:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TimeBasedDebouncer=void 0,c.TimeBasedDebouncer=class{constructor(h,f=1e3){this._renderCallback=h,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,f,g){this._rowCount=g,h=h!==void 0?h:0,f=f!==void 0?f: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,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=m-this._lastRefreshMs,C=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f)}}},1680:function(p,c,h){var f=this&&this.__decorate||function(b,v,y,k){var M,A=arguments.length,N=A<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(v,y,N):M(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.Viewport=void 0;const m=h(3656),S=h(4725),C=h(8460),T=h(844),w=h(2585);let _=c.Viewport=class extends T.Disposable{constructor(b,v,y,k,M,A,N,R){super(),this._viewportElement=b,this._scrollArea=v,this._bufferService=y,this._optionsService=k,this._charSizeService=M,this._renderService=A,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,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(R.colors),this.register(R.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const v=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==v&&(this._lastRecordedBufferHeight=v,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const v=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,v){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(v<0&&this._viewportElement.scrollTop!==0||v>0&&y<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const v=this._getPixelsScrolled(b);return v!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+v:this._smoothScrollState.target+=v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const v=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+v,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?v*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._currentRowHeight*this._bufferService.rows),v}getBufferElements(b,v){let y,k="";const M=[],A=v??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let R=b;R<A;R++){const I=N.get(R);if(!I)continue;const Y=N.get(R+1)?.isWrapped;if(k+=I.translateToString(!Y),!Y||R===N.length-1){const z=document.createElement("div");z.textContent=k,M.push(z),k.length>0&&(y=z),k=""}}return{bufferElements:M,cursorElement:y}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let v=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(v/=this._currentRowHeight+0,this._wheelPartialScroll+=v,v=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(v*=this._bufferService.rows),v}_applyScrollModifier(b,v){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&v.altKey||y==="ctrl"&&v.ctrlKey||y==="shift"&&v.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const v=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,v!==0&&(this._viewportElement.scrollTop+=v,this._bubbleScroll(b,v))}};c.Viewport=_=f([g(2,w.IBufferService),g(3,w.IOptionsService),g(4,S.ICharSizeService),g(5,S.IRenderService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],_)},3107:function(p,c,h){var f=this&&this.__decorate||function(w,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,v);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(w,_){return function(b,v){_(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferDecorationRenderer=void 0;const m=h(4725),S=h(844),C=h(2585);let T=c.BufferDecorationRenderer=class extends S.Disposable{constructor(w,_,b,v,y){super(),this._screenElement=w,this._bufferService=_,this._coreBrowserService=b,this._decorationService=v,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((k=>this._removeDecoration(k)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){const _=this._coreBrowserService.mainDocument.createElement("div");_.classList.add("xterm-decoration"),_.classList.toggle("xterm-decoration-top-layer",w?.options?.layer==="top"),_.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,_.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",_.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",_.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=w.options.x??0;return b&&b>this._bufferService.cols&&(_.style.display="none"),this._refreshXPosition(w,_),_}_refreshStyle(w){const _=w.marker.line-this._bufferService.buffers.active.ydisp;if(_<0||_>=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=_*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(b)}}_refreshXPosition(w,_=w.element){if(!_)return;const b=w.options.x??0;(w.options.anchor||"left")==="right"?_.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":_.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=f([g(1,C.IBufferService),g(2,m.ICoreBrowserService),g(3,C.IDecorationService),g(4,m.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 f of this._zones)if(f.color===h.options.overviewRulerOptions.color&&f.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,h.marker.line))return;if(this._lineAdjacentToZone(f,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(f,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,f){return f>=h.startBufferLine&&f<=h.endBufferLine}_lineAdjacentToZone(h,f,g){return f>=h.startBufferLine-this._linePadding[g||"full"]&&f<=h.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(h,f){h.startBufferLine=Math.min(h.startBufferLine,f),h.endBufferLine=Math.max(h.endBufferLine,f)}}},5744:function(p,c,h){var f=this&&this.__decorate||function(y,k,M,A){var N,R=arguments.length,I=R<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,M):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(y,k,M,A);else for(var Y=y.length-1;Y>=0;Y--)(N=y[Y])&&(I=(R<3?N(I):R>3?N(k,M,I):N(k,M))||I);return R>3&&I&&Object.defineProperty(k,M,I),I},g=this&&this.__param||function(y,k){return function(M,A){k(M,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OverviewRulerRenderer=void 0;const m=h(5871),S=h(4725),C=h(844),T=h(2585),w={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let v=c.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,k,M,A,N,R,I){super(),this._viewportElement=y,this._screenElement=k,this._bufferService=M,this._decorationService=A,this._renderService=N,this._optionsService=R,this._coreBrowserService=I,this._colorZoneStore=new m.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 Y=this._canvas.getContext("2d");if(!Y)throw new Error("Ctx cannot be null");this._ctx=Y,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 y=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);_.full=this._canvas.width,_.left=y,_.center=k,_.right=y,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=_.left,b.right=_.left+_.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(y,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 y=this._colorZoneStore.zones;for(const k of y)k.position!=="full"&&this._renderColorZone(k);for(const k of y)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(b[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-w[y.position||"full"]/2),_[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[y.position||"full"]))}_queueRefresh(y,k){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};c.OverviewRulerRenderer=v=f([g(2,T.IBufferService),g(3,T.IDecorationService),g(4,S.IRenderService),g(5,T.IOptionsService),g(6,S.ICoreBrowserService)],v)},2950:function(p,c,h){var f=this&&this.__decorate||function(w,_,b,v){var y,k=arguments.length,M=k<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,b):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,v);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},g=this&&this.__param||function(w,_){return function(b,v){_(b,v,w)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CompositionHelper=void 0;const m=h(4725),S=h(2585),C=h(2584);let T=c.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,_,b,v,y,k){this._textarea=w,this._compositionView=_,this._bufferService=b,this._optionsService=v,this._coreService=y,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 _={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,_.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(_.start,_.end):this._textarea.value.substring(_.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const _=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(_,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const _=this._textarea.value,b=_.replace(w,"");this._dataAlreadySent=b,_.length>w.length?this._coreService.triggerDataEvent(b,!0):_.length<w.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):_.length===w.length&&_!==w&&this._coreService.triggerDataEvent(_,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const _=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,v=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=_*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=v+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=y+"px",this._textarea.style.top=v+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};c.CompositionHelper=T=f([g(2,S.IBufferService),g(3,S.IOptionsService),g(4,S.ICoreService),g(5,m.IRenderService)],T)},9806:(p,c)=>{function h(f,g,m){const S=m.getBoundingClientRect(),C=f.getComputedStyle(m),T=parseInt(C.getPropertyValue("padding-left")),w=parseInt(C.getPropertyValue("padding-top"));return[g.clientX-S.left-T,g.clientY-S.top-w]}Object.defineProperty(c,"__esModule",{value:!0}),c.getCoords=c.getCoordsRelativeToElement=void 0,c.getCoordsRelativeToElement=h,c.getCoords=function(f,g,m,S,C,T,w,_,b){if(!T)return;const v=h(f,g,m);return v?(v[0]=Math.ceil((v[0]+(b?w/2:0))/w),v[1]=Math.ceil(v[1]/_),v[0]=Math.min(Math.max(v[0],1),S+(b?1:0)),v[1]=Math.min(Math.max(v[1],1),C),v):void 0}},9504:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.moveToCellSequence=void 0;const f=h(2584);function g(_,b,v,y){const k=_-m(_,v),M=b-m(b,v),A=Math.abs(k-M)-(function(N,R,I){let Y=0;const z=N-m(N,I),q=R-m(R,I);for(let B=0;B<Math.abs(z-q);B++){const W=S(N,R)==="A"?-1:1;I.buffer.lines.get(z+W*B)?.isWrapped&&Y++}return Y})(_,b,v);return w(A,T(S(_,b),y))}function m(_,b){let v=0,y=b.buffer.lines.get(_),k=y?.isWrapped;for(;k&&_>=0&&_<b.rows;)v++,y=b.buffer.lines.get(--_),k=y?.isWrapped;return v}function S(_,b){return _>b?"A":"B"}function C(_,b,v,y,k,M){let A=_,N=b,R="";for(;A!==v||N!==y;)A+=k?1:-1,k&&A>M.cols-1?(R+=M.buffer.translateBufferLineToString(N,!1,_,A),A=0,_=0,N++):!k&&A<0&&(R+=M.buffer.translateBufferLineToString(N,!1,0,_+1),A=M.cols-1,_=A,N--);return R+M.buffer.translateBufferLineToString(N,!1,_,A)}function T(_,b){const v=b?"O":"[";return f.C0.ESC+v+_}function w(_,b){_=Math.floor(_);let v="";for(let y=0;y<_;y++)v+=b;return v}c.moveToCellSequence=function(_,b,v,y){const k=v.buffer.x,M=v.buffer.y;if(!v.buffer.hasScrollback)return(function(R,I,Y,z,q,B){return g(I,z,q,B).length===0?"":w(C(R,I,R,I-m(I,q),!1,q).length,T("D",B))})(k,M,0,b,v,y)+g(M,b,v,y)+(function(R,I,Y,z,q,B){let W;W=g(I,z,q,B).length>0?z-m(z,q):I;const F=z,P=(function(K,X,O,H,j,G){let V;return V=g(O,H,j,G).length>0?H-m(H,j):X,K<O&&V<=H||K>=O&&V<H?"C":"D"})(R,I,Y,z,q,B);return w(C(R,W,Y,F,P==="C",q).length,T(P,B))})(k,M,_,b,v,y);let A;if(M===b)return A=k>_?"D":"C",w(Math.abs(k-_),T(A,y));A=M>b?"D":"C";const N=Math.abs(M-b);return w((function(R,I){return I.cols-R})(M>b?_:k,v)+(N-1)*v.cols+1+((M>b?k:_)-1),T(A,y))}},1296:function(p,c,h){var f=this&&this.__decorate||function(B,W,F,P){var K,X=arguments.length,O=X<3?W:P===null?P=Object.getOwnPropertyDescriptor(W,F):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(B,W,F,P);else for(var H=B.length-1;H>=0;H--)(K=B[H])&&(O=(X<3?K(O):X>3?K(W,F,O):K(W,F))||O);return X>3&&O&&Object.defineProperty(W,F,O),O},g=this&&this.__param||function(B,W){return function(F,P){W(F,P,B)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRenderer=void 0;const m=h(3787),S=h(2550),C=h(2223),T=h(6171),w=h(6052),_=h(4725),b=h(8055),v=h(8460),y=h(844),k=h(2585),M="xterm-dom-renderer-owner-",A="xterm-rows",N="xterm-fg-",R="xterm-bg-",I="xterm-focus",Y="xterm-selection";let z=1,q=c.DomRenderer=class extends y.Disposable{constructor(B,W,F,P,K,X,O,H,j,G,V,ne,ie){super(),this._terminal=B,this._document=W,this._element=F,this._screenElement=P,this._viewportElement=K,this._helperContainer=X,this._linkifier2=O,this._charSizeService=j,this._optionsService=G,this._bufferService=V,this._coreBrowserService=ne,this._themeService=ie,this._terminalClass=z++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new v.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(A),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(Y),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((ve=>this._injectCss(ve)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(M+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ve=>this._handleLinkHover(ve)))),this.register(this._linkifier2.onHideLinkUnderline((ve=>this._handleLinkLeave(ve)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(M+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const W=`${this._terminalSelector} .${A} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=W,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let W=`${this._terminalSelector} .${A} { color: ${B.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;W+=`${this._terminalSelector} .${A} .xterm-dim { color: ${b.color.multiplyOpacity(B.foreground,.5).css};}`,W+=`${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 F=`blink_underline_${this._terminalClass}`,P=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;W+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${P} { 50% { box-shadow: none; }}`,W+=`@keyframes ${K} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,W+=`${this._terminalSelector} .${A}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${A}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${A}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,W+=`${this._terminalSelector} .${Y} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Y} div { position: absolute; background-color: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Y} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[X,O]of B.ansi.entries())W+=`${this._terminalSelector} .${N}${X} { color: ${O.css}; }${this._terminalSelector} .${N}${X}.xterm-dim { color: ${b.color.multiplyOpacity(O,.5).css}; }${this._terminalSelector} .${R}${X} { background-color: ${O.css}; }`;W+=`${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(B.background).css}; }${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${R}${C.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=W}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,W){for(let F=this._rowElements.length;F<=W;F++){const P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>W;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,W){this._refreshRowElements(B,W),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(B,W,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,W,F),this.renderRows(0,this._bufferService.rows-1),!B||!W)return;this._selectionRenderModel.update(this._terminal,B,W,F);const P=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,X=this._selectionRenderModel.viewportCappedStartRow,O=this._selectionRenderModel.viewportCappedEndRow;if(X>=this._bufferService.rows||O<0)return;const H=this._document.createDocumentFragment();if(F){const j=B[0]>W[0];H.appendChild(this._createSelectionElement(X,j?W[0]:B[0],j?B[0]:W[0],O-X+1))}else{const j=P===X?B[0]:0,G=X===K?W[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(X,j,G));const V=O-X-1;if(H.appendChild(this._createSelectionElement(X+1,0,this._bufferService.cols,V)),X!==O){const ne=K===O?W[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(O,0,ne))}}this._selectionContainer.appendChild(H)}_createSelectionElement(B,W,F,P=1){const K=this._document.createElement("div"),X=W*this.dimensions.css.cell.width;let O=this.dimensions.css.cell.width*(F-W);return X+O>this.dimensions.css.canvas.width&&(O=this.dimensions.css.canvas.width-X),K.style.height=P*this.dimensions.css.cell.height+"px",K.style.top=B*this.dimensions.css.cell.height+"px",K.style.left=`${X}px`,K.style.width=`${O}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const B of this._rowElements)B.replaceChildren()}renderRows(B,W){const F=this._bufferService.buffer,P=F.ybase+F.y,K=Math.min(F.x,this._bufferService.cols-1),X=this._optionsService.rawOptions.cursorBlink,O=this._optionsService.rawOptions.cursorStyle,H=this._optionsService.rawOptions.cursorInactiveStyle;for(let j=B;j<=W;j++){const G=j+F.ydisp,V=this._rowElements[j],ne=F.lines.get(G);if(!V||!ne)break;V.replaceChildren(...this._rowFactory.createRow(ne,G,G===P,O,H,K,X,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${M}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,W,F,P,K,X){F<0&&(B=0),P<0&&(W=0);const O=this._bufferService.rows-1;F=Math.max(Math.min(F,O),0),P=Math.max(Math.min(P,O),0),K=Math.min(K,this._bufferService.cols);const H=this._bufferService.buffer,j=H.ybase+H.y,G=Math.min(H.x,K-1),V=this._optionsService.rawOptions.cursorBlink,ne=this._optionsService.rawOptions.cursorStyle,ie=this._optionsService.rawOptions.cursorInactiveStyle;for(let ve=F;ve<=P;++ve){const ee=ve+H.ydisp,$=this._rowElements[ve],ae=H.lines.get(ee);if(!$||!ae)break;$.replaceChildren(...this._rowFactory.createRow(ae,ee,ee===j,ne,ie,G,V,this.dimensions.css.cell.width,this._widthCache,X?ve===F?B:0:-1,X?(ve===P?W:K)-1:-1))}}};c.DomRenderer=q=f([g(7,k.IInstantiationService),g(8,_.ICharSizeService),g(9,k.IOptionsService),g(10,k.IBufferService),g(11,_.ICoreBrowserService),g(12,_.IThemeService)],q)},3787:function(p,c,h){var f=this&&this.__decorate||function(A,N,R,I){var Y,z=arguments.length,q=z<3?N:I===null?I=Object.getOwnPropertyDescriptor(N,R):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(A,N,R,I);else for(var B=A.length-1;B>=0;B--)(Y=A[B])&&(q=(z<3?Y(q):z>3?Y(N,R,q):Y(N,R))||q);return z>3&&q&&Object.defineProperty(N,R,q),q},g=this&&this.__param||function(A,N){return function(R,I){N(R,I,A)}};Object.defineProperty(c,"__esModule",{value:!0}),c.DomRendererRowFactory=void 0;const m=h(2223),S=h(643),C=h(511),T=h(2585),w=h(8055),_=h(4725),b=h(4269),v=h(6171),y=h(3734);let k=c.DomRendererRowFactory=class{constructor(A,N,R,I,Y,z,q){this._document=A,this._characterJoinerService=N,this._optionsService=R,this._coreBrowserService=I,this._coreService=Y,this._decorationService=z,this._themeService=q,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(A,N,R){this._selectionStart=A,this._selectionEnd=N,this._columnSelectMode=R}createRow(A,N,R,I,Y,z,q,B,W,F,P){const K=[],X=this._characterJoinerService.getJoinedCharacters(N),O=this._themeService.colors;let H,j=A.getNoBgTrimmedLength();R&&j<z+1&&(j=z+1);let G=0,V="",ne=0,ie=0,ve=0,ee=!1,$=0,ae=!1,ge=0;const we=[],de=F!==-1&&P!==-1;for(let Ce=0;Ce<j;Ce++){A.loadCell(Ce,this._workCell);let Le=this._workCell.getWidth();if(Le===0)continue;let Me=!1,qe=Ce,ke=this._workCell;if(X.length>0&&Ce===X[0][0]){Me=!0;const rt=X.shift();ke=new b.JoinedCellData(this._workCell,A.translateToString(!0,rt[0],rt[1]),rt[1]-rt[0]),qe=rt[1]-1,Le=ke.getWidth()}const ye=this._isCellInSelection(Ce,N),Oe=R&&Ce===z,wt=de&&Ce>=F&&Ce<=P;let On=!1;this._decorationService.forEachDecorationAtCell(Ce,N,void 0,(rt=>{On=!0}));let Xn=ke.getChars()||S.WHITESPACE_CELL_CHAR;if(Xn===" "&&(ke.isUnderline()||ke.isOverline())&&(Xn=" "),ge=Le*B-W.get(Xn,ke.isBold(),ke.isItalic()),H){if(G&&(ye&&ae||!ye&&!ae&&ke.bg===ne)&&(ye&&ae&&O.selectionForeground||ke.fg===ie)&&ke.extended.ext===ve&&wt===ee&&ge===$&&!Oe&&!Me&&!On){ke.isInvisible()?V+=S.WHITESPACE_CELL_CHAR:V+=Xn,G++;continue}G&&(H.textContent=V),H=this._document.createElement("span"),G=0,V=""}else H=this._document.createElement("span");if(ne=ke.bg,ie=ke.fg,ve=ke.extended.ext,ee=wt,$=ge,ae=ye,Me&&z>=Ce&&z<=qe&&(z=Ce),!this._coreService.isCursorHidden&&Oe&&this._coreService.isCursorInitialized){if(we.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&we.push("xterm-cursor-blink"),we.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(Y)switch(Y){case"outline":we.push("xterm-cursor-outline");break;case"block":we.push("xterm-cursor-block");break;case"bar":we.push("xterm-cursor-bar");break;case"underline":we.push("xterm-cursor-underline")}}if(ke.isBold()&&we.push("xterm-bold"),ke.isItalic()&&we.push("xterm-italic"),ke.isDim()&&we.push("xterm-dim"),V=ke.isInvisible()?S.WHITESPACE_CELL_CHAR:ke.getChars()||S.WHITESPACE_CELL_CHAR,ke.isUnderline()&&(we.push(`xterm-underline-${ke.extended.underlineStyle}`),V===" "&&(V=" "),!ke.isUnderlineColorDefault()))if(ke.isUnderlineColorRGB())H.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(ke.getUnderlineColor()).join(",")})`;else{let rt=ke.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ke.isBold()&&rt<8&&(rt+=8),H.style.textDecorationColor=O.ansi[rt].css}ke.isOverline()&&(we.push("xterm-overline"),V===" "&&(V=" ")),ke.isStrikethrough()&&we.push("xterm-strikethrough"),wt&&(H.style.textDecoration="underline");let en=ke.getFgColor(),ft=ke.getFgColorMode(),tn=ke.getBgColor(),Kt=ke.getBgColorMode();const Ht=!!ke.isInverse();if(Ht){const rt=en;en=tn,tn=rt;const kn=ft;ft=Kt,Kt=kn}let nn,pn,sn,Zn=!1;switch(this._decorationService.forEachDecorationAtCell(Ce,N,void 0,(rt=>{rt.options.layer!=="top"&&Zn||(rt.backgroundColorRGB&&(Kt=50331648,tn=rt.backgroundColorRGB.rgba>>8&16777215,nn=rt.backgroundColorRGB),rt.foregroundColorRGB&&(ft=50331648,en=rt.foregroundColorRGB.rgba>>8&16777215,pn=rt.foregroundColorRGB),Zn=rt.options.layer==="top")})),!Zn&&ye&&(nn=this._coreBrowserService.isFocused?O.selectionBackgroundOpaque:O.selectionInactiveBackgroundOpaque,tn=nn.rgba>>8&16777215,Kt=50331648,Zn=!0,O.selectionForeground&&(ft=50331648,en=O.selectionForeground.rgba>>8&16777215,pn=O.selectionForeground)),Zn&&we.push("xterm-decoration-top"),Kt){case 16777216:case 33554432:sn=O.ansi[tn],we.push(`xterm-bg-${tn}`);break;case 50331648:sn=w.channels.toColor(tn>>16,tn>>8&255,255&tn),this._addStyle(H,`background-color:#${M((tn>>>0).toString(16),"0",6)}`);break;default:Ht?(sn=O.foreground,we.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):sn=O.background}switch(nn||ke.isDim()&&(nn=w.color.multiplyOpacity(sn,.5)),ft){case 16777216:case 33554432:ke.isBold()&&en<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(en+=8),this._applyMinimumContrast(H,sn,O.ansi[en],ke,nn,void 0)||we.push(`xterm-fg-${en}`);break;case 50331648:const rt=w.channels.toColor(en>>16&255,en>>8&255,255&en);this._applyMinimumContrast(H,sn,rt,ke,nn,pn)||this._addStyle(H,`color:#${M(en.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(H,sn,O.foreground,ke,nn,pn)||Ht&&we.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}we.length&&(H.className=we.join(" "),we.length=0),Oe||Me||On?H.textContent=V:G++,ge!==this.defaultSpacing&&(H.style.letterSpacing=`${ge}px`),K.push(H),Ce=qe}return H&&G&&(H.textContent=V),K}_applyMinimumContrast(A,N,R,I,Y,z){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,v.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const q=this._getContrastCache(I);let B;if(Y||z||(B=q.getColor(N.rgba,R.rgba)),B===void 0){const W=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);B=w.color.ensureContrastRatio(Y||N,z||R,W),q.setColor((Y||N).rgba,(z||R).rgba,B??null)}return!!B&&(this._addStyle(A,`color:${B.css}`),!0)}_getContrastCache(A){return A.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(A,N){A.setAttribute("style",`${A.getAttribute("style")||""}${N};`)}_isCellInSelection(A,N){const R=this._selectionStart,I=this._selectionEnd;return!(!R||!I)&&(this._columnSelectMode?R[0]<=I[0]?A>=R[0]&&N>=R[1]&&A<I[0]&&N<=I[1]:A<R[0]&&N>=R[1]&&A>=I[0]&&N<=I[1]:N>R[1]&&N<I[1]||R[1]===I[1]&&N===R[1]&&A>=R[0]&&A<I[0]||R[1]<I[1]&&N===I[1]&&A<I[0]||R[1]<I[1]&&N===R[1]&&A>=R[0])}};function M(A,N,R){for(;A.length<R;)A=N+A;return A}c.DomRendererRowFactory=k=f([g(1,_.ICharacterJoinerService),g(2,T.IOptionsService),g(3,_.ICoreBrowserService),g(4,T.ICoreService),g(5,T.IDecorationService),g(6,_.IThemeService)],k)},2550:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WidthCache=void 0,c.WidthCache=class{constructor(h,f){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 g=h.createElement("span");g.classList.add("xterm-char-measure-element");const m=h.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const S=h.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const C=h.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[g,m,S,C],this._container.appendChild(g),this._container.appendChild(m),this._container.appendChild(S),this._container.appendChild(C),f.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,f,g,m){h===this._font&&f===this._fontSize&&g===this._weight&&m===this._weightBold||(this._font=h,this._fontSize=f,this._weight=g,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(h,f,g){let m=0;if(!f&&!g&&h.length===1&&(m=h.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const T=this._measure(h,0);return T>0&&(this._flat[m]=T),T}let S=h;f&&(S+="B"),g&&(S+="I");let C=this._holey.get(S);if(C===void 0){let T=0;f&&(T|=1),g&&(T|=2),C=this._measure(h,T),C>0&&this._holey.set(S,C)}return C}_measure(h,f){const g=this._measureElements[f];return g.textContent=h.repeat(32),g.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 f=h(6114);c.INVERTED_DEFAULT_COLOR=257,c.DIM_OPACITY=.5,c.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(p,c)=>{function h(g){return 57508<=g&&g<=57558}function f(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=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(g){if(!g)throw new Error("value must not be falsy");return g},c.isPowerlineGlyph=h,c.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},c.isEmoji=f,c.allowRescaling=function(g,m,S,C){return m===1&&S>Math.ceil(1.5*C)&&g!==void 0&&g>255&&!f(g)&&!h(g)&&!(function(T){return 57344<=T&&T<=63743})(g)},c.treatGlyphAsBackgroundColor=function(g){return h(g)||(function(m){return 9472<=m&&m<=9631})(g)},c.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},c.computeNextVariantOffset=function(g,m,S=0){return(g-(2*Math.round(m)-S))%(2*Math.round(m))}},6052:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,m,S,C=!1){if(this.selectionStart=m,this.selectionEnd=S,!m||!S||m[0]===S[0]&&m[1]===S[1])return void this.clear();const T=g.buffers.active.ydisp,w=m[1]-T,_=S[1]-T,b=Math.max(w,0),v=Math.min(_,g.rows-1);b>=g.rows||v<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=w,this.viewportEndRow=_,this.viewportCappedStartRow=b,this.viewportCappedEndRow=v,this.startCol=m[0],this.endCol=S[0])}isCellSelected(g,m,S){return!!this.hasSelection&&(S-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&S>=this.viewportCappedStartRow&&m<this.endCol&&S<=this.viewportCappedEndRow:m<this.startCol&&S>=this.viewportCappedStartRow&&m>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&m>=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,f=this.selectionEnd;return!(!h||!f)&&(h[1]>f[1]||h[1]===f[1]&&h[0]>f[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 f=this&&this.__decorate||function(v,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(A=v[I])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharSizeService=void 0;const m=h(2585),S=h(8460),C=h(844);let T=c.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(v,y,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new _(v,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const v=this._measureStrategy.measure();v.width===this.width&&v.height===this.height||(this.width=v.width,this.height=v.height,this._onCharSizeChange.fire())}};c.CharSizeService=T=f([g(2,m.IOptionsService)],T);class w extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,k){y!==void 0&&y>0&&k!==void 0&&k>0&&(this._result.width=y,this._result.height=k)}}class _ extends w{constructor(y,k,M){super(),this._document=y,this._parentElement=k,this._optionsService=M,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(y){super(),this._optionsService=y,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 y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(p,c,h){var f=this&&this.__decorate||function(b,v,y,k){var M,A=arguments.length,N=A<3?v:k===null?k=Object.getOwnPropertyDescriptor(v,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,v,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(v,y,N):M(v,y))||N);return A>3&&N&&Object.defineProperty(v,y,N),N},g=this&&this.__param||function(b,v){return function(y,k){v(y,k,b)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CharacterJoinerService=c.JoinedCellData=void 0;const m=h(3734),S=h(643),C=h(511),T=h(2585);class w extends m.AttributeData{constructor(v,y,k){super(),this.content=0,this.combinedData="",this.fg=v.fg,this.bg=v.bg,this.combinedData=y,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(v){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.JoinedCellData=w;let _=c.CharacterJoinerService=class kC{constructor(v){this._bufferService=v,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(v){const y={id:this._nextCharacterJoinerId++,handler:v};return this._characterJoiners.push(y),y.id}deregister(v){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===v)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(v){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(v);if(!y||y.length===0)return[];const k=[],M=y.translateToString(!0);let A=0,N=0,R=0,I=y.getFg(0),Y=y.getBg(0);for(let z=0;z<y.getTrimmedLength();z++)if(y.loadCell(z,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==Y){if(z-A>1){const q=this._getJoinedRanges(M,R,N,y,A);for(let B=0;B<q.length;B++)k.push(q[B])}A=z,R=N,I=this._workCell.fg,Y=this._workCell.bg}N+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-A>1){const z=this._getJoinedRanges(M,R,N,y,A);for(let q=0;q<z.length;q++)k.push(z[q])}return k}_getJoinedRanges(v,y,k,M,A){const N=v.substring(y,k);let R=[];try{R=this._characterJoiners[0].handler(N)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const Y=this._characterJoiners[I].handler(N);for(let z=0;z<Y.length;z++)kC._mergeRanges(R,Y[z])}catch(Y){console.error(Y)}return this._stringRangesToCellRanges(R,M,A),R}_stringRangesToCellRanges(v,y,k){let M=0,A=!1,N=0,R=v[M];if(R){for(let I=k;I<this._bufferService.cols;I++){const Y=y.getWidth(I),z=y.getString(I).length||S.WHITESPACE_CELL_CHAR.length;if(Y!==0){if(!A&&R[0]<=N&&(R[0]=I,A=!0),R[1]<=N){if(R[1]=I,R=v[++M],!R)break;R[0]<=N?(R[0]=I,A=!0):A=!1}N+=z}}R&&(R[1]=this._bufferService.cols)}}static _mergeRanges(v,y){let k=!1;for(let M=0;M<v.length;M++){const A=v[M];if(k){if(y[1]<=A[0])return v[M-1][1]=y[1],v;if(y[1]<=A[1])return v[M-1][1]=Math.max(y[1],A[1]),v.splice(M,1),v;v.splice(M,1),M--}else{if(y[1]<=A[0])return v.splice(M,0,y),v;if(y[1]<=A[1])return A[0]=Math.min(y[0],A[0]),v;y[0]<A[1]&&(A[0]=Math.min(y[0],A[0]),k=!0)}}return k?v[v.length-1][1]=y[1]:v.push(y),v}};c.CharacterJoinerService=_=f([g(0,T.IBufferService)],_)},5114:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreBrowserService=void 0;const f=h(844),g=h(8460),m=h(3656);class S extends f.Disposable{constructor(w,_,b){super(),this._textarea=w,this._window=_,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((v=>this._screenDprMonitor.setWindow(v)))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}c.CoreBrowserService=S;class C extends f.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.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 f=h(844);class g extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const C=this.linkProviders.indexOf(S);C!==-1&&this.linkProviders.splice(C,1)}}}}c.LinkProviderService=g},8934:function(p,c,h){var f=this&&this.__decorate||function(T,w,_,b){var v,y=arguments.length,k=y<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,w,_,b);else for(var M=T.length-1;M>=0;M--)(v=T[M])&&(k=(y<3?v(k):y>3?v(w,_,k):v(w,_))||k);return y>3&&k&&Object.defineProperty(w,_,k),k},g=this&&this.__param||function(T,w){return function(_,b){w(_,b,T)}};Object.defineProperty(c,"__esModule",{value:!0}),c.MouseService=void 0;const m=h(4725),S=h(9806);let C=c.MouseService=class{constructor(T,w){this._renderService=T,this._charSizeService=w}getCoords(T,w,_,b,v){return(0,S.getCoords)(window,T,w,_,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,v)}getMouseReportCoords(T,w){const _=(0,S.getCoordsRelativeToElement)(window,T,w);if(this._charSizeService.hasValidSize)return _[0]=Math.min(Math.max(_[0],0),this._renderService.dimensions.css.canvas.width-1),_[1]=Math.min(Math.max(_[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(_[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(_[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(_[0]),y:Math.floor(_[1])}}};c.MouseService=C=f([g(0,m.IRenderService),g(1,m.ICharSizeService)],C)},3230:function(p,c,h){var f=this&&this.__decorate||function(v,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(A=v[I])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.RenderService=void 0;const m=h(6193),S=h(4725),C=h(8460),T=h(844),w=h(7226),_=h(2585);let b=c.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(v,y,k,M,A,N,R,I){super(),this._rowCount=v,this._charSizeService=M,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 m.RenderDebouncer(((Y,z)=>this._renderRows(Y,z)),R),this.register(this._renderDebouncer),this.register(R.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(A.onDecorationRegistered((()=>this._fullRefresh()))),this.register(A.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(N.cols,N.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(N.buffer.y,N.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(R.window,y),this.register(R.onWindowChange((Y=>this._registerIntersectionObserver(Y,y))))}_registerIntersectionObserver(v,y){if("IntersectionObserver"in v){const k=new v.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});k.observe(y),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(v){this._isPaused=v.isIntersecting===void 0?v.intersectionRatio===0:!v.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(v,y,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(v,y,this._rowCount))}_renderRows(v,y){this._renderer.value&&(v=Math.min(v,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(v,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:v,end:y}),this._onRender.fire({start:v,end:y}),this._isNextRenderRedrawOnly=!0)}resize(v,y){this._rowCount=y,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(v){this._renderer.value=v,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(v){return this._renderDebouncer.addRefreshCallback(v)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(v,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(v,y))):this._renderer.value.handleResize(v,y),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(v,y,k){this._selectionState.start=v,this._selectionState.end=y,this._selectionState.columnSelectMode=k,this._renderer.value?.handleSelectionChanged(v,y,k)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};c.RenderService=b=f([g(2,_.IOptionsService),g(3,S.ICharSizeService),g(4,_.IDecorationService),g(5,_.IBufferService),g(6,S.ICoreBrowserService),g(7,S.IThemeService)],b)},9312:function(p,c,h){var f=this&&this.__decorate||function(R,I,Y,z){var q,B=arguments.length,W=B<3?I:z===null?z=Object.getOwnPropertyDescriptor(I,Y):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(R,I,Y,z);else for(var F=R.length-1;F>=0;F--)(q=R[F])&&(W=(B<3?q(W):B>3?q(I,Y,W):q(I,Y))||W);return B>3&&W&&Object.defineProperty(I,Y,W),W},g=this&&this.__param||function(R,I){return function(Y,z){I(Y,z,R)}};Object.defineProperty(c,"__esModule",{value:!0}),c.SelectionService=void 0;const m=h(9806),S=h(9504),C=h(456),T=h(4725),w=h(8460),_=h(844),b=h(6114),v=h(4841),y=h(511),k=h(2585),M=" ",A=new RegExp(M,"g");let N=c.SelectionService=class extends _.Disposable{constructor(R,I,Y,z,q,B,W,F,P){super(),this._element=R,this._screenElement=I,this._linkifier=Y,this._bufferService=z,this._coreService=q,this._mouseService=B,this._optionsService=W,this._renderService=F,this._coreBrowserService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.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=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((K=>this._handleTrim(K))),this.register(this._bufferService.buffers.onBufferActivate((K=>this._handleBufferActivate(K)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,_.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 R=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!R||!I||R[0]===I[0]&&R[1]===I[1])}get selectionText(){const R=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!R||!I)return"";const Y=this._bufferService.buffer,z=[];if(this._activeSelectionMode===3){if(R[0]===I[0])return"";const q=R[0]<I[0]?R[0]:I[0],B=R[0]<I[0]?I[0]:R[0];for(let W=R[1];W<=I[1];W++){const F=Y.translateBufferLineToString(W,!0,q,B);z.push(F)}}else{const q=R[1]===I[1]?I[0]:void 0;z.push(Y.translateBufferLineToString(R[1],!0,R[0],q));for(let B=R[1]+1;B<=I[1]-1;B++){const W=Y.lines.get(B),F=Y.translateBufferLineToString(B,!0);W?.isWrapped?z[z.length-1]+=F:z.push(F)}if(R[1]!==I[1]){const B=Y.lines.get(I[1]),W=Y.translateBufferLineToString(I[1],!0,0,I[0]);B&&B.isWrapped?z[z.length-1]+=W:z.push(W)}}return z.map((q=>q.replace(A," "))).join(b.isWindows?`\r
|
|
79
|
+
`:`
|
|
80
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(R){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&R&&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(R){const I=this._getMouseBufferCoords(R),Y=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!!(Y&&z&&I)&&this._areCoordsInSelection(I,Y,z)}isCellInSelection(R,I){const Y=this._model.finalSelectionStart,z=this._model.finalSelectionEnd;return!(!Y||!z)&&this._areCoordsInSelection([R,I],Y,z)}_areCoordsInSelection(R,I,Y){return R[1]>I[1]&&R[1]<Y[1]||I[1]===Y[1]&&R[1]===I[1]&&R[0]>=I[0]&&R[0]<Y[0]||I[1]<Y[1]&&R[1]===Y[1]&&R[0]<Y[0]||I[1]<Y[1]&&R[1]===I[1]&&R[0]>=I[0]}_selectWordAtCursor(R,I){const Y=this._linkifier.currentLink?.link?.range;if(Y)return this._model.selectionStart=[Y.start.x-1,Y.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(Y,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const z=this._getMouseBufferCoords(R);return!!z&&(this._selectWordAt(z,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(R,I){this._model.clearSelection(),R=Math.max(R,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,R],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(R){this._model.handleTrim(R)&&this.refresh()}_getMouseBufferCoords(R){const I=this._mouseService.getCoords(R,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(R){let I=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,R,this._screenElement)[1];const Y=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=Y?0:(I>Y&&(I-=Y),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(R){return b.isMac?R.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:R.shiftKey}handleMouseDown(R){if(this._mouseDownTimeStamp=R.timeStamp,(R.button!==2||!this.hasSelection)&&R.button===0){if(!this._enabled){if(!this.shouldForceSelection(R))return;R.stopPropagation()}R.preventDefault(),this._dragScrollAmount=0,this._enabled&&R.shiftKey?this._handleIncrementalClick(R):R.detail===1?this._handleSingleClick(R):R.detail===2?this._handleDoubleClick(R):R.detail===3&&this._handleTripleClick(R),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(R){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(R))}_handleSingleClick(R){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(R)?3:0,this._model.selectionStart=this._getMouseBufferCoords(R),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(R){this._selectWordAtCursor(R,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(R){const I=this._getMouseBufferCoords(R);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(R){return R.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(R){if(R.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(R),!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(R),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const Y=this._bufferService.buffer;if(this._model.selectionEnd[1]<Y.lines.length){const z=Y.lines.get(this._model.selectionEnd[1]);z&&z.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const R=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(R.ydisp+this._bufferService.rows,R.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=R.ydisp),this.refresh()}}_handleMouseUp(R){const I=R.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&R.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const Y=this._mouseService.getCoords(R,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(Y&&Y[0]!==void 0&&Y[1]!==void 0){const z=(0,S.moveToCellSequence)(Y[0]-1,Y[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(z,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const R=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,Y=!(!R||!I||R[0]===I[0]&&R[1]===I[1]);Y?R&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&R[0]===this._oldSelectionStart[0]&&R[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(R,I,Y)):this._oldHasSelection&&this._fireOnSelectionChange(R,I,Y)}_fireOnSelectionChange(R,I,Y){this._oldSelectionStart=R,this._oldSelectionEnd=I,this._oldHasSelection=Y,this._onSelectionChange.fire()}_handleBufferActivate(R){this.clearSelection(),this._trimListener.dispose(),this._trimListener=R.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(R,I){let Y=I;for(let z=0;I>=z;z++){const q=R.loadCell(z,this._workCell).getChars().length;this._workCell.getWidth()===0?Y--:q>1&&I!==z&&(Y+=q-1)}return Y}setSelection(R,I,Y){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[R,I],this._model.selectionStartLength=Y,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(R){this._isClickInSelection(R)||(this._selectWordAtCursor(R,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(R,I,Y=!0,z=!0){if(R[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,B=q.lines.get(R[1]);if(!B)return;const W=q.translateBufferLineToString(R[1],!1);let F=this._convertViewportColToCharacterIndex(B,R[0]),P=F;const K=R[0]-F;let X=0,O=0,H=0,j=0;if(W.charAt(F)===" "){for(;F>0&&W.charAt(F-1)===" ";)F--;for(;P<W.length&&W.charAt(P+1)===" ";)P++}else{let ne=R[0],ie=R[0];B.getWidth(ne)===0&&(X++,ne--),B.getWidth(ie)===2&&(O++,ie++);const ve=B.getString(ie).length;for(ve>1&&(j+=ve-1,P+=ve-1);ne>0&&F>0&&!this._isCharWordSeparator(B.loadCell(ne-1,this._workCell));){B.loadCell(ne-1,this._workCell);const ee=this._workCell.getChars().length;this._workCell.getWidth()===0?(X++,ne--):ee>1&&(H+=ee-1,F-=ee-1),F--,ne--}for(;ie<B.length&&P+1<W.length&&!this._isCharWordSeparator(B.loadCell(ie+1,this._workCell));){B.loadCell(ie+1,this._workCell);const ee=this._workCell.getChars().length;this._workCell.getWidth()===2?(O++,ie++):ee>1&&(j+=ee-1,P+=ee-1),P++,ie++}}P++;let G=F+K-X+H,V=Math.min(this._bufferService.cols,P-F+X+O-H-j);if(I||W.slice(F,P).trim()!==""){if(Y&&G===0&&B.getCodePoint(0)!==32){const ne=q.lines.get(R[1]-1);if(ne&&B.isWrapped&&ne.getCodePoint(this._bufferService.cols-1)!==32){const ie=this._getWordAt([this._bufferService.cols-1,R[1]-1],!1,!0,!1);if(ie){const ve=this._bufferService.cols-ie.start;G-=ve,V+=ve}}}if(z&&G+V===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const ne=q.lines.get(R[1]+1);if(ne?.isWrapped&&ne.getCodePoint(0)!==32){const ie=this._getWordAt([0,R[1]+1],!1,!1,!0);ie&&(V+=ie.length)}}return{start:G,length:V}}}_selectWordAt(R,I){const Y=this._getWordAt(R,I);if(Y){for(;Y.start<0;)Y.start+=this._bufferService.cols,R[1]--;this._model.selectionStart=[Y.start,R[1]],this._model.selectionStartLength=Y.length}}_selectToWordAt(R){const I=this._getWordAt(R,!0);if(I){let Y=R[1];for(;I.start<0;)I.start+=this._bufferService.cols,Y--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,Y++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,Y]}}_isCharWordSeparator(R){return R.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(R.getChars())>=0}_selectLineAt(R){const I=this._bufferService.buffer.getWrappedRangeForLine(R),Y={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(Y,this._bufferService.cols)}};c.SelectionService=N=f([g(3,k.IBufferService),g(4,k.ICoreService),g(5,T.IMouseService),g(6,k.IOptionsService),g(7,T.IRenderService),g(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 f=h(8343);c.ICharSizeService=(0,f.createDecorator)("CharSizeService"),c.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),c.IMouseService=(0,f.createDecorator)("MouseService"),c.IRenderService=(0,f.createDecorator)("RenderService"),c.ISelectionService=(0,f.createDecorator)("SelectionService"),c.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),c.IThemeService=(0,f.createDecorator)("ThemeService"),c.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(p,c,h){var f=this&&this.__decorate||function(N,R,I,Y){var z,q=arguments.length,B=q<3?R:Y===null?Y=Object.getOwnPropertyDescriptor(R,I):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(N,R,I,Y);else for(var W=N.length-1;W>=0;W--)(z=N[W])&&(B=(q<3?z(B):q>3?z(R,I,B):z(R,I))||B);return q>3&&B&&Object.defineProperty(R,I,B),B},g=this&&this.__param||function(N,R){return function(I,Y){R(I,Y,N)}};Object.defineProperty(c,"__esModule",{value:!0}),c.ThemeService=c.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),S=h(8055),C=h(8460),T=h(844),w=h(2585),_=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),v=S.css.toColor("#ffffff"),y=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};c.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],R=[0,95,135,175,215,255];for(let I=0;I<216;I++){const Y=R[I/36%6|0],z=R[I/6%6|0],q=R[I%6];N.push({css:S.channels.toCss(Y,z,q),rgba:S.channels.toRgba(Y,z,q)})}for(let I=0;I<24;I++){const Y=8+10*I;N.push({css:S.channels.toCss(Y,Y,Y),rgba:S.channels.toRgba(Y,Y,Y)})}return N})());let M=c.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:_,background:b,cursor:v,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:c.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(N={}){const R=this._colors;if(R.foreground=A(N.foreground,_),R.background=A(N.background,b),R.cursor=A(N.cursor,v),R.cursorAccent=A(N.cursorAccent,y),R.selectionBackgroundTransparent=A(N.selectionBackground,k),R.selectionBackgroundOpaque=S.color.blend(R.background,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundTransparent=A(N.selectionInactiveBackground,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundOpaque=S.color.blend(R.background,R.selectionInactiveBackgroundTransparent),R.selectionForeground=N.selectionForeground?A(N.selectionForeground,S.NULL_COLOR):void 0,R.selectionForeground===S.NULL_COLOR&&(R.selectionForeground=void 0),S.color.isOpaque(R.selectionBackgroundTransparent)&&(R.selectionBackgroundTransparent=S.color.opacity(R.selectionBackgroundTransparent,.3)),S.color.isOpaque(R.selectionInactiveBackgroundTransparent)&&(R.selectionInactiveBackgroundTransparent=S.color.opacity(R.selectionInactiveBackgroundTransparent,.3)),R.ansi=c.DEFAULT_ANSI_COLORS.slice(),R.ansi[0]=A(N.black,c.DEFAULT_ANSI_COLORS[0]),R.ansi[1]=A(N.red,c.DEFAULT_ANSI_COLORS[1]),R.ansi[2]=A(N.green,c.DEFAULT_ANSI_COLORS[2]),R.ansi[3]=A(N.yellow,c.DEFAULT_ANSI_COLORS[3]),R.ansi[4]=A(N.blue,c.DEFAULT_ANSI_COLORS[4]),R.ansi[5]=A(N.magenta,c.DEFAULT_ANSI_COLORS[5]),R.ansi[6]=A(N.cyan,c.DEFAULT_ANSI_COLORS[6]),R.ansi[7]=A(N.white,c.DEFAULT_ANSI_COLORS[7]),R.ansi[8]=A(N.brightBlack,c.DEFAULT_ANSI_COLORS[8]),R.ansi[9]=A(N.brightRed,c.DEFAULT_ANSI_COLORS[9]),R.ansi[10]=A(N.brightGreen,c.DEFAULT_ANSI_COLORS[10]),R.ansi[11]=A(N.brightYellow,c.DEFAULT_ANSI_COLORS[11]),R.ansi[12]=A(N.brightBlue,c.DEFAULT_ANSI_COLORS[12]),R.ansi[13]=A(N.brightMagenta,c.DEFAULT_ANSI_COLORS[13]),R.ansi[14]=A(N.brightCyan,c.DEFAULT_ANSI_COLORS[14]),R.ansi[15]=A(N.brightWhite,c.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const I=Math.min(R.ansi.length-16,N.extendedAnsi.length);for(let Y=0;Y<I;Y++)R.ansi[Y+16]=A(N.extendedAnsi[Y],c.DEFAULT_ANSI_COLORS[Y+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 R=0;R<this._restoreColors.ansi.length;++R)this._colors.ansi[R]=this._restoreColors.ansi[R]}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 A(N,R){if(N!==void 0)try{return S.css.toColor(N)}catch{}return R}c.ThemeService=M=f([g(0,w.IOptionsService)],M)},6349:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CircularList=void 0;const f=h(8460),g=h(844);class m extends g.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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 _=C;_<this._length-T;_++)this._array[this._getCyclicIndex(_)]=this._array[this._getCyclicIndex(_+T)];this._length-=T,this.onDeleteEmitter.fire({index:C,amount:T})}for(let _=this._length-1;_>=C;_--)this._array[this._getCyclicIndex(_+w.length)]=this._array[this._getCyclicIndex(_)];for(let _=0;_<w.length;_++)this._array[this._getCyclicIndex(C+_)]=w[_];if(w.length&&this.onInsertEmitter.fire({index:C,amount:w.length}),this._length+w.length>this._maxLength){const _=this._length+w.length-this._maxLength;this._startIndex+=_,this._length=this._maxLength,this.onTrimEmitter.fire(_)}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 _=C+T+w-this._length;if(_>0)for(this._length+=_;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let _=0;_<T;_++)this.set(C+_+w,this.get(C+_))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}c.CircularList=m},1439:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.clone=void 0,c.clone=function h(f,g=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const S in f)m[S]=g<=1?f[S]:f[S]&&h(f[S],g-1);return m}},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,f=0,g=0,m=0;var S,C,T,w,_;function b(y){const k=y.toString(16);return k.length<2?"0"+k:k}function v(y,k){return y<k?(k+.05)/(y+.05):(y+.05)/(k+.05)}c.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(k,M,A,N){return N!==void 0?`#${b(k)}${b(M)}${b(A)}${b(N)}`:`#${b(k)}${b(M)}${b(A)}`},y.toRgba=function(k,M,A,N=255){return(k<<24|M<<16|A<<8|N)>>>0},y.toColor=function(k,M,A,N){return{css:y.toCss(k,M,A,N),rgba:y.toRgba(k,M,A,N)}}})(S||(c.channels=S={})),(function(y){function k(M,A){return m=Math.round(255*A),[h,f,g]=_.toChannels(M.rgba),{css:S.toCss(h,f,g,m),rgba:S.toRgba(h,f,g,m)}}y.blend=function(M,A){if(m=(255&A.rgba)/255,m===1)return{css:A.css,rgba:A.rgba};const N=A.rgba>>24&255,R=A.rgba>>16&255,I=A.rgba>>8&255,Y=M.rgba>>24&255,z=M.rgba>>16&255,q=M.rgba>>8&255;return h=Y+Math.round((N-Y)*m),f=z+Math.round((R-z)*m),g=q+Math.round((I-q)*m),{css:S.toCss(h,f,g),rgba:S.toRgba(h,f,g)}},y.isOpaque=function(M){return(255&M.rgba)==255},y.ensureContrastRatio=function(M,A,N){const R=_.ensureContrastRatio(M.rgba,A.rgba,N);if(R)return S.toColor(R>>24&255,R>>16&255,R>>8&255)},y.opaque=function(M){const A=(255|M.rgba)>>>0;return[h,f,g]=_.toChannels(A),{css:S.toCss(h,f,g),rgba:A}},y.opacity=k,y.multiplyOpacity=function(M,A){return m=255&M.rgba,k(M,m*A/255)},y.toColorRGB=function(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}})(C||(c.color=C={})),(function(y){let k,M;try{const A=document.createElement("canvas");A.width=1,A.height=1;const N=A.getContext("2d",{willReadFrequently:!0});N&&(k=N,k.globalCompositeOperation="copy",M=k.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(A){if(A.match(/#[\da-f]{3,8}/i))switch(A.length){case 4:return h=parseInt(A.slice(1,2).repeat(2),16),f=parseInt(A.slice(2,3).repeat(2),16),g=parseInt(A.slice(3,4).repeat(2),16),S.toColor(h,f,g);case 5:return h=parseInt(A.slice(1,2).repeat(2),16),f=parseInt(A.slice(2,3).repeat(2),16),g=parseInt(A.slice(3,4).repeat(2),16),m=parseInt(A.slice(4,5).repeat(2),16),S.toColor(h,f,g,m);case 7:return{css:A,rgba:(parseInt(A.slice(1),16)<<8|255)>>>0};case 9:return{css:A,rgba:parseInt(A.slice(1),16)>>>0}}const N=A.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]),f=parseInt(N[2]),g=parseInt(N[3]),m=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),S.toColor(h,f,g,m);if(!k||!M)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=M,k.fillStyle=A,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[h,f,g,m]=k.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(h,f,g,m),css:A}}})(T||(c.css=T={})),(function(y){function k(M,A,N){const R=M/255,I=A/255,Y=N/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(Y<=.03928?Y/12.92:Math.pow((Y+.055)/1.055,2.4))}y.relativeLuminance=function(M){return k(M>>16&255,M>>8&255,255&M)},y.relativeLuminance2=k})(w||(c.rgb=w={})),(function(y){function k(A,N,R){const I=A>>24&255,Y=A>>16&255,z=A>>8&255;let q=N>>24&255,B=N>>16&255,W=N>>8&255,F=v(w.relativeLuminance2(q,B,W),w.relativeLuminance2(I,Y,z));for(;F<R&&(q>0||B>0||W>0);)q-=Math.max(0,Math.ceil(.1*q)),B-=Math.max(0,Math.ceil(.1*B)),W-=Math.max(0,Math.ceil(.1*W)),F=v(w.relativeLuminance2(q,B,W),w.relativeLuminance2(I,Y,z));return(q<<24|B<<16|W<<8|255)>>>0}function M(A,N,R){const I=A>>24&255,Y=A>>16&255,z=A>>8&255;let q=N>>24&255,B=N>>16&255,W=N>>8&255,F=v(w.relativeLuminance2(q,B,W),w.relativeLuminance2(I,Y,z));for(;F<R&&(q<255||B<255||W<255);)q=Math.min(255,q+Math.ceil(.1*(255-q))),B=Math.min(255,B+Math.ceil(.1*(255-B))),W=Math.min(255,W+Math.ceil(.1*(255-W))),F=v(w.relativeLuminance2(q,B,W),w.relativeLuminance2(I,Y,z));return(q<<24|B<<16|W<<8|255)>>>0}y.blend=function(A,N){if(m=(255&N)/255,m===1)return N;const R=N>>24&255,I=N>>16&255,Y=N>>8&255,z=A>>24&255,q=A>>16&255,B=A>>8&255;return h=z+Math.round((R-z)*m),f=q+Math.round((I-q)*m),g=B+Math.round((Y-B)*m),S.toRgba(h,f,g)},y.ensureContrastRatio=function(A,N,R){const I=w.relativeLuminance(A>>8),Y=w.relativeLuminance(N>>8);if(v(I,Y)<R){if(Y<I){const B=k(A,N,R),W=v(I,w.relativeLuminance(B>>8));if(W<R){const F=M(A,N,R);return W>v(I,w.relativeLuminance(F>>8))?B:F}return B}const z=M(A,N,R),q=v(I,w.relativeLuminance(z>>8));if(q<R){const B=k(A,N,R);return q>v(I,w.relativeLuminance(B>>8))?z:B}return z}},y.reduceLuminance=k,y.increaseLuminance=M,y.toChannels=function(A){return[A>>24&255,A>>16&255,A>>8&255,255&A]}})(_||(c.rgba=_={})),c.toPaddedHex=b,c.contrastRatio=v},8969:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CoreTerminal=void 0;const f=h(844),g=h(2585),m=h(4348),S=h(7866),C=h(744),T=h(7302),w=h(6975),_=h(8460),b=h(1753),v=h(1480),y=h(7994),k=h(9282),M=h(5435),A=h(5981),N=h(2660);let R=!1;class I extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new _.EventEmitter),this._onScroll.event((z=>{this._onScrollApi?.fire(z.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(z){for(const q in z)this.optionsService.options[q]=z[q]}constructor(z){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new _.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new _.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new T.OptionsService(z)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new M.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,_.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,_.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,_.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,_.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((q=>{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((q=>{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 A.WriteBuffer(((q,B)=>this._inputHandler.parse(q,B)))),this.register((0,_.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(z,q){this._writeBuffer.write(z,q)}writeSync(z,q){this._logService.logLevel<=g.LogLevelEnum.WARN&&!R&&(this._logService.warn("writeSync is unreliable and will be removed soon."),R=!0),this._writeBuffer.writeSync(z,q)}input(z,q=!0){this.coreService.triggerDataEvent(z,q)}resize(z,q){isNaN(z)||isNaN(q)||(z=Math.max(z,C.MINIMUM_COLS),q=Math.max(q,C.MINIMUM_ROWS),this._bufferService.resize(z,q))}scroll(z,q=!1){this._bufferService.scroll(z,q)}scrollLines(z,q,B){this._bufferService.scrollLines(z,q,B)}scrollPages(z){this.scrollLines(z*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(z){const q=z-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(z,q){return this._inputHandler.registerEscHandler(z,q)}registerDcsHandler(z,q){return this._inputHandler.registerDcsHandler(z,q)}registerCsiHandler(z,q){return this._inputHandler.registerCsiHandler(z,q)}registerOscHandler(z,q){return this._inputHandler.registerOscHandler(z,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let z=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?z=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(z=!0),z?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const z=[];z.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),z.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const q of z)q.dispose()}))}}}c.CoreTerminal=I},8460:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.runAndSubscribe=c.forwardEvent=c.EventEmitter=void 0,c.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){const g=[];for(let m=0;m<this._listeners.length;m++)g.push(this._listeners[m]);for(let m=0;m<g.length;m++)g[m].call(void 0,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},c.forwardEvent=function(h,f){return h((g=>f.fire(g)))},c.runAndSubscribe=function(h,f){return f(void 0),h((g=>f(g)))}},5435:function(p,c,h){var f=this&&this.__decorate||function(X,O,H,j){var G,V=arguments.length,ne=V<3?O:j===null?j=Object.getOwnPropertyDescriptor(O,H):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(X,O,H,j);else for(var ie=X.length-1;ie>=0;ie--)(G=X[ie])&&(ne=(V<3?G(ne):V>3?G(O,H,ne):G(O,H))||ne);return V>3&&ne&&Object.defineProperty(O,H,ne),ne},g=this&&this.__param||function(X,O){return function(H,j){O(H,j,X)}};Object.defineProperty(c,"__esModule",{value:!0}),c.InputHandler=c.WindowsOptionsReportType=void 0;const m=h(2584),S=h(7116),C=h(2015),T=h(844),w=h(482),_=h(8437),b=h(8460),v=h(643),y=h(511),k=h(3734),M=h(2585),A=h(1480),N=h(6242),R=h(6351),I=h(5941),Y={"(":0,")":1,"*":2,"+":3,"-":1,".":2},z=131072;function q(X,O){if(X>24)return O.setWinLines||!1;switch(X){case 1:return!!O.restoreWin;case 2:return!!O.minimizeWin;case 3:return!!O.setWinPosition;case 4:return!!O.setWinSizePixels;case 5:return!!O.raiseWin;case 6:return!!O.lowerWin;case 7:return!!O.refreshWin;case 8:return!!O.setWinSizeChars;case 9:return!!O.maximizeWin;case 10:return!!O.fullscreenWin;case 11:return!!O.getWinState;case 13:return!!O.getWinPosition;case 14:return!!O.getWinSizePixels;case 15:return!!O.getScreenSizePixels;case 16:return!!O.getCellSizePixels;case 18:return!!O.getWinSizeChars;case 19:return!!O.getScreenSizeChars;case 20:return!!O.getIconTitle;case 21:return!!O.getWinTitle;case 22:return!!O.pushTitle;case 23:return!!O.popTitle;case 24:return!!O.setWinLines}return!1}var B;(function(X){X[X.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",X[X.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(c.WindowsOptionsReportType=B={}));let W=0;class F extends T.Disposable{getAttrData(){return this._curAttrData}constructor(O,H,j,G,V,ne,ie,ve,ee=new C.EscapeSequenceParser){super(),this._bufferService=O,this._charsetService=H,this._coreService=j,this._logService=G,this._optionsService=V,this._oscLinkService=ne,this._coreMouseService=ie,this._unicodeService=ve,this._parser=ee,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.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(($=>this._activeBuffer=$.activeBuffer))),this._parser.setCsiHandlerFallback((($,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString($),params:ae.toArray()})})),this._parser.setEscHandlerFallback(($=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString($)})})),this._parser.setExecuteHandlerFallback(($=>{this._logService.debug("Unknown EXECUTE code: ",{code:$})})),this._parser.setOscHandlerFallback((($,ae,ge)=>{this._logService.debug("Unknown OSC code: ",{identifier:$,action:ae,data:ge})})),this._parser.setDcsHandlerFallback((($,ae,ge)=>{ae==="HOOK"&&(ge=ge.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString($),action:ae,payload:ge})})),this._parser.setPrintHandler((($,ae,ge)=>this.print($,ae,ge))),this._parser.registerCsiHandler({final:"@"},($=>this.insertChars($))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},($=>this.scrollLeft($))),this._parser.registerCsiHandler({final:"A"},($=>this.cursorUp($))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},($=>this.scrollRight($))),this._parser.registerCsiHandler({final:"B"},($=>this.cursorDown($))),this._parser.registerCsiHandler({final:"C"},($=>this.cursorForward($))),this._parser.registerCsiHandler({final:"D"},($=>this.cursorBackward($))),this._parser.registerCsiHandler({final:"E"},($=>this.cursorNextLine($))),this._parser.registerCsiHandler({final:"F"},($=>this.cursorPrecedingLine($))),this._parser.registerCsiHandler({final:"G"},($=>this.cursorCharAbsolute($))),this._parser.registerCsiHandler({final:"H"},($=>this.cursorPosition($))),this._parser.registerCsiHandler({final:"I"},($=>this.cursorForwardTab($))),this._parser.registerCsiHandler({final:"J"},($=>this.eraseInDisplay($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},($=>this.eraseInDisplay($,!0))),this._parser.registerCsiHandler({final:"K"},($=>this.eraseInLine($,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},($=>this.eraseInLine($,!0))),this._parser.registerCsiHandler({final:"L"},($=>this.insertLines($))),this._parser.registerCsiHandler({final:"M"},($=>this.deleteLines($))),this._parser.registerCsiHandler({final:"P"},($=>this.deleteChars($))),this._parser.registerCsiHandler({final:"S"},($=>this.scrollUp($))),this._parser.registerCsiHandler({final:"T"},($=>this.scrollDown($))),this._parser.registerCsiHandler({final:"X"},($=>this.eraseChars($))),this._parser.registerCsiHandler({final:"Z"},($=>this.cursorBackwardTab($))),this._parser.registerCsiHandler({final:"`"},($=>this.charPosAbsolute($))),this._parser.registerCsiHandler({final:"a"},($=>this.hPositionRelative($))),this._parser.registerCsiHandler({final:"b"},($=>this.repeatPrecedingCharacter($))),this._parser.registerCsiHandler({final:"c"},($=>this.sendDeviceAttributesPrimary($))),this._parser.registerCsiHandler({prefix:">",final:"c"},($=>this.sendDeviceAttributesSecondary($))),this._parser.registerCsiHandler({final:"d"},($=>this.linePosAbsolute($))),this._parser.registerCsiHandler({final:"e"},($=>this.vPositionRelative($))),this._parser.registerCsiHandler({final:"f"},($=>this.hVPosition($))),this._parser.registerCsiHandler({final:"g"},($=>this.tabClear($))),this._parser.registerCsiHandler({final:"h"},($=>this.setMode($))),this._parser.registerCsiHandler({prefix:"?",final:"h"},($=>this.setModePrivate($))),this._parser.registerCsiHandler({final:"l"},($=>this.resetMode($))),this._parser.registerCsiHandler({prefix:"?",final:"l"},($=>this.resetModePrivate($))),this._parser.registerCsiHandler({final:"m"},($=>this.charAttributes($))),this._parser.registerCsiHandler({final:"n"},($=>this.deviceStatus($))),this._parser.registerCsiHandler({prefix:"?",final:"n"},($=>this.deviceStatusPrivate($))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},($=>this.softReset($))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},($=>this.setCursorStyle($))),this._parser.registerCsiHandler({final:"r"},($=>this.setScrollRegion($))),this._parser.registerCsiHandler({final:"s"},($=>this.saveCursor($))),this._parser.registerCsiHandler({final:"t"},($=>this.windowOptions($))),this._parser.registerCsiHandler({final:"u"},($=>this.restoreCursor($))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},($=>this.insertColumns($))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},($=>this.deleteColumns($))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},($=>this.selectProtected($))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},($=>this.requestMode($,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},($=>this.requestMode($,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new N.OscHandler(($=>(this.setTitle($),this.setIconName($),!0)))),this._parser.registerOscHandler(1,new N.OscHandler(($=>this.setIconName($)))),this._parser.registerOscHandler(2,new N.OscHandler(($=>this.setTitle($)))),this._parser.registerOscHandler(4,new N.OscHandler(($=>this.setOrReportIndexedColor($)))),this._parser.registerOscHandler(8,new N.OscHandler(($=>this.setHyperlink($)))),this._parser.registerOscHandler(10,new N.OscHandler(($=>this.setOrReportFgColor($)))),this._parser.registerOscHandler(11,new N.OscHandler(($=>this.setOrReportBgColor($)))),this._parser.registerOscHandler(12,new N.OscHandler(($=>this.setOrReportCursorColor($)))),this._parser.registerOscHandler(104,new N.OscHandler(($=>this.restoreIndexedColor($)))),this._parser.registerOscHandler(110,new N.OscHandler(($=>this.restoreFgColor($)))),this._parser.registerOscHandler(111,new N.OscHandler(($=>this.restoreBgColor($)))),this._parser.registerOscHandler(112,new N.OscHandler(($=>this.restoreCursorColor($)))),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 $ in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:$},(()=>this.selectCharset("("+$))),this._parser.registerEscHandler({intermediates:")",final:$},(()=>this.selectCharset(")"+$))),this._parser.registerEscHandler({intermediates:"*",final:$},(()=>this.selectCharset("*"+$))),this._parser.registerEscHandler({intermediates:"+",final:$},(()=>this.selectCharset("+"+$))),this._parser.registerEscHandler({intermediates:"-",final:$},(()=>this.selectCharset("-"+$))),this._parser.registerEscHandler({intermediates:".",final:$},(()=>this.selectCharset("."+$))),this._parser.registerEscHandler({intermediates:"/",final:$},(()=>this.selectCharset("/"+$)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler(($=>(this._logService.error("Parsing error: ",$),$))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new R.DcsHandler((($,ae)=>this.requestStatusString($,ae))))}_preserveStack(O,H,j,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=O,this._parseStack.cursorStartY=H,this._parseStack.decodedLength=j,this._parseStack.position=G}_logSlowResolvingAsync(O){this._logService.logLevel<=M.LogLevelEnum.WARN&&Promise.race([O,new Promise(((H,j)=>setTimeout((()=>j("#SLOW_TIMEOUT")),5e3)))]).catch((H=>{if(H!=="#SLOW_TIMEOUT")throw H;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(O,H){let j,G=this._activeBuffer.x,V=this._activeBuffer.y,ne=0;const ie=this._parseStack.paused;if(ie){if(j=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,H))return this._logSlowResolvingAsync(j),j;G=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,O.length>z&&(ne=this._parseStack.position+z)}if(this._logService.logLevel<=M.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof O=="string"?` "${O}"`:` "${Array.prototype.map.call(O,($=>String.fromCharCode($))).join("")}"`),typeof O=="string"?O.split("").map(($=>$.charCodeAt(0))):O),this._parseBuffer.length<O.length&&this._parseBuffer.length<z&&(this._parseBuffer=new Uint32Array(Math.min(O.length,z))),ie||this._dirtyRowTracker.clearRange(),O.length>z)for(let $=ne;$<O.length;$+=z){const ae=$+z<O.length?$+z:O.length,ge=typeof O=="string"?this._stringDecoder.decode(O.substring($,ae),this._parseBuffer):this._utf8Decoder.decode(O.subarray($,ae),this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,ge))return this._preserveStack(G,V,ge,$),this._logSlowResolvingAsync(j),j}else if(!ie){const $=typeof O=="string"?this._stringDecoder.decode(O,this._parseBuffer):this._utf8Decoder.decode(O,this._parseBuffer);if(j=this._parser.parse(this._parseBuffer,$))return this._preserveStack(G,V,$,0),this._logSlowResolvingAsync(j),j}this._activeBuffer.x===G&&this._activeBuffer.y===V||this._onCursorMove.fire();const ve=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),ee=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);ee<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(ee,this._bufferService.rows-1),Math.min(ve,this._bufferService.rows-1))}print(O,H,j){let G,V;const ne=this._charsetService.charset,ie=this._optionsService.rawOptions.screenReaderMode,ve=this._bufferService.cols,ee=this._coreService.decPrivateModes.wraparound,$=this._coreService.modes.insertMode,ae=this._curAttrData;let ge=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&j-H>0&&ge.getWidth(this._activeBuffer.x-1)===2&&ge.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let we=this._parser.precedingJoinState;for(let de=H;de<j;++de){if(G=O[de],G<127&&ne){const qe=ne[String.fromCharCode(G)];qe&&(G=qe.charCodeAt(0))}const Ce=this._unicodeService.charProperties(G,we);V=A.UnicodeService.extractWidth(Ce);const Le=A.UnicodeService.extractShouldJoin(Ce),Me=Le?A.UnicodeService.extractWidth(we):0;if(we=Ce,ie&&this._onA11yChar.fire((0,w.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-Me>ve){if(ee){const qe=ge;let ke=this._activeBuffer.x-Me;for(this._activeBuffer.x=Me,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),ge=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Me>0&&ge instanceof _.BufferLine&&ge.copyCellsFrom(qe,ke,0,Me,!1);ke<ve;)qe.setCellFromCodepoint(ke++,0,1,ae)}else if(this._activeBuffer.x=ve-1,V===2)continue}if(Le&&this._activeBuffer.x){const qe=ge.getWidth(this._activeBuffer.x-1)?1:2;ge.addCodepointToCell(this._activeBuffer.x-qe,G,V);for(let ke=V-Me;--ke>=0;)ge.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if($&&(ge.insertCells(this._activeBuffer.x,V-Me,this._activeBuffer.getNullCell(ae)),ge.getWidth(ve-1)===2&&ge.setCellFromCodepoint(ve-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,ae)),ge.setCellFromCodepoint(this._activeBuffer.x++,G,V,ae),V>0)for(;--V;)ge.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=we,this._activeBuffer.x<ve&&j-H>0&&ge.getWidth(this._activeBuffer.x)===0&&!ge.hasContent(this._activeBuffer.x)&&ge.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(O,H){return O.final!=="t"||O.prefix||O.intermediates?this._parser.registerCsiHandler(O,H):this._parser.registerCsiHandler(O,(j=>!q(j.params[0],this._optionsService.rawOptions.windowOptions)||H(j)))}registerDcsHandler(O,H){return this._parser.registerDcsHandler(O,new R.DcsHandler(H))}registerEscHandler(O,H){return this._parser.registerEscHandler(O,H)}registerOscHandler(O,H){return this._parser.registerOscHandler(O,new N.OscHandler(H))}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 O=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);O.hasWidth(this._activeBuffer.x)&&!O.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const O=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-O),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(O=this._bufferService.cols-1){this._activeBuffer.x=Math.min(O,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(O,H){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=O,this._activeBuffer.y=this._activeBuffer.scrollTop+H):(this._activeBuffer.x=O,this._activeBuffer.y=H),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(O,H){this._restrictCursor(),this._setCursor(this._activeBuffer.x+O,this._activeBuffer.y+H)}cursorUp(O){const H=this._activeBuffer.y-this._activeBuffer.scrollTop;return H>=0?this._moveCursor(0,-Math.min(H,O.params[0]||1)):this._moveCursor(0,-(O.params[0]||1)),!0}cursorDown(O){const H=this._activeBuffer.scrollBottom-this._activeBuffer.y;return H>=0?this._moveCursor(0,Math.min(H,O.params[0]||1)):this._moveCursor(0,O.params[0]||1),!0}cursorForward(O){return this._moveCursor(O.params[0]||1,0),!0}cursorBackward(O){return this._moveCursor(-(O.params[0]||1),0),!0}cursorNextLine(O){return this.cursorDown(O),this._activeBuffer.x=0,!0}cursorPrecedingLine(O){return this.cursorUp(O),this._activeBuffer.x=0,!0}cursorCharAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(O){return this._setCursor(O.length>=2?(O.params[1]||1)-1:0,(O.params[0]||1)-1),!0}charPosAbsolute(O){return this._setCursor((O.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(O){return this._moveCursor(O.params[0]||1,0),!0}linePosAbsolute(O){return this._setCursor(this._activeBuffer.x,(O.params[0]||1)-1),!0}vPositionRelative(O){return this._moveCursor(0,O.params[0]||1),!0}hVPosition(O){return this.cursorPosition(O),!0}tabClear(O){const H=O.params[0];return H===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:H===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=O.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(O){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=O.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(O){const H=O.params[0];return H===1&&(this._curAttrData.bg|=536870912),H!==2&&H!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(O,H,j,G=!1,V=!1){const ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);ne.replaceCells(H,j,this._activeBuffer.getNullCell(this._eraseAttrData()),V),G&&(ne.isWrapped=!1)}_resetBufferLine(O,H=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+O);j&&(j.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),H),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+O),j.isWrapped=!1)}eraseInDisplay(O,H=!1){let j;switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);j<this._bufferService.rows;j++)this._resetBufferLine(j,H);this._dirtyRowTracker.markDirty(j);break;case 1:for(j=this._activeBuffer.y,this._dirtyRowTracker.markDirty(j),this._eraseInBufferLine(j,0,this._activeBuffer.x+1,!0,H),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(j+1).isWrapped=!1);j--;)this._resetBufferLine(j,H);this._dirtyRowTracker.markDirty(0);break;case 2:for(j=this._bufferService.rows,this._dirtyRowTracker.markDirty(j-1);j--;)this._resetBufferLine(j,H);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(O,H=!1){switch(this._restrictCursor(this._bufferService.cols),O.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,H);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,H)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(O){this._restrictCursor();let H=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;H--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(j,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(O){this._restrictCursor();let H=O.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;H--;)this._activeBuffer.lines.splice(j,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(O){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.insertCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(O){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.deleteCells(this._activeBuffer.x,O.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(O){let H=O.params[0]||1;for(;H--;)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(O){let H=O.params[0]||1;for(;H--;)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(_.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.deleteCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.insertCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(O){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=O.params[0]||1;for(let j=this._activeBuffer.scrollTop;j<=this._activeBuffer.scrollBottom;++j){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);G.deleteCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(O){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(O.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(O){const H=this._parser.precedingJoinState;if(!H)return!0;const j=O.params[0]||1,G=A.UnicodeService.extractWidth(H),V=this._activeBuffer.x-G,ne=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),ie=new Uint32Array(ne.length*j);let ve=0;for(let $=0;$<ne.length;){const ae=ne.codePointAt($)||0;ie[ve++]=ae,$+=ae>65535?2:1}let ee=ve;for(let $=1;$<j;++$)ie.copyWithin(ee,0,ve),ee+=ve;return this.print(ie,0,ee),!0}sendDeviceAttributesPrimary(O){return O.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(O){return O.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(O.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(O){return(this._optionsService.rawOptions.termName+"").indexOf(O)===0}setMode(O){for(let H=0;H<O.length;H++)switch(O.params[H]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(O){for(let H=0;H<O.length;H++)switch(O.params[H]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(O){for(let H=0;H<O.length;H++)switch(O.params[H]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(O){for(let H=0;H<O.length;H++)switch(O.params[H]){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(),O.params[H]===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(O,H){const j=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:V}=this._coreMouseService,ne=this._coreService,{buffers:ie,cols:ve}=this._bufferService,{active:ee,alt:$}=ie,ae=this._optionsService.rawOptions,ge=Le=>Le?1:2,we=O.params[0];return de=we,Ce=H?we===2?4:we===4?ge(ne.modes.insertMode):we===12?3:we===20?ge(ae.convertEol):0:we===1?ge(j.applicationCursorKeys):we===3?ae.windowOptions.setWinLines?ve===80?2:ve===132?1:0:0:we===6?ge(j.origin):we===7?ge(j.wraparound):we===8?3:we===9?ge(G==="X10"):we===12?ge(ae.cursorBlink):we===25?ge(!ne.isCursorHidden):we===45?ge(j.reverseWraparound):we===66?ge(j.applicationKeypad):we===67?4:we===1e3?ge(G==="VT200"):we===1002?ge(G==="DRAG"):we===1003?ge(G==="ANY"):we===1004?ge(j.sendFocus):we===1005?4:we===1006?ge(V==="SGR"):we===1015?4:we===1016?ge(V==="SGR_PIXELS"):we===1048?1:we===47||we===1047||we===1049?ge(ee===$):we===2004?ge(j.bracketedPasteMode):0,ne.triggerDataEvent(`${m.C0.ESC}[${H?"":"?"}${de};${Ce}$y`),!0;var de,Ce}_updateAttrColor(O,H,j,G,V){return H===2?(O|=50331648,O&=-16777216,O|=k.AttributeData.fromColorRGB([j,G,V])):H===5&&(O&=-50331904,O|=33554432|255&j),O}_extractColor(O,H,j){const G=[0,0,-1,0,0,0];let V=0,ne=0;do{if(G[ne+V]=O.params[H+ne],O.hasSubParams(H+ne)){const ie=O.getSubParams(H+ne);let ve=0;do G[1]===5&&(V=1),G[ne+ve+1+V]=ie[ve];while(++ve<ie.length&&ve+ne+1+V<G.length);break}if(G[1]===5&&ne+V>=2||G[1]===2&&ne+V>=5)break;G[1]&&(V=1)}while(++ne+H<O.length&&ne+V<G.length);for(let ie=2;ie<G.length;++ie)G[ie]===-1&&(G[ie]=0);switch(G[0]){case 38:j.fg=this._updateAttrColor(j.fg,G[1],G[3],G[4],G[5]);break;case 48:j.bg=this._updateAttrColor(j.bg,G[1],G[3],G[4],G[5]);break;case 58:j.extended=j.extended.clone(),j.extended.underlineColor=this._updateAttrColor(j.extended.underlineColor,G[1],G[3],G[4],G[5])}return ne}_processUnderline(O,H){H.extended=H.extended.clone(),(!~O||O>5)&&(O=1),H.extended.underlineStyle=O,H.fg|=268435456,O===0&&(H.fg&=-268435457),H.updateExtended()}_processSGR0(O){O.fg=_.DEFAULT_ATTR_DATA.fg,O.bg=_.DEFAULT_ATTR_DATA.bg,O.extended=O.extended.clone(),O.extended.underlineStyle=0,O.extended.underlineColor&=-67108864,O.updateExtended()}charAttributes(O){if(O.length===1&&O.params[0]===0)return this._processSGR0(this._curAttrData),!0;const H=O.length;let j;const G=this._curAttrData;for(let V=0;V<H;V++)j=O.params[V],j>=30&&j<=37?(G.fg&=-50331904,G.fg|=16777216|j-30):j>=40&&j<=47?(G.bg&=-50331904,G.bg|=16777216|j-40):j>=90&&j<=97?(G.fg&=-50331904,G.fg|=16777224|j-90):j>=100&&j<=107?(G.bg&=-50331904,G.bg|=16777224|j-100):j===0?this._processSGR0(G):j===1?G.fg|=134217728:j===3?G.bg|=67108864:j===4?(G.fg|=268435456,this._processUnderline(O.hasSubParams(V)?O.getSubParams(V)[0]:1,G)):j===5?G.fg|=536870912:j===7?G.fg|=67108864:j===8?G.fg|=1073741824:j===9?G.fg|=2147483648:j===2?G.bg|=134217728:j===21?this._processUnderline(2,G):j===22?(G.fg&=-134217729,G.bg&=-134217729):j===23?G.bg&=-67108865:j===24?(G.fg&=-268435457,this._processUnderline(0,G)):j===25?G.fg&=-536870913:j===27?G.fg&=-67108865:j===28?G.fg&=-1073741825:j===29?G.fg&=2147483647:j===39?(G.fg&=-67108864,G.fg|=16777215&_.DEFAULT_ATTR_DATA.fg):j===49?(G.bg&=-67108864,G.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):j===38||j===48||j===58?V+=this._extractColor(O,V,G):j===53?G.bg|=1073741824:j===55?G.bg&=-1073741825:j===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):j===100?(G.fg&=-67108864,G.fg|=16777215&_.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",j);return!0}deviceStatus(O){switch(O.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const H=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${H};${j}R`)}return!0}deviceStatusPrivate(O){if(O.params[0]===6){const H=this._activeBuffer.y+1,j=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${H};${j}R`)}return!0}softReset(O){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_.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(O){const H=O.params[0]||1;switch(H){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 j=H%2==1;return this._optionsService.options.cursorBlink=j,!0}setScrollRegion(O){const H=O.params[0]||1;let j;return(O.length<2||(j=O.params[1])>this._bufferService.rows||j===0)&&(j=this._bufferService.rows),j>H&&(this._activeBuffer.scrollTop=H-1,this._activeBuffer.scrollBottom=j-1,this._setCursor(0,0)),!0}windowOptions(O){if(!q(O.params[0],this._optionsService.rawOptions.windowOptions))return!0;const H=O.length>1?O.params[1]:0;switch(O.params[0]){case 14:H!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:H!==0&&H!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),H!==0&&H!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:H!==0&&H!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),H!==0&&H!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(O){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(O){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(O){return this._windowTitle=O,this._onTitleChange.fire(O),!0}setIconName(O){return this._iconName=O,!0}setOrReportIndexedColor(O){const H=[],j=O.split(";");for(;j.length>1;){const G=j.shift(),V=j.shift();if(/^\d+$/.exec(G)){const ne=parseInt(G);if(K(ne))if(V==="?")H.push({type:0,index:ne});else{const ie=(0,I.parseColor)(V);ie&&H.push({type:1,index:ne,color:ie})}}}return H.length&&this._onColor.fire(H),!0}setHyperlink(O){const H=O.split(";");return!(H.length<2)&&(H[1]?this._createHyperlink(H[0],H[1]):!H[0]&&this._finishHyperlink())}_createHyperlink(O,H){this._getCurrentLinkId()&&this._finishHyperlink();const j=O.split(":");let G;const V=j.findIndex((ne=>ne.startsWith("id=")));return V!==-1&&(G=j[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:H}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(O,H){const j=O.split(";");for(let G=0;G<j.length&&!(H>=this._specialColors.length);++G,++H)if(j[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[H]}]);else{const V=(0,I.parseColor)(j[G]);V&&this._onColor.fire([{type:1,index:this._specialColors[H],color:V}])}return!0}setOrReportFgColor(O){return this._setOrReportSpecialColor(O,0)}setOrReportBgColor(O){return this._setOrReportSpecialColor(O,1)}setOrReportCursorColor(O){return this._setOrReportSpecialColor(O,2)}restoreIndexedColor(O){if(!O)return this._onColor.fire([{type:2}]),!0;const H=[],j=O.split(";");for(let G=0;G<j.length;++G)if(/^\d+$/.exec(j[G])){const V=parseInt(j[G]);K(V)&&H.push({type:2,index:V})}return H.length&&this._onColor.fire(H),!0}restoreFgColor(O){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(O){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(O){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),!0}selectCharset(O){return O.length!==2?(this.selectDefaultCharset(),!0):(O[0]==="/"||this._charsetService.setgCharset(Y[O[0]],S.CHARSETS[O[1]]||S.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const O=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,O,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=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(O){return this._charsetService.setgLevel(O),!0}screenAlignmentPattern(){const O=new y.CellData;O.content=4194373,O.fg=this._curAttrData.fg,O.bg=this._curAttrData.bg,this._setCursor(0,0);for(let H=0;H<this._bufferService.rows;++H){const j=this._activeBuffer.ybase+this._activeBuffer.y+H,G=this._activeBuffer.lines.get(j);G&&(G.fill(O),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(O,H){const j=this._bufferService.buffer,G=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${V}${m.C0.ESC}\\`),!0))(O==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:O==='"p'?'P1$r61;1"p':O==="r"?`P1$r${j.scrollTop+1};${j.scrollBottom+1}r`:O==="m"?"P1$r0m":O===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(O,H){this._dirtyRowTracker.markRangeDirty(O,H)}}c.InputHandler=F;let P=class{constructor(X){this._bufferService=X,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(X){X<this.start?this.start=X:X>this.end&&(this.end=X)}markRangeDirty(X,O){X>O&&(W=X,X=O,O=W),X<this.start&&(this.start=X),O>this.end&&(this.end=O)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(X){return 0<=X&&X<256}P=f([g(0,M.IBufferService)],P)},844:(p,c)=>{function h(f){for(const g of f)g.dispose();f.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 f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const g=this._disposables.indexOf(f);g!==-1&&this._disposables.splice(g,1)}},c.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){this._isDisposed||f===this._value||(this._value?.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},c.toDisposable=function(f){return{dispose:f}},c.disposeArray=h,c.getDisposeArrayDisposable=function(f){return{dispose:()=>h(f)}}},1505:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FourKeyMap=c.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(g,m,S){this._data[g]||(this._data[g]={}),this._data[g][m]=S}get(g,m){return this._data[g]?this._data[g][m]:void 0}clear(){this._data={}}}c.TwoKeyMap=h,c.FourKeyMap=class{constructor(){this._data=new h}set(f,g,m,S,C){this._data.get(f,g)||this._data.set(f,g,new h),this._data.get(f,g).set(m,S,C)}get(f,g,m,S){return this._data.get(f,g)?.get(m,S)}clear(){this._data.clear()}}},6114:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.isChromeOS=c.isLinux=c.isWindows=c.isIphone=c.isIpad=c.isMac=c.getSafariVersion=c.isSafari=c.isLegacyEdge=c.isFirefox=c.isNode=void 0,c.isNode=typeof process<"u"&&"title"in process;const h=c.isNode?"node":navigator.userAgent,f=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 g=h.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},c.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),c.isIpad=f==="iPad",c.isIphone=f==="iPhone",c.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),c.isLinux=f.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(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(h=this._search(this._getKey(f)),this._array.splice(h,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const g=this._getKey(f);if(g===void 0||(h=this._search(g),h===-1)||this._getKey(this._array[h])!==g)return!1;do if(this._array[h]===f)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===g);return!1}*getKeyIterator(f){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===f)}forEachByKey(f,g){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do g(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===f)}values(){return[...this._array].values()}_search(f){let g=0,m=this._array.length-1;for(;m>=g;){let S=g+m>>1;const C=this._getKey(this._array[S]);if(C>f)m=S-1;else{if(!(C<f)){for(;S>0&&this._getKey(this._array[S-1])===f;)S--;return S}g=S+1}}return g}}},7226:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DebouncedIdleTask=c.IdleTaskQueue=c.PriorityTaskQueue=void 0;const f=h(6114);class g{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,_=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 _-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(_-T))}ms`),void this._start();_=b}this.clear()}}class m extends g{_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=m,c.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:m,c.DebouncedIdleTask=class{constructor(){this._queue=new c.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.updateWindowsModeWrappedState=void 0;const f=h(643);c.updateWindowsModeWrappedState=function(g){const m=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),S=m?.get(g.cols-1),C=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);C&&S&&(C.isWrapped=S[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&S[f.CHAR_DATA_CODE_INDEX]!==f.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 f}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}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 f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,S=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=S}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}c.ExtendedAttrs=f},9092:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Buffer=c.MAX_BUFFER_SIZE=void 0;const f=h(6349),g=h(7226),m=h(3734),S=h(8437),C=h(4634),T=h(511),w=h(643),_=h(4863),b=h(7116);c.MAX_BUFFER_SIZE=4294967295,c.Buffer=class{constructor(v,y,k){this._hasScrollback=v,this._optionsService=y,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,y){return new S.BufferLine(this._bufferService.cols,this.getNullCell(v),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const y=v+this._optionsService.rawOptions.scrollback;return y>c.MAX_BUFFER_SIZE?c.MAX_BUFFER_SIZE:y}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=S.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let M=0;const A=this._getCorrectBufferLength(y);if(A>this.lines.maxLength&&(this.lines.maxLength=A),this.lines.length>0){if(this._cols<v)for(let R=0;R<this.lines.length;R++)M+=+this.lines.get(R).resize(v,k);let N=0;if(this._rows<y)for(let R=this._rows;R<y;R++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(v,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+N+1?(this.ybase--,N++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(v,k)));else for(let R=this._rows;R>y;R--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(A<this.lines.maxLength){const R=this.lines.length-A;R>0&&(this.lines.trimStart(R),this.ybase=Math.max(this.ybase-R,0),this.ydisp=Math.max(this.ydisp-R,0),this.savedY=Math.max(this.savedY-R,0)),this.lines.maxLength=A}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,y-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(v,y),this._cols>v))for(let N=0;N<this.lines.length;N++)M+=+this.lines.get(N).resize(v,k);this._cols=v,this._rows=y,this._memoryCleanupQueue.clear(),M>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,y){this._cols!==v&&(v>this._cols?this._reflowLarger(v,y):this._reflowSmaller(v,y))}_reflowLarger(v,y){const k=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const M=(0,C.reflowLargerCreateNewLayout)(this.lines,k);(0,C.reflowLargerApplyNewLayout)(this.lines,M.layout),this._reflowLargerAdjustViewport(v,y,M.countRemoved)}}_reflowLargerAdjustViewport(v,y,k){const M=this.getNullCell(S.DEFAULT_ATTR_DATA);let A=k;for(;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new S.BufferLine(v,M))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(v,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),M=[];let A=0;for(let N=this.lines.length-1;N>=0;N--){let R=this.lines.get(N);if(!R||!R.isWrapped&&R.getTrimmedLength()<=v)continue;const I=[R];for(;R.isWrapped&&N>0;)R=this.lines.get(--N),I.unshift(R);const Y=this.ybase+this.y;if(Y>=N&&Y<N+I.length)continue;const z=I[I.length-1].getTrimmedLength(),q=(0,C.reflowSmallerGetNewLineLengths)(I,this._cols,v),B=q.length-I.length;let W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const F=[];for(let j=0;j<B;j++){const G=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);F.push(G)}F.length>0&&(M.push({start:N+I.length+A,newLines:F}),A+=F.length),I.push(...F);let P=q.length-1,K=q[P];K===0&&(P--,K=q[P]);let X=I.length-B-1,O=z;for(;X>=0;){const j=Math.min(O,K);if(I[P]===void 0)break;if(I[P].copyCellsFrom(I[X],O-j,K-j,j,!0),K-=j,K===0&&(P--,K=q[P]),O-=j,O===0){X--;const G=Math.max(X,0);O=(0,C.getWrappedLineTrimmedLength)(I,G,this._cols)}}for(let j=0;j<I.length;j++)q[j]<v&&I[j].setCell(q[j],k);let H=B-W;for(;H-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+A)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+B,this.ybase+y-1)}if(M.length>0){const N=[],R=[];for(let P=0;P<this.lines.length;P++)R.push(this.lines.get(P));const I=this.lines.length;let Y=I-1,z=0,q=M[z];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+A);let B=0;for(let P=Math.min(this.lines.maxLength-1,I+A-1);P>=0;P--)if(q&&q.start>Y+B){for(let K=q.newLines.length-1;K>=0;K--)this.lines.set(P--,q.newLines[K]);P++,N.push({index:Y+1,amount:q.newLines.length}),B+=q.newLines.length,q=M[++z]}else this.lines.set(P,R[Y--]);let W=0;for(let P=N.length-1;P>=0;P--)N[P].index+=W,this.lines.onInsertEmitter.fire(N[P]),W+=N[P].amount;const F=Math.max(0,I+A-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(v,y,k=0,M){const A=this.lines.get(v);return A?A.translateToString(y,k,M):""}getWrappedRangeForLine(v){let y=v,k=v;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:y,last:k}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].line===v&&(this.markers[y].dispose(),this.markers.splice(y--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const y=new _.Marker(v);return this.markers.push(y),y.register(this.lines.onTrim((k=>{y.line-=k,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((k=>{y.line>=k.index&&(y.line+=k.amount)}))),y.register(this.lines.onDelete((k=>{y.line>=k.index&&y.line<k.index+k.amount&&y.dispose(),y.line>k.index&&(y.line-=k.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLine=c.DEFAULT_ATTR_DATA=void 0;const f=h(3734),g=h(511),m=h(643),S=h(482);c.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let C=0;class T{constructor(_,b,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*_);const y=b||g.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let k=0;k<_;++k)this.setCell(k,y);this.length=_}get(_){const b=this._data[3*_+0],v=2097151&b;return[this._data[3*_+1],2097152&b?this._combined[_]:v?(0,S.stringFromCodePoint)(v):"",b>>22,2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):v]}set(_,b){this._data[3*_+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[_]=b[1],this._data[3*_+0]=2097152|_|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*_+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(_){return this._data[3*_+0]>>22}hasWidth(_){return 12582912&this._data[3*_+0]}getFg(_){return this._data[3*_+1]}getBg(_){return this._data[3*_+2]}hasContent(_){return 4194303&this._data[3*_+0]}getCodePoint(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):2097151&b}isCombined(_){return 2097152&this._data[3*_+0]}getString(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(_){return 536870912&this._data[3*_+2]}loadCell(_,b){return C=3*_,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[_]),268435456&b.bg&&(b.extended=this._extendedAttrs[_]),b}setCell(_,b){2097152&b.content&&(this._combined[_]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[_]=b.extended),this._data[3*_+0]=b.content,this._data[3*_+1]=b.fg,this._data[3*_+2]=b.bg}setCellFromCodepoint(_,b,v,y){268435456&y.bg&&(this._extendedAttrs[_]=y.extended),this._data[3*_+0]=b|v<<22,this._data[3*_+1]=y.fg,this._data[3*_+2]=y.bg}addCodepointToCell(_,b,v){let y=this._data[3*_+0];2097152&y?this._combined[_]+=(0,S.stringFromCodePoint)(b):2097151&y?(this._combined[_]=(0,S.stringFromCodePoint)(2097151&y)+(0,S.stringFromCodePoint)(b),y&=-2097152,y|=2097152):y=b|4194304,v&&(y&=-12582913,y|=v<<22),this._data[3*_+0]=y}insertCells(_,b,v){if((_%=this.length)&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length-_){const y=new g.CellData;for(let k=this.length-_-b-1;k>=0;--k)this.setCell(_+b+k,this.loadCell(_+k,y));for(let k=0;k<b;++k)this.setCell(_+k,v)}else for(let y=_;y<this.length;++y)this.setCell(y,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(_,b,v){if(_%=this.length,b<this.length-_){const y=new g.CellData;for(let k=0;k<this.length-_-b;++k)this.setCell(_+k,this.loadCell(_+b+k,y));for(let k=this.length-b;k<this.length;++k)this.setCell(k,v)}else for(let y=_;y<this.length;++y)this.setCell(y,v);_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),this.getWidth(_)!==0||this.hasContent(_)||this.setCellFromCodepoint(_,0,1,v)}replaceCells(_,b,v,y=!1){if(y)for(_&&this.getWidth(_-1)===2&&!this.isProtected(_-1)&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,v);_<b&&_<this.length;)this.isProtected(_)||this.setCell(_,v),_++;else for(_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,v),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,v);_<b&&_<this.length;)this.setCell(_++,v)}resize(_,b){if(_===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*_;if(_>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const y=new Uint32Array(v);y.set(this._data),this._data=y}for(let y=this.length;y<_;++y)this.setCell(y,b)}else{this._data=this._data.subarray(0,v);const y=Object.keys(this._combined);for(let M=0;M<y.length;M++){const A=parseInt(y[M],10);A>=_&&delete this._combined[A]}const k=Object.keys(this._extendedAttrs);for(let M=0;M<k.length;M++){const A=parseInt(k[M],10);A>=_&&delete this._extendedAttrs[A]}}return this.length=_,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const _=new Uint32Array(this._data.length);return _.set(this._data),this._data=_,1}return 0}fill(_,b=!1){if(b)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,_);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,_)}}copyFrom(_){this.length!==_.length?this._data=new Uint32Array(_._data):this._data.set(_._data),this.length=_.length,this._combined={};for(const b in _._combined)this._combined[b]=_._combined[b];this._extendedAttrs={};for(const b in _._extendedAttrs)this._extendedAttrs[b]=_._extendedAttrs[b];this.isWrapped=_.isWrapped}clone(){const _=new T(0);_._data=new Uint32Array(this._data),_.length=this.length;for(const b in this._combined)_._combined[b]=this._combined[b];for(const b in this._extendedAttrs)_._extendedAttrs[b]=this._extendedAttrs[b];return _.isWrapped=this.isWrapped,_}getTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0])return _+(this._data[3*_+0]>>22);return 0}getNoBgTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0]||50331648&this._data[3*_+2])return _+(this._data[3*_+0]>>22);return 0}copyCellsFrom(_,b,v,y,k){const M=_._data;if(k)for(let N=y-1;N>=0;N--){for(let R=0;R<3;R++)this._data[3*(v+N)+R]=M[3*(b+N)+R];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[v+N]=_._extendedAttrs[b+N])}else for(let N=0;N<y;N++){for(let R=0;R<3;R++)this._data[3*(v+N)+R]=M[3*(b+N)+R];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[v+N]=_._extendedAttrs[b+N])}const A=Object.keys(_._combined);for(let N=0;N<A.length;N++){const R=parseInt(A[N],10);R>=b&&(this._combined[R-b+v]=_._combined[R])}}translateToString(_,b,v,y){b=b??0,v=v??this.length,_&&(v=Math.min(v,this.getTrimmedLength())),y&&(y.length=0);let k="";for(;b<v;){const M=this._data[3*b+0],A=2097151&M,N=2097152&M?this._combined[b]:A?(0,S.stringFromCodePoint)(A):m.WHITESPACE_CELL_CHAR;if(k+=N,y)for(let R=0;R<N.length;++R)y.push(b);b+=M>>22||1}return y&&y.push(b),k}}c.BufferLine=T},4841:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getRangeLength=void 0,c.getRangeLength=function(h,f){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 f*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(p,c)=>{function h(f,g,m){if(g===f.length-1)return f[g].getTrimmedLength();const S=!f[g].hasContent(m-1)&&f[g].getWidth(m-1)===1,C=f[g+1].getWidth(0)===2;return S&&C?m-1:m}Object.defineProperty(c,"__esModule",{value:!0}),c.getWrappedLineTrimmedLength=c.reflowSmallerGetNewLineLengths=c.reflowLargerApplyNewLayout=c.reflowLargerCreateNewLayout=c.reflowLargerGetLinesToRemove=void 0,c.reflowLargerGetLinesToRemove=function(f,g,m,S,C){const T=[];for(let w=0;w<f.length-1;w++){let _=w,b=f.get(++_);if(!b.isWrapped)continue;const v=[f.get(w)];for(;_<f.length&&b.isWrapped;)v.push(b),b=f.get(++_);if(S>=w&&S<_){w+=v.length-1;continue}let y=0,k=h(v,y,g),M=1,A=0;for(;M<v.length;){const R=h(v,M,g),I=R-A,Y=m-k,z=Math.min(I,Y);v[y].copyCellsFrom(v[M],A,k,z,!1),k+=z,k===m&&(y++,k=0),A+=z,A===R&&(M++,A=0),k===0&&y!==0&&v[y-1].getWidth(m-1)===2&&(v[y].copyCellsFrom(v[y-1],m-1,k++,1,!1),v[y-1].setCell(m-1,C))}v[y].replaceCells(k,m,C);let N=0;for(let R=v.length-1;R>0&&(R>y||v[R].getTrimmedLength()===0);R--)N++;N>0&&(T.push(w+v.length-N),T.push(N)),w+=v.length-1}return T},c.reflowLargerCreateNewLayout=function(f,g){const m=[];let S=0,C=g[S],T=0;for(let w=0;w<f.length;w++)if(C===w){const _=g[++S];f.onDeleteEmitter.fire({index:w-T,amount:_}),w+=_-1,T+=_,C=g[++S]}else m.push(w);return{layout:m,countRemoved:T}},c.reflowLargerApplyNewLayout=function(f,g){const m=[];for(let S=0;S<g.length;S++)m.push(f.get(g[S]));for(let S=0;S<m.length;S++)f.set(S,m[S]);f.length=g.length},c.reflowSmallerGetNewLineLengths=function(f,g,m){const S=[],C=f.map(((b,v)=>h(f,v,g))).reduce(((b,v)=>b+v));let T=0,w=0,_=0;for(;_<C;){if(C-_<m){S.push(C-_);break}T+=m;const b=h(f,w,g);T>b&&(T-=b,w++);const v=f[w].getWidth(T-1)===2;v&&T--;const y=v?m-1:m;S.push(y),_+=y}return S},c.getWrappedLineTrimmedLength=h},5295:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferSet=void 0;const f=h(8460),g=h(844),m=h(9092);class S extends g.Disposable{constructor(T,w){super(),this._optionsService=T,this._bufferService=w,this._onBufferActivate=this.register(new f.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 m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(T,w){this._normal.resize(T,w),this._alt.resize(T,w),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}c.BufferSet=S},511:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CellData=void 0;const f=h(482),g=h(643),m=h(3734);class S extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const w=new S;return w.setFromCharData(T),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(T[g.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(T[g.CHAR_DATA_CHAR_INDEX].length===2){const _=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=_&&_<=56319){const b=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(_-55296)+b-56320+65536|T[g.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=T[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[g.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=T[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}c.CellData=S},643:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WHITESPACE_CELL_CODE=c.WHITESPACE_CELL_WIDTH=c.WHITESPACE_CELL_CHAR=c.NULL_CELL_CODE=c.NULL_CELL_WIDTH=c.NULL_CELL_CHAR=c.CHAR_DATA_CODE_INDEX=c.CHAR_DATA_WIDTH_INDEX=c.CHAR_DATA_CHAR_INDEX=c.CHAR_DATA_ATTR_INDEX=c.DEFAULT_EXT=c.DEFAULT_ATTR=c.DEFAULT_COLOR=void 0,c.DEFAULT_COLOR=0,c.DEFAULT_ATTR=256|c.DEFAULT_COLOR<<9,c.DEFAULT_EXT=0,c.CHAR_DATA_ATTR_INDEX=0,c.CHAR_DATA_CHAR_INDEX=1,c.CHAR_DATA_WIDTH_INDEX=2,c.CHAR_DATA_CODE_INDEX=3,c.NULL_CELL_CHAR="",c.NULL_CELL_WIDTH=1,c.NULL_CELL_CODE=0,c.WHITESPACE_CELL_CHAR=" ",c.WHITESPACE_CELL_WIDTH=1,c.WHITESPACE_CELL_CODE=32},4863:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Marker=void 0;const f=h(8460),g=h(844);class m{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}c.Marker=m,m._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,f,g;Object.defineProperty(c,"__esModule",{value:!0}),c.C1_ESCAPED=c.C1=c.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
|
|
81
|
+
`,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(c.C0=h={})),(function(m){m.PAD="",m.HOP="",m.BPH="",m.NBH="",m.IND="",m.NEL="
",m.SSA="",m.ESA="",m.HTS="",m.HTJ="",m.VTS="",m.PLD="",m.PLU="",m.RI="",m.SS2="",m.SS3="",m.DCS="",m.PU1="",m.PU2="",m.STS="",m.CCH="",m.MW="",m.SPA="",m.EPA="",m.SOS="",m.SGCI="",m.SCI="",m.CSI="",m.ST="",m.OSC="",m.PM="",m.APC=""})(f||(c.C1=f={})),(function(m){m.ST=`${h.ESC}\\`})(g||(c.C1_ESCAPED=g={}))},7399:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.evaluateKeyboardEvent=void 0;const f=h(2584),g={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(m,S,C,T){const w={type:0,cancel:!1,key:void 0},_=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?w.key=S?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?w.key=S?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?w.key=S?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(w.key=S?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:w.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(w.key=f.C0.ESC+w.key);break;case 9:if(m.shiftKey){w.key=f.C0.ESC+"[Z";break}w.key=f.C0.HT,w.cancel=!0;break;case 13:w.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,w.cancel=!0;break;case 27:w.key=f.C0.ESC,m.altKey&&(w.key=f.C0.ESC+f.C0.ESC),w.cancel=!0;break;case 37:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"D",w.key===f.C0.ESC+"[1;3D"&&(w.key=f.C0.ESC+(C?"b":"[1;5D"))):w.key=S?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"C",w.key===f.C0.ESC+"[1;3C"&&(w.key=f.C0.ESC+(C?"f":"[1;5C"))):w.key=S?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"A",C||w.key!==f.C0.ESC+"[1;3A"||(w.key=f.C0.ESC+"[1;5A")):w.key=S?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"B",C||w.key!==f.C0.ESC+"[1;3B"||(w.key=f.C0.ESC+"[1;5B")):w.key=S?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(w.key=f.C0.ESC+"[2~");break;case 46:w.key=_?f.C0.ESC+"[3;"+(_+1)+"~":f.C0.ESC+"[3~";break;case 36:w.key=_?f.C0.ESC+"[1;"+(_+1)+"H":S?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:w.key=_?f.C0.ESC+"[1;"+(_+1)+"F":S?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?w.type=2:m.ctrlKey?w.key=f.C0.ESC+"[5;"+(_+1)+"~":w.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?w.type=3:m.ctrlKey?w.key=f.C0.ESC+"[6;"+(_+1)+"~":w.key=f.C0.ESC+"[6~";break;case 112:w.key=_?f.C0.ESC+"[1;"+(_+1)+"P":f.C0.ESC+"OP";break;case 113:w.key=_?f.C0.ESC+"[1;"+(_+1)+"Q":f.C0.ESC+"OQ";break;case 114:w.key=_?f.C0.ESC+"[1;"+(_+1)+"R":f.C0.ESC+"OR";break;case 115:w.key=_?f.C0.ESC+"[1;"+(_+1)+"S":f.C0.ESC+"OS";break;case 116:w.key=_?f.C0.ESC+"[15;"+(_+1)+"~":f.C0.ESC+"[15~";break;case 117:w.key=_?f.C0.ESC+"[17;"+(_+1)+"~":f.C0.ESC+"[17~";break;case 118:w.key=_?f.C0.ESC+"[18;"+(_+1)+"~":f.C0.ESC+"[18~";break;case 119:w.key=_?f.C0.ESC+"[19;"+(_+1)+"~":f.C0.ESC+"[19~";break;case 120:w.key=_?f.C0.ESC+"[20;"+(_+1)+"~":f.C0.ESC+"[20~";break;case 121:w.key=_?f.C0.ESC+"[21;"+(_+1)+"~":f.C0.ESC+"[21~";break;case 122:w.key=_?f.C0.ESC+"[23;"+(_+1)+"~":f.C0.ESC+"[23~";break;case 123:w.key=_?f.C0.ESC+"[24;"+(_+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(C&&!T||!m.altKey||m.metaKey)!C||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?w.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(w.key=f.C0.US),m.key==="@"&&(w.key=f.C0.NUL)):m.keyCode===65&&(w.type=1);else{const b=g[m.keyCode],v=b?.[m.shiftKey?1:0];if(v)w.key=f.C0.ESC+v;else if(m.keyCode>=65&&m.keyCode<=90){const y=m.ctrlKey?m.keyCode-64:m.keyCode+32;let k=String.fromCharCode(y);m.shiftKey&&(k=k.toUpperCase()),w.key=f.C0.ESC+k}else if(m.keyCode===32)w.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let y=m.code.slice(3,4);m.shiftKey||(y=y.toLowerCase()),w.key=f.C0.ESC+y,w.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?w.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?w.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?w.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?w.key=f.C0.DEL:m.keyCode===219?w.key=f.C0.ESC:m.keyCode===220?w.key=f.C0.FS:m.keyCode===221&&(w.key=f.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,f=0,g=h.length){let m="";for(let S=f;S<g;++S){let C=h[S];C>65535?(C-=65536,m+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):m+=String.fromCharCode(C)}return m},c.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,f){const g=h.length;if(!g)return 0;let m=0,S=0;if(this._interim){const C=h.charCodeAt(S++);56320<=C&&C<=57343?f[m++]=1024*(this._interim-55296)+C-56320+65536:(f[m++]=this._interim,f[m++]=C),this._interim=0}for(let C=S;C<g;++C){const T=h.charCodeAt(C);if(55296<=T&&T<=56319){if(++C>=g)return this._interim=T,m;const w=h.charCodeAt(C);56320<=w&&w<=57343?f[m++]=1024*(T-55296)+w-56320+65536:(f[m++]=T,f[m++]=w)}else T!==65279&&(f[m++]=T)}return m}},c.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,f){const g=h.length;if(!g)return 0;let m,S,C,T,w=0,_=0,b=0;if(this.interim[0]){let k=!1,M=this.interim[0];M&=(224&M)==192?31:(240&M)==224?15:7;let A,N=0;for(;(A=63&this.interim[++N])&&N<4;)M<<=6,M|=A;const R=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=R-N;for(;b<I;){if(b>=g)return 0;if(A=h[b++],(192&A)!=128){b--,k=!0;break}this.interim[N++]=A,M<<=6,M|=63&A}k||(R===2?M<128?b--:f[w++]=M:R===3?M<2048||M>=55296&&M<=57343||M===65279||(f[w++]=M):M<65536||M>1114111||(f[w++]=M)),this.interim.fill(0)}const v=g-4;let y=b;for(;y<g;){for(;!(!(y<v)||128&(m=h[y])||128&(S=h[y+1])||128&(C=h[y+2])||128&(T=h[y+3]));)f[w++]=m,f[w++]=S,f[w++]=C,f[w++]=T,y+=4;if(m=h[y++],m<128)f[w++]=m;else if((224&m)==192){if(y>=g)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(_=(31&m)<<6|63&S,_<128){y--;continue}f[w++]=_}else if((240&m)==224){if(y>=g)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,w;if(C=h[y++],(192&C)!=128){y--;continue}if(_=(15&m)<<12|(63&S)<<6|63&C,_<2048||_>=55296&&_<=57343||_===65279)continue;f[w++]=_}else if((248&m)==240){if(y>=g)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,w;if(C=h[y++],(192&C)!=128){y--;continue}if(y>=g)return this.interim[0]=m,this.interim[1]=S,this.interim[2]=C,w;if(T=h[y++],(192&T)!=128){y--;continue}if(_=(7&m)<<18|(63&S)<<12|(63&C)<<6|63&T,_<65536||_>1114111)continue;f[w++]=_}}return w}}},225:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeV6=void 0;const f=h(1480),g=[[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]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;c.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<g.length;++C)S.fill(0,g[C][0],g[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let _,b=0,v=w.length-1;if(T<w[0][0]||T>w[v][1])return!1;for(;v>=b;)if(_=b+v>>1,T>w[_][1])b=_+1;else{if(!(T<w[_][0]))return!0;v=_-1}return!1})(C,m)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),_=w===0&&T!==0;if(_){const b=f.UnicodeService.extractWidth(T);b===0?_=!1:b>w&&(w=b)}return f.UnicodeService.createPropertyValue(0,w,_)}}},5981:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.WriteBuffer=void 0;const f=h(8460),g=h(844);class m extends g.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 f.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 _=this._callbacks.shift();_&&_()}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 _=this._writeBuffer[this._bufferOffset],b=this._action(_,T);if(b){const y=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(y)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=_.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=m},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})$/,f=/^[\da-f]+$/;function g(m,S){const C=m.toString(16),T=C.length<2?"0"+C:C;switch(S){case 4:return C[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}c.parseColor=function(m){if(!m)return;let S=m.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const C=h.exec(S);if(C){const T=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/T*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/T*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/T*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),f.exec(S)&&[3,6,9,12].includes(S.length))){const C=S.length/3,T=[0,0,0];for(let w=0;w<3;++w){const _=parseInt(S.slice(C*w,C*w+C),16);T[w]=C===1?_<<4:C===2?_:C===3?_>>4:_>>8}return T}},c.toRgbString=function(m,S=16){const[C,T,w]=m;return`rgb:${g(C,S)}/${g(T,S)}/${g(w,S)}`}},5770:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PAYLOAD_LIMIT=void 0,c.PAYLOAD_LIMIT=1e7},6351:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DcsHandler=c.DcsParser=void 0;const f=h(482),g=h(8742),m=h(5770),S=[];c.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(T,w){this._handlers[T]===void 0&&(this._handlers[T]=[]);const _=this._handlers[T];return _.push(w),{dispose:()=>{const b=_.indexOf(w);b!==-1&&_.splice(b,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(T,w){if(this.reset(),this._ident=T,this._active=this._handlers[T]||S,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(T,w,_){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(T,w,_);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(T,w,_))}unhook(T,w=!0){if(this._active.length){let _=!1,b=this._active.length-1,v=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,_=w,v=this._stack.fallThrough,this._stack.paused=!1),!v&&_===!1){for(;b>=0&&(_=this._active[b].unhook(T),_!==!0);b--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,_;b--}for(;b>=0;b--)if(_=this._active[b].unhook(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,_}else this._handlerFb(this._ident,"UNHOOK",T);this._active=S,this._ident=0}};const C=new g.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,_){this._hitLimit||(this._data+=(0,f.utf32ToString)(T,w,_),this._data.length>m.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((_=>(this._params=C,this._data="",this._hitLimit=!1,_)));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 f=h(844),g=h(8742),m=h(6242),S=h(6351);class C{constructor(b){this.table=new Uint8Array(b)}setDefault(b,v){this.table.fill(b<<4|v)}add(b,v,y,k){this.table[v<<8|b]=y<<4|k}addMany(b,v,y,k){for(let M=0;M<b.length;M++)this.table[v<<8|b[M]]=y<<4|k}}c.TransitionTable=C;const T=160;c.VT500_TRANSITION_TABLE=(function(){const _=new C(4095),b=Array.apply(null,Array(256)).map(((N,R)=>R)),v=(N,R)=>b.slice(N,R),y=v(32,127),k=v(0,24);k.push(25),k.push.apply(k,v(28,32));const M=v(0,14);let A;for(A in _.setDefault(1,0),_.addMany(y,0,2,0),M)_.addMany([24,26,153,154],A,3,0),_.addMany(v(128,144),A,3,0),_.addMany(v(144,152),A,3,0),_.add(156,A,0,0),_.add(27,A,11,1),_.add(157,A,4,8),_.addMany([152,158,159],A,0,7),_.add(155,A,11,3),_.add(144,A,11,9);return _.addMany(k,0,3,0),_.addMany(k,1,3,1),_.add(127,1,0,1),_.addMany(k,8,0,8),_.addMany(k,3,3,3),_.add(127,3,0,3),_.addMany(k,4,3,4),_.add(127,4,0,4),_.addMany(k,6,3,6),_.addMany(k,5,3,5),_.add(127,5,0,5),_.addMany(k,2,3,2),_.add(127,2,0,2),_.add(93,1,4,8),_.addMany(y,8,5,8),_.add(127,8,5,8),_.addMany([156,27,24,26,7],8,6,0),_.addMany(v(28,32),8,0,8),_.addMany([88,94,95],1,0,7),_.addMany(y,7,0,7),_.addMany(k,7,0,7),_.add(156,7,0,0),_.add(127,7,0,7),_.add(91,1,11,3),_.addMany(v(64,127),3,7,0),_.addMany(v(48,60),3,8,4),_.addMany([60,61,62,63],3,9,4),_.addMany(v(48,60),4,8,4),_.addMany(v(64,127),4,7,0),_.addMany([60,61,62,63],4,0,6),_.addMany(v(32,64),6,0,6),_.add(127,6,0,6),_.addMany(v(64,127),6,0,0),_.addMany(v(32,48),3,9,5),_.addMany(v(32,48),5,9,5),_.addMany(v(48,64),5,0,6),_.addMany(v(64,127),5,7,0),_.addMany(v(32,48),4,9,5),_.addMany(v(32,48),1,9,2),_.addMany(v(32,48),2,9,2),_.addMany(v(48,127),2,10,0),_.addMany(v(48,80),1,10,0),_.addMany(v(81,88),1,10,0),_.addMany([89,90,92],1,10,0),_.addMany(v(96,127),1,10,0),_.add(80,1,11,9),_.addMany(k,9,0,9),_.add(127,9,0,9),_.addMany(v(28,32),9,0,9),_.addMany(v(32,48),9,9,12),_.addMany(v(48,60),9,8,10),_.addMany([60,61,62,63],9,9,10),_.addMany(k,11,0,11),_.addMany(v(32,128),11,0,11),_.addMany(v(28,32),11,0,11),_.addMany(k,10,0,10),_.add(127,10,0,10),_.addMany(v(28,32),10,0,10),_.addMany(v(48,60),10,8,10),_.addMany([60,61,62,63],10,0,11),_.addMany(v(32,48),10,9,12),_.addMany(k,12,0,12),_.add(127,12,0,12),_.addMany(v(28,32),12,0,12),_.addMany(v(32,48),12,9,12),_.addMany(v(48,64),12,0,11),_.addMany(v(64,127),12,12,13),_.addMany(v(64,127),10,12,13),_.addMany(v(64,127),9,12,13),_.addMany(k,13,13,13),_.addMany(y,13,13,13),_.add(127,13,0,13),_.addMany([27,156,24,26],13,14,0),_.add(T,0,2,0),_.add(T,8,5,8),_.add(T,6,0,6),_.add(T,11,0,11),_.add(T,13,13,13),_})();class w extends f.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 g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,y,k)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,y)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,v=[64,126]){let y=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=b.prefix.charCodeAt(0),y&&60>y||y>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 M=0;M<b.intermediates.length;++M){const A=b.intermediates.charCodeAt(M);if(32>A||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=A}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(v[0]>k||k>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return y<<=8,y|=k,y}identToString(b){const v=[];for(;b;)v.push(String.fromCharCode(255&b)),b>>=8;return v.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,v){const y=this._identifier(b,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const k=this._escHandlers[y];return k.push(v),{dispose:()=>{const M=k.indexOf(v);M!==-1&&k.splice(M,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,v){this._executeHandlers[b.charCodeAt(0)]=v}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,v){const y=this._identifier(b);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const k=this._csiHandlers[y];return k.push(v),{dispose:()=>{const M=k.indexOf(v);M!==-1&&k.splice(M,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,v){return this._dcsParser.registerHandler(this._identifier(b),v)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,v){return this._oscParser.registerHandler(b,v)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,v,y,k,M){this._parseStack.state=b,this._parseStack.handlers=v,this._parseStack.handlerPos=y,this._parseStack.transition=k,this._parseStack.chunkPos=M}parse(b,v,y){let k,M=0,A=0,N=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,N=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const R=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&I>-1){for(;I>=0&&(k=R[I](this._params),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 4:if(y===!1&&I>-1){for(;I>=0&&(k=R[I](),k!==!0);I--)if(k instanceof Promise)return this._parseStack.handlerPos=I,k}this._parseStack.handlers=[];break;case 6:if(M=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(M!==24&&M!==26,y),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(M=b[this._parseStack.chunkPos],k=this._oscParser.end(M!==24&&M!==26,y),k)return k;M===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 R=N;R<v;++R){switch(M=b[R],A=this._transitions.table[this.currentState<<8|(M<160?M:T)],A>>4){case 2:for(let B=R+1;;++B){if(B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,R,B),R=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,R,B),R=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,R,B),R=B-1;break}if(++B>=v||(M=b[B])<32||M>126&&M<T){this._printHandler(b,R,B),R=B-1;break}}break;case 3:this._executeHandlers[M]?this._executeHandlers[M]():this._executeHandlerFb(M),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:R,code:M,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|M];let Y=I?I.length-1:-1;for(;Y>=0&&(k=I[Y](this._params),k!==!0);Y--)if(k instanceof Promise)return this._preserveStack(3,I,Y,A,R),k;Y<0&&this._csiHandlerFb(this._collect<<8|M,this._params),this.precedingJoinState=0;break;case 8:do switch(M){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(M-48)}while(++R<v&&(M=b[R])>47&&M<60);R--;break;case 9:this._collect<<=8,this._collect|=M;break;case 10:const z=this._escHandlers[this._collect<<8|M];let q=z?z.length-1:-1;for(;q>=0&&(k=z[q](),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(4,z,q,A,R),k;q<0&&this._escHandlerFb(this._collect<<8|M),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|M,this._params);break;case 13:for(let B=R+1;;++B)if(B>=v||(M=b[B])===24||M===26||M===27||M>127&&M<T){this._dcsParser.put(b,R,B),R=B-1;break}break;case 14:if(k=this._dcsParser.unhook(M!==24&&M!==26),k)return this._preserveStack(6,[],0,A,R),k;M===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let B=R+1;;B++)if(B>=v||(M=b[B])<32||M>127&&M<T){this._oscParser.put(b,R,B),R=B-1;break}break;case 6:if(k=this._oscParser.end(M!==24&&M!==26),k)return this._preserveStack(5,[],0,A,R),k;M===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&A}}}c.EscapeSequenceParser=w},6242:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OscHandler=c.OscParser=void 0;const f=h(5770),g=h(482),m=[];c.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,C){this._handlers[S]===void 0&&(this._handlers[S]=[]);const T=this._handlers[S];return T.push(C),{dispose:()=>{const w=T.indexOf(C);w!==-1&&T.splice(w,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,C,T){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(S,C,T);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(S,C,T))}start(){this.reset(),this._state=1}put(S,C,T){if(this._state!==3){if(this._state===1)for(;C<T;){const w=S[C++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&T-C>0&&this._put(S,C,T)}}end(S,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,w=this._active.length-1,_=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,T=C,_=this._stack.fallThrough,this._stack.paused=!1),!_&&T===!1){for(;w>=0&&(T=this._active[w].end(S),T!==!0);w--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,T;w--}for(;w>=0;w--)if(T=this._active[w].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",S);this._active=m,this._id=-1,this._state=0}}},c.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,C,T){this._hitLimit||(this._data+=(0,g.utf32ToString)(S,C,T),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let C=!1;if(this._hitLimit)C=!1;else if(S&&(C=this._handler(this._data),C instanceof Promise))return C.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,C}}},8742:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Params=void 0;const h=2147483647;class f{static fromArray(m){const S=new f;if(!m.length)return S;for(let C=Array.isArray(m[0])?1:0;C<m.length;++C){const T=m[C];if(Array.isArray(T))for(let w=0;w<T.length;++w)S.addSubParam(T[w]);else S.addParam(T)}return S}constructor(m=32,S=32){if(this.maxLength=m,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let S=0;S<this.length;++S){m.push(this.params[S]);const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&m.push(Array.prototype.slice.call(this._subParams,C,T))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>h?h:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const S=this._subParamsIdx[m]>>8,C=255&this._subParamsIdx[m];return C-S>0?this._subParams.subarray(S,C):null}getSubParamsAll(){const m={};for(let S=0;S<this.length;++S){const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&(m[S]=this._subParams.slice(C,T))}return m}addDigit(m){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,T=C[S-1];C[S-1]=~T?Math.min(10*T+m,h):m}}c.Params=f},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,f){const g={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(g),f.dispose=()=>this._wrappedAddonDispose(g),f.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let f=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===h){f=g;break}if(f===-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(f,1)}}},8771:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferApiView=void 0;const f=h(3785),g=h(511);c.BufferApiView=class{constructor(m,S){this._buffer=m,this.type=S}init(m){return this._buffer=m,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(m){const S=this._buffer.lines.get(m);if(S)return new f.BufferLineApiView(S)}getNullCell(){return new g.CellData}}},3785:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferLineApiView=void 0;const f=h(511);c.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new f.CellData)}translateToString(g,m,S){return this._line.translateToString(g,m,S)}}},8285:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BufferNamespaceApi=void 0;const f=h(8771),g=h(8460),m=h(844);class S extends m.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}c.BufferNamespaceApi=S},7975:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.ParserApi=void 0,c.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,f){return this._core.registerCsiHandler(h,(g=>f(g.toArray())))}addCsiHandler(h,f){return this.registerCsiHandler(h,f)}registerDcsHandler(h,f){return this._core.registerDcsHandler(h,((g,m)=>f(g,m.toArray())))}addDcsHandler(h,f){return this.registerDcsHandler(h,f)}registerEscHandler(h,f){return this._core.registerEscHandler(h,f)}addEscHandler(h,f){return this.registerEscHandler(h,f)}registerOscHandler(h,f){return this._core.registerOscHandler(h,f)}addOscHandler(h,f){return this.registerOscHandler(h,f)}}},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 f=this&&this.__decorate||function(_,b,v,y){var k,M=arguments.length,A=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,v,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(A=(M<3?k(A):M>3?k(b,v,A):k(b,v))||A);return M>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(_,b){return function(v,y){b(v,y,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.BufferService=c.MINIMUM_ROWS=c.MINIMUM_COLS=void 0;const m=h(8460),S=h(844),C=h(5295),T=h(2585);c.MINIMUM_COLS=2,c.MINIMUM_ROWS=1;let w=c.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(_){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(_.rawOptions.cols||0,c.MINIMUM_COLS),this.rows=Math.max(_.rawOptions.rows||0,c.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(_,this))}resize(_,b){this.cols=_,this.rows=b,this.buffers.resize(_,b),this._onResize.fire({cols:_,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(_,b=!1){const v=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===_.fg&&y.getBg(0)===_.bg||(y=v.getBlankLine(_,b),this._cachedBlankLine=y),y.isWrapped=b;const k=v.ybase+v.scrollTop,M=v.ybase+v.scrollBottom;if(v.scrollTop===0){const A=v.lines.isFull;M===v.lines.length-1?A?v.lines.recycle().copyFrom(y):v.lines.push(y.clone()):v.lines.splice(M+1,0,y.clone()),A?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const A=M-k+1;v.lines.shiftElements(k+1,A-1,-1),v.lines.set(M,y.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(_,b,v){const y=this.buffer;if(_<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else _+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const k=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+_,y.ybase),0),k!==y.ydisp&&(b||this._onScroll.fire(y.ydisp))}};c.BufferService=w=f([g(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,f){this._charsets[h]=f,this.glevel===h&&(this.charset=f)}}},1753:function(p,c,h){var f=this&&this.__decorate||function(y,k,M,A){var N,R=arguments.length,I=R<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,M):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(y,k,M,A);else for(var Y=y.length-1;Y>=0;Y--)(N=y[Y])&&(I=(R<3?N(I):R>3?N(k,M,I):N(k,M))||I);return R>3&&I&&Object.defineProperty(k,M,I),I},g=this&&this.__param||function(y,k){return function(M,A){k(M,A,y)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreMouseService=void 0;const m=h(2585),S=h(8460),C=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function w(y,k){let M=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(M|=64,M|=y.action):(M|=3&y.button,4&y.button&&(M|=64),8&y.button&&(M|=128),y.action===32?M|=32:y.action!==0||k||(M|=3)),M}const _=String.fromCharCode,b={DEFAULT:y=>{const k=[w(y,!1)+32,y.col+32,y.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${_(k[0])}${_(k[1])}${_(k[2])}`},SGR:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${w(y,!0)};${y.col};${y.row}${k}`},SGR_PIXELS:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${w(y,!0)};${y.x};${y.y}${k}`}};let v=c.CoreMouseService=class extends C.Disposable{constructor(y,k){super(),this._bufferService=y,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const M of Object.keys(T))this.addProtocol(M,T[M]);for(const M of Object.keys(b))this.addEncoding(M,b[M]);this.reset()}addProtocol(y,k){this._protocols[y]=k}addEncoding(y,k){this._encodings[y]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const k=this._encodings[this._activeEncoding](y);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,k,M){if(M){if(y.x!==k.x||y.y!==k.y)return!1}else if(y.col!==k.col||y.row!==k.row)return!1;return y.button===k.button&&y.action===k.action&&y.ctrl===k.ctrl&&y.alt===k.alt&&y.shift===k.shift}};c.CoreMouseService=v=f([g(0,m.IBufferService),g(1,m.ICoreService)],v)},6975:function(p,c,h){var f=this&&this.__decorate||function(v,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,y,k,M);else for(var I=v.length-1;I>=0;I--)(A=v[I])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},g=this&&this.__param||function(v,y){return function(k,M){y(k,M,v)}};Object.defineProperty(c,"__esModule",{value:!0}),c.CoreService=void 0;const m=h(1439),S=h(8460),C=h(844),T=h(2585),w=Object.freeze({insertMode:!1}),_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=c.CoreService=class extends C.Disposable{constructor(v,y,k){super(),this._bufferService=v,this._logService=y,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(w),this.decPrivateModes=(0,m.clone)(_)}reset(){this.modes=(0,m.clone)(w),this.decPrivateModes=(0,m.clone)(_)}triggerDataEvent(v,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((M=>M.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(v))}};c.CoreService=b=f([g(0,T.IBufferService),g(1,T.ILogService),g(2,T.IOptionsService)],b)},9074:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DecorationService=void 0;const f=h(8055),g=h(8460),m=h(844),S=h(6106);let C=0,T=0;class w extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const y=new _(v);if(y){const k=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),k.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,y,k){let M=0,A=0;for(const N of this._decorations.getKeyIterator(y))M=N.options.x??0,A=M+(N.options.width??1),v>=M&&v<A&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(v,y,k,M){this._decorations.forEachByKey(y,(A=>{C=A.options.x??0,T=C+(A.options.width??1),v>=C&&v<T&&(!k||(A.options.layer??"bottom")===k)&&M(A)}))}}c.DecorationService=w;class _ extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.InstantiationService=c.ServiceCollection=void 0;const f=h(2585),g=h(8343);class m{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=m,c.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(S,C){this._services.set(S,C)}getService(S){return this._services.get(S)}createInstance(S,...C){const T=(0,g.getServiceDependencies)(S).sort(((b,v)=>b.index-v.index)),w=[];for(const b of T){const v=this._services.get(b.id);if(!v)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);w.push(v)}const _=T.length>0?T[0].index:C.length;if(C.length!==_)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${_+1} conflicts with ${C.length} static arguments`);return new S(...C,...w)}}},7866:function(p,c,h){var f=this&&this.__decorate||function(_,b,v,y){var k,M=arguments.length,A=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,v):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,v,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(A=(M<3?k(A):M>3?k(b,v,A):k(b,v))||A);return M>3&&A&&Object.defineProperty(b,v,A),A},g=this&&this.__param||function(_,b){return function(v,y){b(v,y,_)}};Object.defineProperty(c,"__esModule",{value:!0}),c.traceCall=c.setTraceLogger=c.LogService=void 0;const m=h(844),S=h(2585),C={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let T,w=c.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(_){super(),this._optionsService=_,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(_){for(let b=0;b<_.length;b++)typeof _[b]=="function"&&(_[b]=_[b]())}_log(_,b,v){this._evalLazyOptionalParams(v),_.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...v)}trace(_,...b){this._logLevel<=S.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,_,b)}debug(_,...b){this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,_,b)}info(_,...b){this._logLevel<=S.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,_,b)}warn(_,...b){this._logLevel<=S.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,_,b)}error(_,...b){this._logLevel<=S.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,_,b)}};c.LogService=w=f([g(0,S.IOptionsService)],w),c.setTraceLogger=function(_){T=_},c.traceCall=function(_,b,v){if(typeof v.value!="function")throw new Error("not supported");const y=v.value;v.value=function(...k){if(T.logLevel!==S.LogLevelEnum.TRACE)return y.apply(this,k);T.trace(`GlyphRenderer#${y.name}(${k.map((A=>JSON.stringify(A))).join(", ")})`);const M=y.apply(this,k);return T.trace(`GlyphRenderer#${y.name} return`,M),M}}},7302:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionsService=c.DEFAULT_OPTIONS=void 0;const f=h(8460),g=h(844),m=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:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends g.Disposable{constructor(w){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const _={...c.DEFAULT_OPTIONS};for(const b in w)if(b in _)try{const v=w[b];_[b]=this._sanitizeAndValidateOption(b,v)}catch(v){console.error(v)}this.rawOptions=_,this.options={..._},this._setupOptions(),this.register((0,g.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,_){return this.onOptionChange((b=>{b===w&&_(this.rawOptions[w])}))}onMultipleOptionChange(w,_){return this.onOptionChange((b=>{w.indexOf(b)!==-1&&_()}))}_setupOptions(){const w=b=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},_=(b,v)=>{if(!(b in c.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);v=this._sanitizeAndValidateOption(b,v),this.rawOptions[b]!==v&&(this.rawOptions[b]=v,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const v={get:w.bind(this,b),set:_.bind(this,b)};Object.defineProperty(this.options,b,v)}}_sanitizeAndValidateOption(w,_){switch(w){case"cursorStyle":if(_||(_=c.DEFAULT_OPTIONS[w]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(_))throw new Error(`"${_}" is not a valid value for ${w}`);break;case"wordSeparator":_||(_=c.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof _=="number"&&1<=_&&_<=1e3)break;_=S.includes(_)?_:c.DEFAULT_OPTIONS[w];break;case"cursorWidth":_=Math.floor(_);case"lineHeight":case"tabStopWidth":if(_<1)throw new Error(`${w} cannot be less than 1, value: ${_}`);break;case"minimumContrastRatio":_=Math.max(1,Math.min(21,Math.round(10*_)/10));break;case"scrollback":if((_=Math.min(_,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${_}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(_<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${_}`);break;case"rows":case"cols":if(!_&&_!==0)throw new Error(`${w} must be numeric, value: ${_}`);break;case"windowsPty":_=_??{}}return _}}c.OptionsService=C},2660:function(p,c,h){var f=this&&this.__decorate||function(C,T,w,_){var b,v=arguments.length,y=v<3?T:_===null?_=Object.getOwnPropertyDescriptor(T,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(C,T,w,_);else for(var k=C.length-1;k>=0;k--)(b=C[k])&&(y=(v<3?b(y):v>3?b(T,w,y):b(T,w))||y);return v>3&&y&&Object.defineProperty(T,w,y),y},g=this&&this.__param||function(C,T){return function(w,_){T(w,_,C)}};Object.defineProperty(c,"__esModule",{value:!0}),c.OscLinkService=void 0;const m=h(2585);let S=c.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const T=this._bufferService.buffer;if(C.id===void 0){const k=T.addMarker(T.ybase+T.y),M={data:C,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(M,k))),this._dataByLinkId.set(M.id,M),M.id}const w=C,_=this._getEntryIdKey(w),b=this._entriesWithId.get(_);if(b)return this.addLineToLink(b.id,T.ybase+T.y),b.id;const v=T.addMarker(T.ybase+T.y),y={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(y,v))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(C,T){const w=this._dataByLinkId.get(C);if(w&&w.lines.every((_=>_.line!==T))){const _=this._bufferService.buffer.addMarker(T);w.lines.push(_),_.onDispose((()=>this._removeMarkerFromLink(w,_)))}}getLinkData(C){return this._dataByLinkId.get(C)?.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,T){const w=C.lines.indexOf(T);w!==-1&&(C.lines.splice(w,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};c.OscLinkService=S=f([g(0,m.IBufferService)],S)},8343:(p,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createDecorator=c.getServiceDependencies=c.serviceRegistry=void 0;const h="di$target",f="di$dependencies";c.serviceRegistry=new Map,c.getServiceDependencies=function(g){return g[f]||[]},c.createDecorator=function(g){if(c.serviceRegistry.has(g))return c.serviceRegistry.get(g);const m=function(S,C,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,_,b){_[h]===_?_[f].push({id:w,index:b}):(_[f]=[{id:w,index:b}],_[h]=_)})(m,S,T)};return m.toString=()=>g,c.serviceRegistry.set(g,m),m}},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 f=h(8343);var g;c.IBufferService=(0,f.createDecorator)("BufferService"),c.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),c.ICoreService=(0,f.createDecorator)("CoreService"),c.ICharsetService=(0,f.createDecorator)("CharsetService"),c.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(g||(c.LogLevelEnum=g={})),c.ILogService=(0,f.createDecorator)("LogService"),c.IOptionsService=(0,f.createDecorator)("OptionsService"),c.IOscLinkService=(0,f.createDecorator)("OscLinkService"),c.IUnicodeService=(0,f.createDecorator)("UnicodeService"),c.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(p,c,h)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.UnicodeService=void 0;const f=h(8460),g=h(225);class m{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 f.EventEmitter,this.onChange=this._onChange.event;const C=new g.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 _=C.length;for(let b=0;b<_;++b){let v=C.charCodeAt(b);if(55296<=v&&v<=56319){if(++b>=_)return T+this.wcwidth(v);const M=C.charCodeAt(b);56320<=M&&M<=57343?v=1024*(v-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(v,w);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(w)),T+=k,w=y}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}c.UnicodeService=m}},s={};function a(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,a),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const c=a(9042),h=a(3236),f=a(844),g=a(5741),m=a(8285),S=a(7975),C=a(7090),T=["cols","rows"];class w extends f.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const v=k=>this._core.options[k],y=(k,M)=>{this._checkReadonlyOptions(k),this._core.options[k]=M};for(const k in this._core.options){const M={get:v.bind(this,k),set:y.bind(this,k)};Object.defineProperty(this._publicOptions,k,M)}}_checkReadonlyOptions(b){if(T.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const v in b)this._publicOptions[v]=b[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,v=!0){this._core.input(b,v)}resize(b,v){this._verifyIntegers(b,v),this._core.resize(b,v)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,v,y){this._verifyIntegers(b,v,y),this._core.select(b,v,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,v){this._verifyIntegers(b,v),this._core.selectLines(b,v)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,v){this._core.write(b,v)}writeln(b,v){this._core.write(b),this._core.write(`\r
|
|
82
|
+
`,v)}paste(b){this._core.paste(b)}refresh(b,v){this._verifyIntegers(b,v),this._core.refresh(b,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return c}_verifyIntegers(...b){for(const v of b)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const v of b)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}p.Terminal=w})(),d})()))})(tm)),tm.exports}var s4=r4();function a4(e){let t=!1,i=!1,s=!1,a=!1,d=null,p=null;const c=()=>{d!==null&&(clearTimeout(d),d=null),s=!1},h=()=>{p!==null&&(clearTimeout(p),p=null),i=!1},f=()=>{h(),i=!0,p=setTimeout(()=>{p=null,i=!1},0)},g=()=>{s=!1,d!==null&&clearTimeout(d),p!==null&&(clearTimeout(p),p=null),d=setTimeout(()=>{d=null,i=!1,e()},0)},m=()=>{t=!1,d===null&&(h(),s=!1)},S=()=>{t=!1,a=!1,h(),c()},C=T=>{if(d===null){if(t||i||l4(T)){s=!0,i&&!t?g():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),s&&g()},onCompositionCancel:m,handleKeyEvent(T){return o4(T)&&T.shiftKey?(T.preventDefault?.(),T.type==="keydown"?(a=!0,C(T)):T.type==="keypress"?(a||C(T),a=!1):T.type==="keyup"&&(a=!1),!1):!0},dispose:S}}function o4(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function l4(e){return e.isComposing===!0||e.keyCode===229||e.which===229}const c4={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",lineHeight:1},u4="Symbols Nerd Font Mono",Qu=`ui-monospace, "SF Mono", Menlo, "${u4}", monospace`,v_=14,TC=10,AC=22,h4={min:TC,max:AC},d4="cascadia",_c=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Qu}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Qu}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Qu}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Qu}`,meta:"Variable · Adobe mono"}],bo=_c[0];function f4(e){return _c.find(t=>t.id===e)??bo}function vc(){return{source:"curated",id:d4,customName:"",family:bo.family,size:v_}}function b_(e,t){const i=f4(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:x_(t)}}function y_(e,t){const i=g4(e);return{source:"custom",id:null,customName:i,family:Ih(i,bo.family),size:x_(t)}}function RC(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=x_(typeof t.size=="number"?t.size:v_);return t.source==="custom"&&typeof t.customName=="string"?y_(t.customName,i):typeof t.id=="string"&&m4(t.id)?b_(t.id,i):null}function S_(e){if(!e)return vc();try{const t=RC(JSON.parse(e));if(t!==null)return t}catch{}return vc()}function p4(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function x_(e){return Number.isFinite(e)?Math.min(AC,Math.max(TC,Math.round(e))):v_}function m4(e){return _c.some(t=>t.id===e)}function g4(e){return cd(e)}const Fh="fleet-plugin.terminal.renderer",yo="fleet-plugin.terminal.font",$1="fleet-console.terminalRenderer",F1="fleet-console.terminalFont",sg=new Set;let Ns=R4(),bc=null,ha=0;function _4(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Fh)!==null||window.localStorage.getItem(yo)!==null)return;const e=window.localStorage.getItem($1),t=window.localStorage.getItem(F1),i=e==="webgl"||e==="dom"?e:"webgl",s=S_(t);window.localStorage.setItem(Fh,i),window.localStorage.setItem(yo,p4(s)),window.localStorage.removeItem($1),window.localStorage.removeItem(F1)}catch{}}function v4(e){ha+=1,bc=e,w4()}function LC(){return L.useSyncExternalStore(A4,U1,U1)}function b4(e){k4(e),Co({renderer:e})}function y4(e){const t=b_(e,Ns.font.size);ha+=1,Co({font:t}),pd(t)}function S4(e){const t=y_(e,Ns.font.size);ha+=1,Co({font:t}),pd(t)}function x4(e){const t=Ns.font.source==="custom"?y_(Ns.font.customName,e):b_(Ns.font.id,e);ha+=1,Co({font:t}),pd(t)}async function w4(){if(!bc)return;const e=ha;try{const t=await bc.read("terminal");if(t!==null){const i=RC(t.font);if(i!==null){if(e!==ha)return;Co({font:i});try{window.localStorage.removeItem(yo)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(yo)}catch{}if(i!==null){const s=S_(i);if(e!==ha)return;Co({font:s}),pd(s);try{window.localStorage.removeItem(yo)}catch{}}}}catch{}}async function pd(e){if(bc)try{await bc.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function C4(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Fh);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function E4(){if(typeof window>"u")return vc();try{return S_(window.localStorage.getItem(yo))}catch{return vc()}}function k4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Fh,e)}catch{}}function T4(){for(const e of sg)e()}function Co(e){Ns={...Ns,...e},T4()}function A4(e){return sg.add(e),()=>{sg.delete(e)}}function U1(){return Ns}function R4(){return typeof window>"u"?{renderer:"webgl",font:vc()}:(_4(),{renderer:C4(),font:E4()})}function W1({baseY:e,viewportY:t}){return t>=e}function L4(e){let t=!0,i=null,s=null;const a=()=>{const{baseY:f,viewportY:g}=e.getViewport();i=Math.max(0,f-g)},d=()=>{if(i===null)return;const{baseY:f}=e.getViewport();e.scrollToLine(Math.max(0,Math.min(f,f-i)))},p=()=>{if(t){e.scrollToBottom();return}d()},c=()=>{s===null&&(s=e.requestFrame(()=>{s=null,p()}))},h=()=>{t&&(p(),c())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=W1(e.getViewport()),t){i=null;return}a()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,i=null,h()},preserveAfterGeometryChange:f=>{f(),p(),c()},restoreAfterOutputParsing:()=>{if(t){h();return}W1(e.getViewport())||a()},dispose:()=>{s!==null&&e.cancelFrame(s),s=null}}}const M4="Symbols Nerd Font Mono",N4=`1em "${M4}"`,O4=650;let eh=null;function MC(){return eh||(eh=j4(),eh)}async function D4(){await I4(MC(),O4)}async function j4(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(N4)}catch{}}async function I4(e,t){await new Promise(i=>{let s=!1;const a=setTimeout(d,t);e.then(d,d);function d(){s||(s=!0,clearTimeout(a),i())}})}const B4=80,P4=16,z4=250,H4=1024*1024,$4=120,F4={background:"oklch(16.5% 0.016 245)",foreground:"oklch(94% 0.008 90)",cursor:"oklch(77% 0.085 200)",selectionBackground:"oklch(80% 0.085 78 / 13%)",black:"oklch(13% 0.014 245)",brightBlack:"oklch(29% 0.018 245)",red:"oklch(68% 0.13 25)",green:"oklch(76% 0.11 160)",yellow:"oklch(75% 0.08 90)",blue:"oklch(77% 0.085 200)",magenta:"oklch(70% 0.012 245)",cyan:"oklch(77% 0.085 200)",white:"oklch(94% 0.008 90)",brightRed:"oklch(68% 0.13 25)",brightGreen:"oklch(76% 0.11 160)",brightYellow:"oklch(80% 0.085 78)",brightBlue:"oklch(77% 0.085 200)",brightMagenta:"oklch(70% 0.012 245)",brightCyan:"oklch(77% 0.085 200)",brightWhite:"oklch(94% 0.008 90)"},U4={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)"},W4={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 w_({operationId:e,ticketPath:t,wsPath:i,theme:s="instrument",onExit:a,active:d,zoom:p=1}){const c=s,{renderer:h,font:f}=LC(),g=L.useRef(null),m=L.useRef(null),S=L.useRef(null),C=L.useRef(null),T=L.useRef(null),w=L.useRef(null),_=L.useRef(null),[b,v]=L.useState(p),y=L.useRef(a);y.current=a;const k=L.useRef(d);k.current=d;const[M,A]=L.useState("connecting"),[N,R]=L.useState(0);L.useEffect(()=>{const z=g.current;if(!z)return;let q=!1,B=null,W=null,F=null;return(async()=>{if(await D4(),q)return;const K=new s4.Terminal({...c4,fontFamily:f.family,fontSize:f.size*b,theme:G1(c)});m.current=K;const X=new bM.FitAddon;_.current=X,K.loadAddon(X),K.open(z),K.loadAddon(new xM.Unicode11Addon),K.unicode.activeVersion="11";const O=a4(()=>K.input(`
|
|
83
|
+
`)),H=z.querySelector("textarea.xterm-helper-textarea, textarea")??z;H.addEventListener("compositionstart",O.onCompositionStart),H.addEventListener("compositionend",O.onCompositionEnd),H.addEventListener("focusout",O.onCompositionCancel),K.attachCustomKeyEventHandler(O.handleKeyEvent);const j=L4({getViewport:()=>K.buffer.active,scrollToBottom:()=>G4(K),scrollToLine:$=>q4(K,$),requestFrame:$=>window.requestAnimationFrame($),cancelFrame:$=>window.cancelAnimationFrame($)});w.current=j;const G=K4(z,H,j.recordUserViewportChange),V=Y4(K,k.current!==!1,j.restoreAfterOutputParsing);T.current=V;const ne=fM({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:$=>K.onData(ae=>{j.resumeFollowing(),$(ae)}),write:V.write},onExit:()=>y.current?.(),onStatus:($,ae)=>{A(ae?`${$}: ${ae}`:$)}});S.current=ne;const ie=()=>{j.preserveAfterGeometryChange(()=>{X.fit(),ne.resize(K.cols,K.rows),K.refresh(0,K.rows-1)})},ve=()=>{W&&clearTimeout(W),W=setTimeout(()=>{W=null,q||ie()},B4)},ee=async()=>{await document.fonts?.ready,!q&&(ie(),ne.start(),k.current!==!1&&K.focus())};B=new ResizeObserver(ve),B.observe(z),ee(),F=()=>{W&&clearTimeout(W),H.removeEventListener("compositionstart",O.onCompositionStart),H.removeEventListener("compositionend",O.onCompositionEnd),H.removeEventListener("focusout",O.onCompositionCancel),O.dispose(),ne.dispose(),G.dispose(),V.dispose(),j.dispose(),m.current=null,S.current=null,T.current=null,w.current=null,_.current=null;try{K.dispose()}catch{}},R($=>$+1)})(),()=>{q=!0,B?.disconnect(),F?.()}},[e,t,i]),L.useEffect(()=>{T.current?.setActive(d!==!1),d&&(m.current?.focus(),w.current?.resumeFollowing())},[d]),L.useEffect(()=>{const z=m.current;if(!z)return;let q=!1;if(h==="webgl")try{const B=new i4;C.current=B,B.onContextLoss(()=>{if(!q){try{B.dispose()}catch{}C.current===B&&(C.current=null)}}),z.loadAddon(B)}catch{try{C.current?.dispose()}catch{}C.current=null}return()=>{q=!0;const B=C.current;if(B){C.current=null;try{B.dispose()}catch{}}}},[h,e,N]),L.useEffect(()=>{const z=m.current;z&&(z.options.theme=G1(c))},[c,N]),L.useEffect(()=>{const z=m.current;z&&(z.options.fontFamily=f.family,q1(z,_.current,S.current,w.current))},[f.family,N]),L.useEffect(()=>{if(p===b)return;const z=setTimeout(()=>v(p),$4);return()=>clearTimeout(z)},[p,b]),L.useEffect(()=>{const z=m.current;z&&(z.options.fontSize=f.size*b,q1(z,_.current,S.current,w.current))},[b,f.size,N]);const I=M.startsWith("live"),Y=b===1?void 0:{width:`${b*100}%`,height:`${b*100}%`,transform:`scale(${1/b})`,transformOrigin:"0 0"};return l.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:l.jsxs("div",{className:"terminal-shell",children:[I?null:l.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[l.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),M]}),l.jsx("div",{className:"terminal-viewport",children:l.jsx("div",{className:"terminal-canvas",ref:g,style:Y})})]})})}function G1(e){return e==="carbon"?W4:e==="maritime"?U4:F4}function G4(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function q4(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function K4(e,t,i){const s=e.querySelector(".xterm-viewport");if(!s)return{dispose:()=>{}};let a=!1,d=null;const p=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{d=window.requestAnimationFrame(()=>{d=null,i()})})},c=()=>p(),h=()=>{a=!0},f=C=>{a=C.pointerType==="touch"||C.target===s},g=()=>{a&&p()},m=()=>{const C=a;a=!1,C&&p()},S=C=>{V4(C)&&p()};return s.addEventListener("wheel",c,{capture:!0,passive:!0}),s.addEventListener("touchstart",h,{capture:!0,passive:!0}),s.addEventListener("touchend",m),s.addEventListener("touchcancel",m),s.addEventListener("pointerdown",f,!0),s.addEventListener("scroll",g),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),t.addEventListener("keydown",S,!0),{dispose:()=>{s.removeEventListener("wheel",c,!0),s.removeEventListener("touchstart",h,!0),s.removeEventListener("touchend",m),s.removeEventListener("touchcancel",m),s.removeEventListener("pointerdown",f,!0),s.removeEventListener("scroll",g),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),t.removeEventListener("keydown",S,!0),d!==null&&window.cancelAnimationFrame(d)}}}function V4(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function Y4(e,t,i){let s=t,a=!1,d=null,p=0,c=[];const h=()=>{d&&(clearTimeout(d),d=null)},f=()=>{if(h(),a||p===0)return;const m=X4(c,p);c=[],p=0,e.write(m,()=>{a||i()})},g=()=>{a||d||p===0||(d=setTimeout(f,s?P4:z4))};return{write:m=>{if(!(a||m.byteLength===0)){if(c.push(m),p+=m.byteLength,p>=H4){f();return}g()}},setActive:m=>{if(s!==m){if(s=m,h(),s){f();return}g()}},dispose:()=>{f(),a=!0,c=[],p=0,h()}}}function X4(e,t){if(e.length===1)return e[0]??new Uint8Array;const i=new Uint8Array(t);let s=0;for(const a of e)i.set(a,s),s+=a.byteLength;return i}function q1(e,t,i,s){const a=()=>{t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(s){s.preserveAfterGeometryChange(a);return}a()}const Z4=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class hr extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function J4(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new hr(t.status,"Invalid agent state response");return i.agentClis.map(s=>oN(s,t.status))}async function Q4(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.clis))throw new hr(t.status,"Invalid Agent CLI state response");return i}async function eN(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new hr(t.status,"Invalid tenants response");return i.tenants.map(s=>lN(s,t.status))}async function tN(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new hr(t.status,"Invalid jobs response");return i.tenants}async function nN(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new hr(t.status,"Invalid agent sessions response");return i.sessions.map(s=>md(s,t.status))}async function iN(e){const t=await fetch("/api/v1/operations",{signal:e});await Zr(t);const i=await t.json();if(!Array.isArray(i.operations))throw new hr(t.status,"Invalid operations response");return{operations:i.operations.map(s=>cN(s,t.status))}}async function rN(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 Zr(s),md(await s.json(),s.status)}async function sN(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Zr(i),md(await i.json(),i.status)}async function aN(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Zr(i)}function md(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||ag(i))throw new hr(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 Zr(e){if(!e.ok)throw new hr(e.status,`Agent plugin request failed: ${e.status}`)}function oN(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new hr(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function lN(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 hr(t,"Invalid tenant response");return i}function cN(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"||ag(i)||ag(i.payload))throw new hr(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 ag(e){return og(e,new Set(Z4))}function og(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>og(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||og(s,t))}const uN="active",lg=new Set(["done","error","aborted"]);function hN(e,t){let i=cg(e,t.jobId,t.updatedAt);for(const s of t.events)i=NC(i,s);return lg.has(t.status)&&!lg.has(i.status)&&(i={...i,status:t.status}),i}function NC(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,s={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:pN(e.recentEvents,t)};switch(t.type){case"job:registered":return dN(s,i);case"job:finalized":return{...s,status:un(i.status)??"done",finishedAt:Ts(i.finishedAt)??t.at,summary:un(i.summary),error:un(i.error)};case"track:begin":return eo(s,i,t.id,a=>({...a,startedAt:Ts(i.startedAt)??t.at,requestPreview:un(i.requestPreview)}));case"track:status":return eo(s,i,t.id,a=>({...a,status:un(i.status)??a.status}));case"track:text":return eo(s,i,t.id,a=>{const d=a.text+(un(i.text)??"");return{...a,status:"stream",text:d,sentTextLength:a.sentTextLength+(Ts(i.textLength)??un(i.text)?.length??0),latestLine:mN(d)||a.latestLine}});case"track:thought":return eo(s,i,t.id,a=>{const d=a.thought+(un(i.text)??"");return{...a,thought:d,sentThoughtLength:a.sentThoughtLength+(Ts(i.textLength)??un(i.text)?.length??0)}});case"track:tool":return eo(s,i,t.id,a=>({...a,status:"stream",tools:fN(a.tools,i)}));case"track:finalized":return eo(s,i,t.id,a=>{const d=K1(a.text,a.sentTextLength,un(i.fallbackText),Ts(i.fallbackTextLength)),p=K1(a.thought,a.sentThoughtLength,un(i.fallbackThought),Ts(i.fallbackThoughtLength));return{...a,status:un(i.status)??"done",finishedAt:Ts(i.finishedAt)??t.at,error:un(i.error),text:d.text,sentTextLength:d.sentLength,thought:p.text,sentThoughtLength:p.sentLength}});default:return s}}function cg(e,t,i){return{jobId:t,tenantId:e,status:uN,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Eo(e){return lg.has(e)}function dN(e,t){const i=Array.isArray(t.tracks)?t.tracks:[];let s=e.trackOrder,a=e.tracks;for(const d of i){if(!d.trackId)continue;const p=a[d.trackId],c={...p??OC(d.trackId),displayName:d.displayName??p?.displayName??d.trackId,displayCli:d.displayCli??p?.displayCli,model:d.model??p?.model,effort:d.effort??p?.effort,subtitle:d.subtitle??p?.subtitle,kind:d.kind??p?.kind,startedAt:d.startedAt??p?.startedAt};p||(s=[...s,d.trackId]),a={...a,[d.trackId]:c}}return{...e,label:un(t.label)??e.label,ownerCarrierId:un(t.ownerCarrierId)??e.ownerCarrierId,kind:un(t.kind)??e.kind,signatureCli:un(t.signatureCli)??e.signatureCli,startedAt:Ts(t.startedAt)??e.startedAt,trackOrder:s,tracks:a}}function eo(e,t,i,s){const a=un(t.trackId);if(!a)return e;const d=e.tracks[a],p={...s(d??OC(a)),lastEventId:i};return{...e,trackOrder:d?e.trackOrder:[...e.trackOrder,a],tracks:{...e.tracks,[a]:p}}}function OC(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function fN(e,t){const i=un(t.toolId)??un(t.id);if(!i)return e;const s={id:i,name:un(t.name),input:t.input,output:t.output,status:un(t.status)},a=e.findIndex(d=>d.id===i);return a>=0?[...e.slice(0,a),{...e[a],...s},...e.slice(a+1)]:[...e,s]}function K1(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 pN(e,t){return[...e,t].slice(-120)}function mN(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
84
|
+
`);return i[i.length-1]?.trim()??""}function un(e){return typeof e=="string"?e:void 0}function Ts(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const gN=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function _N(){let e="";return t=>{e+=t;const i=[];let s=e.indexOf(`
|
|
85
|
+
|
|
86
|
+
`);for(;s>=0;){const a=e.slice(0,s);e=e.slice(s+2);const d=bN(a);d&&i.push(d),s=e.indexOf(`
|
|
87
|
+
|
|
88
|
+
`)}return i}}function vN(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=Y1(t.session);return s?{kind:"session",tenantId:s.tenantId??s.sessionId,session:s}:null}if(e.event==="session:attention"){const s=Y1(t.session);return s?{kind:"attention",tenantId:s.tenantId??s.sessionId,session:s,reason:yN(t.reason)}:null}const i=V1(t.event)??V1(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function bN(e){const t=e.split(`
|
|
89
|
+
`),i=t.find(a=>a.startsWith("event:"))?.slice(6).trim()??"message",s=t.filter(a=>a.startsWith("data:")).map(a=>a.slice(5).trim()).join(`
|
|
90
|
+
`);return!s&&i==="message"?null:{event:i,data:s}}function V1(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 Y1(e){try{return md(e,200)}catch{return null}}function yN(e){return typeof e=="string"&&gN.has(e)?e:void 0}const C_={droppedCount:0},ug=new Set;let qt={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function SN(){return Wx(xN,DC)}function DC(){return qt}function xN(e){return ug.add(e),()=>{ug.delete(e)}}function Ni(e){qt={...qt,...e},RN()}function wN(e){Ni({agentClis:e})}function CN(e){const t={};for(const i of e)t[i.sessionId]=i;Ni({sessions:t,sessionOrder:[...e].sort((i,s)=>s.createdAt-i.createdAt).map(i=>i.sessionId)})}function Uh(e){const t=!!qt.sessions[e.sessionId];Ni({sessions:{...qt.sessions,[e.sessionId]:e},sessionOrder:t?qt.sessionOrder:[e.sessionId,...qt.sessionOrder],turnState:{...qt.turnState,[e.sessionId]:e.turnState}})}function jC(e){const{[e]:t,...i}=qt.sessions,{[e]:s,...a}=qt.turnState;Ni({sessions:i,sessionOrder:qt.sessionOrder.filter(d=>d!==e),activeTerminalSessionId:qt.activeTerminalSessionId===e?null:qt.activeTerminalSessionId,turnState:a})}function IC(e){Ni({activeTerminalSessionId:e})}function EN(e){Ni({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...qt.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&qt.tenantJobs[t])]})}function kN(e){const t={};for(const i of e){const s={};for(const a of i.jobs)s[a.jobId]=hN(i.tenantId,a);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(a=>a.jobId),jobs:s,truncation:i.truncation??C_}}Ni({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...qt.tenantOrder.filter(i=>t[i])]})}function TN(e,t){const i=e.tenantId,s=e.jobId??LN(e),a=qt.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:C_},d=s?a.jobs[s]??cg(i,s,e.at):cg(i,"__unknown__",e.at),p=NC(d,e),c=s&&a.jobOrder.includes(s)?a.jobOrder:s?[s,...a.jobOrder]:a.jobOrder,h={...a,tenantLabel:t??a.tenantLabel,jobOrder:c,jobs:s?{...a.jobs,[s]:p}:a.jobs};return Ni({tenantJobs:{...qt.tenantJobs,[i]:h},tenantOrder:qt.tenantOrder.includes(i)?qt.tenantOrder:[i,...qt.tenantOrder]}),{job:p,unknownTenant:!qt.tenantJobs[i]}}function AN(e,t,i){const s=qt.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:C_};Ni({tenantJobs:{...qt.tenantJobs,[e]:{...s,tenantLabel:t??s.tenantLabel,truncation:i}}})}function BC(e){const t=e.tenantId;if(!t)return[];const i=qt.tenantJobs[t];return i?i.jobOrder.map(s=>i.jobs[s]).filter(s=>!!s):[]}function RN(){for(const e of ug)e()}function LN(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const X1=250,MN=5e3,hg=new Map;function NN(e){const t=new AbortController;return ON(t.signal,e),()=>t.abort()}async function ON(e,t){let i=X1;for(;!e.aborted;){Ni({connection:"connecting"});try{await BN(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}`);Ni({connection:"live",connectionError:null}),i=X1,await DN(s.body.getReader(),e,t),e.aborted||Ni({connection:"connecting",connectionError:null})}catch(s){if(e.aborted)return;Ni({connection:"connecting",connectionError:s instanceof Error?s.message:String(s)})}if(e.aborted)return;await zN(i,e),i=Math.min(i*2,MN)}}async function DN(e,t,i){const s=new TextDecoder,a=_N();for(;!t.aborted;){const d=await e.read();if(d.done)return;for(const p of a(s.decode(d.value,{stream:!0}))){const c=vN(p);if(c){if(c.kind==="truncation"&&c.truncation){AN(c.tenantId,c.tenantLabel,c.truncation);continue}if(c.kind==="session"&&c.session){Uh(c.session),Wh(i,c.session.sessionId,E_(c.session));continue}if(c.kind==="attention"&&c.session){Uh(c.session),c.reason!=="idle_prompt"&&Wh(i,c.session.sessionId,"awaiting");continue}c.event&&(TN(c.event,c.tenantLabel),IN(i,c.event.tenantId))}}}}function E_(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&jN(e)?"running":"idle"}function jN(e){return BC(e).some(t=>!Eo(t.status))}function Wh(e,t,i){const s=hg.get(t);e.status.set(t,i),hg.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 IN(e,t){const{sessions:i}=DC();for(const s of Object.values(i))s.tenantId===t&&hg.get(s.sessionId)!=="awaiting"&&Wh(e,s.sessionId,E_(s))}async function BN(e,t){const[i,s,a,d,p]=await Promise.all([J4(e),nN(e),eN(e),tN(e),iN(e)]);wN(i),CN(s),EN(a),kN(d);for(const c of s)Wh(t,c.sessionId,E_(c));PN(p.operations,t)}function PN(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function zN(e,t){await new Promise(i=>{const s=()=>{clearTimeout(a),t.removeEventListener("abort",s),i()},a=setTimeout(s,e);t.addEventListener("abort",s)})}const HN=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function $N(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 FN(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function UN(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 PC(e){if(e)return HN.has(e)?e:void 0}function WN(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function gd(e){return e==="err"||e==="error"}function yc(e,t){return!Eo(e)&&WN(t)}function k_(e,t){return gd(e)?"error":e==="done"||e==="aborted"?e:Eo(t)?t:e}function GN(e,t){const i=new Set(e),s=t.filter(a=>i.has(a)?!1:(i.add(a),!0));return s.length===0?e:[...e,...s]}function qN(e,t,i){const s=new Map(e.map(d=>[d.jobId,d]));let a=!1;for(const d of t)s.get(d)?.expiresAt!==i&&(s.set(d,{jobId:d,expiresAt:i}),a=!0);return a?[...s.values()]:e}function KN(e,t,i){const s=new Set(t.map(d=>d.jobId)),a=e.filter(d=>d.expiresAt>i&&s.has(d.jobId));return a.length===e.length?e:a}function zC(e,t){const i=new Map(e.map(s=>[s.jobId,s]));return t.flatMap(s=>{const a=i.get(s);return a?[a]:[]})}function VN(e){const t=e.flatMap(a=>a.trackOrder.map(d=>({job:a,track:a.tracks[d]}))).filter(a=>!!a.track).sort((a,d)=>d.track.lastEventId-a.track.lastEventId),i=t.filter(({job:a,track:d})=>yc(a.status,d.status)),s=i.length>0?i:t;for(const{job:a,track:d}of s){if(d.latestLine)return{text:d.latestLine,thinking:!1};if(yc(a.status,d.status)&&d.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function YN(e,t,i){const s=new Set(e.map(d=>d.jobId)),a=zC(t,i.map(d=>d.jobId)).filter(d=>!s.has(d.jobId));return a.length===0?e:[...e,...a]}class HC extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function XN(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await $C(t),FC(await t.json(),t.status)}async function ZN(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await $C(i),FC(await i.json(),i.status)}async function $C(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 HC(e.status,t)}function FC(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean"||i.codexLaunchMode!=="acp"&&i.codexLaunchMode!=="app-server")throw new HC(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor,codexLaunchMode:i.codexLaunchMode}}const dg=new Set;let Gh={loading:!1,state:null,savingField:null,error:null},Eh=0;function UC(){return L.useSyncExternalStore(JN,Z1,Z1)}function Z1(){return Gh}function JN(e){return dg.add(e),()=>{dg.delete(e)}}async function QN(e){const t=++Eh;So({loading:!0,error:null});try{const i=await XN(e);if(t!==Eh)return;So({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==Eh)return;So({loading:!1,error:GC(i)})}}async function WC(e,t){const i=Gh.state;if(!i)return!1;Eh+=1;const s={...i,[e]:t},a=e==="enableMetaphor"?{enableMetaphor:s.enableMetaphor}:{codexLaunchMode:s.codexLaunchMode};So({state:s,savingField:e,error:null});try{const d=await ZN(a);return So({state:d,savingField:null,error:null}),!0}catch(d){return So({state:i,savingField:null,error:GC(d)}),!1}}function So(e){Gh={...Gh,...e};for(const t of dg)t()}function GC(e){return e instanceof Error?e.message:String(e)}const eO=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],tO="/plugins/terminal/agent/ticket",nO="/plugins/terminal/ws",nm="fleet-plugin.terminal.stream-dock-expanded",iO="fleet-plugin.terminal.stream-dock-collapsed",rO=56,sO=4e3,aO={...h4,step:1,defaultValue:14},oO="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",qC={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Xl(e.payload,"cliLabel")??void 0,render:e=>l.jsx(dO,{context:e})},KC={id:"agent-cli",title:"Agent CLI",render:()=>l.jsx(mO,{})},VC={id:"agent.attention",title:"Agent input waiting"},lO={id:"agent.ended",title:"Agent turn ended"},th={id:"terminal",operationKinds:[qC],settingsSections:[KC],notificationKinds:[VC,lO],install:e=>cO(e),closeOperation:async e=>{try{await aN(e)}finally{jC(e)}},launch:async({theaterId:e,kind:t})=>{const i=await rN(e,t.id);return Uh(i),IC(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?l.jsx(LO,{}):e.id==="codex"?l.jsx(MO,{}):l.jsx(RO,{})};function cO(e){return NN({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function YC(e,t){const i=L.useRef(null),s=L.useRef(!0),[a,d]=L.useState(!0),p=L.useCallback(h=>{s.current!==h&&(s.current=h,d(h))},[]);L.useEffect(()=>{const h=i.current;if(!h)return;const f=()=>{const g=h.scrollHeight-h.scrollTop-h.clientHeight;p(g<=rO)};return h.addEventListener("scroll",f,{passive:!0}),()=>h.removeEventListener("scroll",f)},[e,p]),L.useLayoutEffect(()=>{p(!0);const h=i.current;h&&(h.scrollTop=h.scrollHeight)},[e,p]),L.useLayoutEffect(()=>{const h=i.current;!h||!s.current||(h.scrollTop=h.scrollHeight)},[t]);const c=L.useCallback(()=>{const h=i.current;h&&(h.scrollTop=h.scrollHeight,h.focus({preventScroll:!0}),p(!0))},[p]);return{containerRef:i,pinned:a,jumpToLatest:c}}function uO(){const[e,t]=L.useState(()=>{try{return localStorage.removeItem(iO),localStorage.getItem(nm)==="true"}catch{return!1}}),i=L.useCallback(s=>{try{s?localStorage.setItem(nm,"true"):localStorage.removeItem(nm)}catch{}t(s)},[]);return[e,i]}function hO(e,t){const[i,s]=L.useState(Date.now);return L.useEffect(()=>{if(e===void 0||t!==void 0)return;const a=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(a)},[e,t]),e===void 0?"":$N((t??i)-e)}function dO({context:e}){const i=SN().sessions[e.operationId]??xO(e),[s,a]=L.useState(!1),[d,p]=L.useState([]),[c,h]=L.useState([]),f=L.useRef(null),g=L.useRef(null),m=L.useRef(null),S=L.useRef(new Set),C=BC(i),T=C.filter(A=>!Eo(A.status)),w=YN(T,C,c),_=zC(C,d),b=String(s),v=_.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),y=YC(b,v);L.useLayoutEffect(()=>{const A=S.current,N=C.filter(R=>A.has(R.jobId)&&Eo(R.status)).map(R=>R.jobId);S.current=new Set(T.map(R=>R.jobId)),N.length!==0&&h(R=>qN(R,N,Date.now()+sO))},[T,C]),L.useEffect(()=>{if(c.length===0)return;const A=Math.min(...c.map(R=>R.expiresAt)),N=window.setTimeout(()=>{h(R=>KN(R,C,Date.now()))},Math.max(0,A-Date.now()));return()=>window.clearTimeout(N)},[C,c]),L.useEffect(()=>{s&&p(A=>GN(A,T.map(N=>N.jobId)))},[T,s]);const k=L.useCallback(()=>{a(!1),p([]),m.current?.focus()},[]),M=L.useCallback(()=>{p(w.map(A=>A.jobId)),a(!0)},[w]);return L.useLayoutEffect(()=>{s&&f.current?.focus()},[s]),L.useEffect(()=>{if(!s)return;const A=N=>{if(N.key==="Escape"){N.stopPropagation(),k();return}if(N.key==="Tab"){const R=g.current;if(!R)return;const I=Array.from(R.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(q=>!q.hasAttribute("disabled")),Y=I[0],z=I[I.length-1];N.shiftKey&&document.activeElement===Y?(N.preventDefault(),z?.focus()):!N.shiftKey&&document.activeElement===z&&(N.preventDefault(),Y?.focus())}};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[s,k]),i.status==="dormant"?l.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{SO(i.sessionId)},children:[l.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),l.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):l.jsxs("div",{className:"agent-stream-host",children:[l.jsx(w_,{operationId:i.sessionId,ticketPath:tO,wsPath:nO,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>jC(i.sessionId)}),w.length>0?l.jsx(fO,{activeJobs:w,onOpenDetail:M,detailBtnRef:m}):null,s?l.jsxs("div",{ref:g,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[l.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:k}),l.jsxs("div",{className:"job-overlay-card",children:[l.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:k,children:"×"}),l.jsx("div",{ref:y.containerRef,className:"job-overlay-body",tabIndex:-1,children:_.length===0?l.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):_.map(A=>l.jsx(bO,{job:A},A.jobId))}),y.pinned?null:l.jsx("button",{type:"button",className:"follow-button",onClick:y.jumpToLatest,children:"↓ Follow"})]})]}):null]})}function fO({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[s,a]=uO(),d=e[0],p=hO(d?.startedAt,d?.finishedAt),c=e.reduce((A,N)=>A+UN(N),0),h=FN(c),f=e.length===1&&d?PC(d.ownerCarrierId):void 0,g=e.length===1&&d?d.label:void 0,m=e.length>1?`${e.length} carriers`:d?.ownerCarrierId??"Carrier",S=VN(e),C=e.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),T=`${s}:${e.map(A=>A.jobId).join(",")}`,{containerRef:w,pinned:_,jumpToLatest:b}=YC(T,C),v=e.some(A=>A.trackOrder.some(N=>{const R=A.tracks[N];return R?yc(A.status,R.status):!1})),y=e.some(A=>!Eo(A.status)),k=e.some(A=>A.status==="error"||A.trackOrder.some(N=>gd(A.tracks[N]?.status??""))),M=y?"job-dock-dot":k?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return l.jsxs("div",{className:"job-dock",children:[l.jsxs("div",{className:"job-dock-strip",children:[l.jsx("span",{className:M,"aria-hidden":"true"}),l.jsxs("span",{className:"job-dock-carrier",title:g,children:[f?l.jsx("span",{className:"job-dock-captain-dot","data-captain":f,"aria-hidden":"true"}):null,l.jsx("span",{className:"job-dock-captain-tag",children:m})]}),l.jsxs("span",{className:"job-dock-strip-line",style:s?{display:"none"}:void 0,"aria-hidden":"true",children:[S.thinking?l.jsx("span",{className:"thinking-chip",children:"thinking…"}):S.text,!s&&v&&S.text?l.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),l.jsxs("span",{className:"job-dock-meta",children:[p?l.jsx("span",{children:p}):null,h?l.jsx("span",{children:h}):null]}),l.jsx("button",{type:"button",className:"job-dock-grip","aria-label":s?"Collapse stream dock":"Expand stream dock","aria-expanded":s,onClick:()=>a(!s),children:s?"▼":"▲"}),l.jsx("button",{ref:i,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),l.jsxs("div",{className:`job-dock-body-wrap${s?"":" is-collapsed"}`,children:[l.jsxs("div",{ref:w,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&g?l.jsx("div",{className:"job-dock-row",children:l.jsx("span",{className:"job-dock-row-label",children:g})}):null,e.map(A=>{const N=e.length>1,R=!N&&A.trackOrder.length===1;return A.trackOrder.map(I=>{const Y=A.tracks[I];return Y?l.jsx(pO,{track:Y,job:A,multiJob:N,singleTrack:R},`${A.jobId}:${I}`):null})})]}),_?null:l.jsx("button",{type:"button",className:"follow-button",onClick:b,children:"↓ Follow"})]})]})}function pO({track:e,job:t,multiJob:i,singleTrack:s}){const a=yc(t.status,e.status),p=CO(e.text),c=!p&&a&&!!e.thought,h=a?wO(e):void 0,f=k_(e.status,t.status),g=i||!s,m=i?PC(t.ownerCarrierId):void 0;return l.jsxs("div",{className:"job-dock-row",children:[g?l.jsxs("span",{className:"job-dock-row-name",children:[m?l.jsx("span",{className:"job-dock-captain-dot","data-captain":m,"aria-hidden":"true"}):null,l.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,l.jsxs("span",{className:`job-dock-row-status${a?" job-dock-row-status--live":""}${gd(f)?" job-dock-row-status--error":""}`,children:[f,h?` · ${h}`:""]}),p?l.jsxs("span",{className:"job-dock-row-line",children:[p,a?l.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,c?l.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function mO(){const[e,t]=L.useState([]),[i,s]=L.useState(null),{renderer:a,font:d}=LC(),p=UC();return L.useEffect(()=>{const c=new AbortController;return Q4(c.signal).then(h=>t(h.clis)).catch(h=>{c.signal.aborted||s(h instanceof Error?h.message:String(h))}),()=>c.abort()},[]),l.jsxs(l.Fragment,{children:[l.jsx(gO,{}),l.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[l.jsx("div",{className:"agent-cli-head",children:l.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),l.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?l.jsx("p",{className:"settings-error",children:i}):null,l.jsx("div",{className:"agent-cli-list",children:e.map(c=>l.jsx(vO,{cli:c,codexLaunchMode:p.state?.codexLaunchMode,disabled:p.savingField!==null,onCodexLaunchModeChange:h=>{WC("codexLaunchMode",h)}},c.id))}),p.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:p.error}):null,l.jsx("p",{className:"global-settings-help",children:"Codex launch mode controls the unified-agent carrier protocol for new Codex sessions; it does not affect the interactive Codex TUI in terminal panels."}),l.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),l.jsx(EO,{terminalFont:d}),l.jsx(kO,{terminalRenderer:a})]})}function gO(){const e=UC(),t=e.state,i=e.savingField!==null;return L.useEffect(()=>{const s=new AbortController;return QN(s.signal),()=>s.abort()},[]),l.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?l.jsx(l.Fragment,{children:l.jsx(_O,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:i,onToggle:()=>{WC("enableMetaphor",!t.enableMetaphor)}})}):l.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),l.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function _O({title:e,help:t,onLabel:i,offLabel:s,value:a,disabled:d,onToggle:p}){return l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:e}),l.jsx("p",{className:"global-settings-help",children:t})]}),l.jsx("button",{type:"button",className:`global-settings-toggle ${a?"is-on":""}`,disabled:d,"aria-pressed":a,onClick:p,children:l.jsx("span",{children:a?i:s})})]})}function vO({cli:e,codexLaunchMode:t,disabled:i,onCodexLaunchModeChange:s}){return l.jsxs("div",{className:"agent-cli-row",children:[l.jsx("span",{className:"agent-cli-name",children:e.displayName}),l.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?l.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[l.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:i,onClick:()=>s("acp"),children:"ACP"}),l.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:i,onClick:()=>s("app-server"),children:"App Server"})]}):null,e.available&&e.version?l.jsx("span",{className:"agent-cli-version",children:e.version}):null,l.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function bO({job:e}){return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"job-overlay-head",children:[l.jsx("span",{className:"job-overlay-kicker",children:e.status}),l.jsx("strong",{children:e.label??e.jobId})]}),l.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const i=e.tracks[t];return i?l.jsx(yO,{track:i,jobStatus:e.status},i.trackId):null})})]})}function yO({track:e,jobStatus:t}){const i=AO(e.status,t),s=i==="track-card--live",a=k_(e.status,t);return l.jsxs("article",{className:i?`track-card ${i}`:"track-card",children:[l.jsxs("header",{className:"track-card-head",children:[l.jsx("span",{className:"track-card-title",children:e.displayName}),l.jsx("span",{className:"track-card-status",children:a})]}),e.thought?l.jsxs("details",{className:"track-card-thinking",children:[l.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),l.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:l.jsx("pre",{children:e.thought})})]}):null,e.text?l.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[l.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),l.jsxs("pre",{children:[e.text,s?l.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?l.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?l.jsx("ul",{className:"track-card-tools",children:e.tools.map(d=>l.jsx("li",{children:d.name??d.id},d.id))}):null]})}async function SO(e){Uh(await sN(e)),IC(e)}function xO(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Xl(e.operation.payload,"cliId")??void 0,cliLabel:Xl(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Xl(e.operation.payload,"tenantId")??void 0,registrationId:Xl(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Xl(e,t){const i=e[t];return typeof i=="string"?i:null}function wO(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 CO(e){const t=e.trim();if(!t)return"";const i=t.split(`
|
|
91
|
+
`);return i[i.length-1]?.trim()??""}function EO({terminalFont:e}){const[t,i]=L.useState([]),[s,a]=L.useState(!0),[d,p]=L.useState(null),c=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??bo.id:bo.id}:{source:"system",familyName:e.customName};L.useEffect(()=>{const f=new AbortController;return a(!0),p(null),Jw({signal:f.signal}).then(g=>{f.signal.aborted||i(g.fonts.filter(m=>m.monospace).map(m=>({family:m.family,monospace:m.monospace})))}).catch(g=>{f.signal.aborted||TO(g)||(i([]),p("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||a(!1)}),()=>f.abort()},[]);const h=f=>{if(f.source==="system"){S4(f.familyName);return}const g=_c.find(m=>m.id===f.id);g&&y4(g.id)};return l.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[l.jsx("div",{className:"global-settings-row",children:l.jsxs("div",{className:"global-settings-row-text",children:[l.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",l.jsx("span",{className:"new-badge",children:"New"})]}),l.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),l.jsx("div",{"aria-describedby":"terminal-font-help",children:l.jsx(Xw,{builtIns:_c.map(f=>({id:f.id,label:f.name,family:f.family,aliases:[f.familyName],description:f.meta})),installedFonts:t,selected:c,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:bo.family,previewText:oO,size:e.size,sizeRange:aO,loading:s,error:d,onSelectionChange:h,onSizeCommit:x4})}),l.jsx("p",{className:"global-settings-foot",children:"Font preferences apply immediately and are stored on the Console server, separate from session settings and shared across browsers after restart."})]})}function kO({terminalRenderer:e}){return l.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),l.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."})]}),l.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:eO.map(t=>{const i=t.id===e;return l.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>b4(t.id),children:t.label},t.id)})})]})})}function TO(e){return e instanceof DOMException&&e.name==="AbortError"}function AO(e,t){if(yc(t,e))return"track-card--live";const i=k_(e,t);return gd(i)?"track-card--bad":i==="done"||i==="aborted"?"track-card--idle":""}function RO(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function LO(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 MO(){return l.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:l.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 NO="global-shell",OO="/plugins/terminal/global/ticket",DO="/plugins/terminal/ws",jO=168,IO={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},BO={id:"global-shell",title:"Shell",icon:PO,preferredExtraWidth:jO,render:e=>l.jsx("div",{style:IO,children:l.jsx(w_,{operationId:NO,ticketPath:OO,wsPath:DO,theme:"instrument",active:!0})})};function PO(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const zO="/plugins/terminal/shell/ticket",HO="/plugins/terminal/ws",XC={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>L.createElement($O,{context:e})},im={id:"terminal",operationKinds:[XC],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:()=>l.jsx(FO,{})};function $O({context:e}){return l.jsx(w_,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:zO,wsPath:HO,theme:e.theme,onExit:e.onClose})}function FO(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),l.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 UO=new Set(["agent"]),WO={id:"terminal",operationKinds:[XC,qC],settingsSections:[KC],notificationKinds:[VC],railPanels:[BO],install:e=>(MC(),v4(e.settings),th.install?.(e)),closeOperation:async e=>{const t=await qO(e);if(t?.type==="shell"){await im.closeOperation?.(e);return}t&&UO.has(t.type)&&await th.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?im.launch?.(e)??{id:""}:th.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?im.renderLaunchIcon?.(e):th.renderLaunchIcon?.(e)},GO=[WO];async function qO(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 se={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"},KO={src:se.ts,lib:se.ts,app:se.ts,test:se.shell,tests:se.shell,__tests__:se.shell,spec:se.shell,specs:se.shell,node_modules:se.binary,vendor:se.binary,dist:se.config,build:se.config,out:se.config,target:se.config,docs:se.md,doc:se.md,public:se.data,assets:se.data,static:se.data,components:se.image,scripts:se.js,styles:se.css,".git":se.html,".github":se.config,".vscode":se.css},J1={ts:{shape:"angle",tone:se.ts},tsx:{shape:"angle",tone:se.ts},mts:{shape:"angle",tone:se.ts},cts:{shape:"angle",tone:se.ts},"d.ts":{shape:"angle",tone:se.ts},js:{shape:"angle",tone:se.js},jsx:{shape:"angle",tone:se.js},mjs:{shape:"angle",tone:se.js},cjs:{shape:"angle",tone:se.js},json:{shape:"braces",tone:se.json},jsonc:{shape:"braces",tone:se.json},json5:{shape:"braces",tone:se.json},jsonl:{shape:"braces",tone:se.json},graphql:{shape:"braces",tone:se.image},gql:{shape:"braces",tone:se.image},proto:{shape:"braces",tone:se.go},css:{shape:"hash",tone:se.css},scss:{shape:"hash",tone:se.css},sass:{shape:"hash",tone:se.css},less:{shape:"hash",tone:se.css},styl:{shape:"hash",tone:se.css},html:{shape:"markup",tone:se.html},htm:{shape:"markup",tone:se.html},xml:{shape:"markup",tone:se.html},xhtml:{shape:"markup",tone:se.html},vue:{shape:"markup",tone:se.shell},svelte:{shape:"markup",tone:se.rust},astro:{shape:"markup",tone:se.image},md:{shape:"doc",tone:se.md},mdx:{shape:"doc",tone:se.md},markdown:{shape:"doc",tone:se.md},rst:{shape:"doc",tone:se.md},txt:{shape:"doc",tone:se.default},text:{shape:"doc",tone:se.default},log:{shape:"doc",tone:se.default},adoc:{shape:"doc",tone:se.md},pdf:{shape:"doc",tone:se.ruby},py:{shape:"angle",tone:se.py},pyi:{shape:"angle",tone:se.py},pyw:{shape:"angle",tone:se.py},go:{shape:"angle",tone:se.go},rs:{shape:"angle",tone:se.rust},rb:{shape:"angle",tone:se.ruby},rake:{shape:"angle",tone:se.ruby},gemspec:{shape:"angle",tone:se.ruby},java:{shape:"angle",tone:se.html},kt:{shape:"angle",tone:se.config},kts:{shape:"angle",tone:se.config},scala:{shape:"angle",tone:se.ruby},c:{shape:"angle",tone:se.ts},h:{shape:"angle",tone:se.ts},cpp:{shape:"angle",tone:se.css},cc:{shape:"angle",tone:se.css},cxx:{shape:"angle",tone:se.css},hpp:{shape:"angle",tone:se.css},cs:{shape:"angle",tone:se.config},php:{shape:"angle",tone:se.config},swift:{shape:"angle",tone:se.html},lua:{shape:"angle",tone:se.ts},dart:{shape:"angle",tone:se.go},sh:{shape:"terminal",tone:se.shell},bash:{shape:"terminal",tone:se.shell},zsh:{shape:"terminal",tone:se.shell},fish:{shape:"terminal",tone:se.shell},ps1:{shape:"terminal",tone:se.css},bat:{shape:"terminal",tone:se.shell},cmd:{shape:"terminal",tone:se.shell},yaml:{shape:"gear",tone:se.config},yml:{shape:"gear",tone:se.config},toml:{shape:"gear",tone:se.config},ini:{shape:"gear",tone:se.config},conf:{shape:"gear",tone:se.config},cfg:{shape:"gear",tone:se.config},properties:{shape:"gear",tone:se.config},env:{shape:"gear",tone:se.config},editorconfig:{shape:"gear",tone:se.config},png:{shape:"image",tone:se.image},jpg:{shape:"image",tone:se.image},jpeg:{shape:"image",tone:se.image},gif:{shape:"image",tone:se.image},webp:{shape:"image",tone:se.image},svg:{shape:"image",tone:se.image},ico:{shape:"image",tone:se.image},bmp:{shape:"image",tone:se.image},avif:{shape:"image",tone:se.image},tiff:{shape:"image",tone:se.image},heic:{shape:"image",tone:se.image},mp4:{shape:"image",tone:se.data},mov:{shape:"image",tone:se.data},webm:{shape:"image",tone:se.data},mkv:{shape:"image",tone:se.data},mp3:{shape:"chip",tone:se.shell},wav:{shape:"chip",tone:se.shell},flac:{shape:"chip",tone:se.shell},ogg:{shape:"chip",tone:se.shell},sql:{shape:"database",tone:se.data},csv:{shape:"database",tone:se.data},tsv:{shape:"database",tone:se.data},db:{shape:"database",tone:se.data},sqlite:{shape:"database",tone:se.data},sqlite3:{shape:"database",tone:se.data},parquet:{shape:"database",tone:se.data},zip:{shape:"archive",tone:se.archive},tar:{shape:"archive",tone:se.archive},gz:{shape:"archive",tone:se.archive},tgz:{shape:"archive",tone:se.archive},bz2:{shape:"archive",tone:se.archive},xz:{shape:"archive",tone:se.archive},rar:{shape:"archive",tone:se.archive},"7z":{shape:"archive",tone:se.archive},zst:{shape:"archive",tone:se.archive},bin:{shape:"chip",tone:se.binary},exe:{shape:"chip",tone:se.binary},dll:{shape:"chip",tone:se.binary},so:{shape:"chip",tone:se.binary},dylib:{shape:"chip",tone:se.binary},wasm:{shape:"chip",tone:se.config},class:{shape:"chip",tone:se.binary},lock:{shape:"chip",tone:se.binary},woff:{shape:"chip",tone:se.config},woff2:{shape:"chip",tone:se.config},ttf:{shape:"chip",tone:se.config},otf:{shape:"chip",tone:se.config}},VO={dockerfile:{shape:"chip",tone:se.css},"docker-compose.yml":{shape:"gear",tone:se.css},"docker-compose.yaml":{shape:"gear",tone:se.css},makefile:{shape:"gear",tone:se.html},"cmakelists.txt":{shape:"gear",tone:se.html},".gitignore":{shape:"gear",tone:se.html},".gitattributes":{shape:"gear",tone:se.html},".dockerignore":{shape:"gear",tone:se.html},".npmignore":{shape:"gear",tone:se.html},".npmrc":{shape:"gear",tone:se.ruby},"package.json":{shape:"braces",tone:se.shell},"tsconfig.json":{shape:"braces",tone:se.ts},license:{shape:"doc",tone:se.json},"license.md":{shape:"doc",tone:se.json},licence:{shape:"doc",tone:se.json}},YO={shape:"default",tone:se.default},fg={angle:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),l.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"}),l.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),l.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),l.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),l.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"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:l.jsxs(l.Fragment,{children:[l.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),l.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"}),l.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.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:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),l.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"}),l.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),l.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:l.jsxs(l.Fragment,{children:[l.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),l.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),l.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.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:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:l.jsxs(l.Fragment,{children:[l.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"}),l.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:l.jsxs(l.Fragment,{children:[l.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"}),l.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"}),l.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"}),l.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 XO({name:e}){const t=JO(e);return l.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:fg[t.shape]})}function ZO({name:e,open:t}){const i=KO[e.toLowerCase()]??se.folder;return l.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?fg.folderOpen:fg.folderClosed})}function JO(e){const t=e.toLowerCase(),i=VO[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:se.config};if(t.startsWith("readme"))return{shape:"doc",tone:se.md};if(t.endsWith(".d.ts"))return J1["d.ts"];const s=t.lastIndexOf(".");if(s>0&&s<t.length-1){const a=t.slice(s+1),d=J1[a];if(d)return d}return YO}function QO(e,t){return`${e??""}:${t??""}`}function pg(e,t){const i=qh(t);if(i===null)return null;const s=e?qh(e):"";return s===null?null:s?i?`${s}/${i}`:s:i}function kh(e,t){const i=qh(t),s=e?qh(e):"";return i===null||s===null?null:s?i===s?"":i.startsWith(`${s}/`)?i.slice(s.length+1):null:i}function ZC(e,t){const i=kh(e,t.relativePath);if(i===null)return null;const s=i===""||t.parentRelativePath===null?null:kh(e,t.parentRelativePath);if(i!==""&&t.parentRelativePath!==null&&s===null)return null;const a=[];for(const d of t.entries){const p=kh(e,d.relativePath);p!==null&&a.push({...d,relativePath:p})}return{...t,relativePath:i,parentRelativePath:s,entries:a}}function eD(e,t){return kh(e,t)}function qh(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const i of e.replaceAll("\\","/").split("/"))if(!(!i||i===".")){if(i==="..")return null;t.push(i)}return t.join("/")}const tD=200,nh=30,Q1=5,JC="fleet-console.fileExplorer.showHidden",eS=500;function tr(e,t){return e===t}async function nD({entries:e,cachedResults:t,files:i,showHidden:s,isCurrent:a,onFolderResult:d}){const p=[],c=new Map(t),h=new Set,f=new Set;let g=0;const m=S=>{for(const C of S)if(!(!rD(C,s)||h.has(C.relativePath))){if(h.size>=eS)return;h.add(C.relativePath),p.push(C)}};for(m(e);p.length>0&&a();){const S=p.shift();if(!S)return;const C=c.get(S.relativePath);if(C){if(f.has(C.relativePath))continue;f.add(C.relativePath),m(C.entries);continue}if(g>=eS)return;g+=1;try{const T=await i.listFolder(S.relativePath);if(!a())return;if(c.set(S.relativePath,T),d(S.relativePath,T),f.has(T.relativePath))continue;f.add(T.relativePath),m(T.entries)}catch{}}}function QC(e,t,i,s,a,d,p,c,h=new Set){const f=[];for(const g of e){if(!c&&g.name.startsWith("."))continue;const m=d.get(g.relativePath),S=m?.entries,C=m?.relativePath??g.relativePath,T=g.kind==="dir"&&h.has(C),w=g.kind==="dir"&&!T&&e2(S??[],d,p,c);if(p&&!g.name.toLowerCase().includes(p)&&!w)continue;const _=s.has(g.relativePath)||!!(p&&w);if(f.push({entry:g,depth:t,isSelected:i===g.relativePath,isExpanded:_,isLoading:a.has(g.relativePath)}),g.kind==="dir"&&_&&!T&&S){const b=new Set(h);b.add(C),f.push(...QC(S,t+1,i,s,a,d,p,c,b))}}return f}function iD({contextKey:e,contextRelPath:t,files:i,theaterId:s,selectedPath:a,onSelect:d}){const[p,c]=L.useState(null),[h,f]=L.useState(null),[g,m]=L.useState(""),[S,C]=L.useState(new Set),[T,w]=L.useState(new Set),[_,b]=L.useState(new Map),[v,y]=L.useState(""),[k,M]=L.useState(0),[A,N]=L.useState(600),[R,I]=L.useState(()=>sD()),Y=L.useRef(null),z=L.useRef(S);z.current=S;const q=L.useRef(g);q.current=g;const B=L.useRef(i);B.current=i;const W=L.useRef(e);W.current=e;const F=L.useRef(_);F.current=_;const P=L.useRef(0),K=!!v;L.useEffect(()=>{s&&(c(null),f(null),m(""),C(new Set),b(new Map),y(""),M(0))},[e,s]),L.useEffect(()=>{if(!s)return;const de=e;i.listFolder(g||void 0).then(Ce=>{tr(de,W.current)&&(c(Ce),f(null))}).catch(Ce=>{tr(de,W.current)&&f(Ce instanceof Error?Ce.message:"Unable to load folder")})},[e,s,g,i]),L.useEffect(()=>{const de=++P.current;if(!K||!p)return;let Ce=!0;const Le=e,Me=()=>Ce&&de===P.current&&tr(Le,W.current);return nD({entries:p.entries,cachedResults:F.current,files:i,showHidden:R,isCurrent:Me,onFolderResult:(qe,ke)=>{Me()&&b(ye=>new Map(ye).set(qe,ke))}}),()=>{Ce=!1}},[e,i,K,p,R]),L.useEffect(()=>{const de=Y.current;if(!de)return;const Ce=new ResizeObserver(()=>N(de.clientHeight));return Ce.observe(de),N(de.clientHeight),()=>Ce.disconnect()},[]),L.useEffect(()=>{if(!s)return;let de=!0;const Ce=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(s)}`,Le=new EventSource(Ce),Me=()=>{const ke=e;B.current.listFolder(q.current||void 0).then(ye=>{tr(ke,W.current)&&(c(ye),f(null))}).catch(()=>{})},qe=()=>{Me();for(const ke of z.current){const ye=e;B.current.listFolder(ke).then(Oe=>{tr(ye,W.current)&&b(wt=>new Map(wt).set(ke,Oe))}).catch(()=>{})}};return Le.addEventListener("change",ke=>{let ye;try{ye=JSON.parse(ke.data)}catch{return}if(typeof ye!="string")return;const Oe=eD(t,ye);if(Oe!==null&&((Oe===""||Oe===q.current)&&Me(),Oe!==""&&z.current.has(Oe))){const wt=e;B.current.listFolder(Oe).then(On=>{tr(wt,W.current)&&b(Xn=>new Map(Xn).set(Oe,On))}).catch(()=>{})}}),Le.onopen=()=>{if(de){de=!1;return}qe()},()=>{Le.close()}},[t,s,i]);const X=L.useCallback(de=>{const Ce=de.relativePath,Le=!S.has(Ce);if(C(Me=>{const qe=new Set(Me);return qe.has(Ce)?(qe.delete(Ce),qe):(qe.add(Ce),qe)}),Le){const Me=e;w(qe=>new Set(qe).add(Ce)),i.listFolder(Ce).then(qe=>{tr(Me,W.current)&&(b(ke=>new Map(ke).set(Ce,qe)),w(ke=>{const ye=new Set(ke);return ye.delete(Ce),ye}))}).catch(()=>{tr(Me,W.current)&&w(qe=>{const ke=new Set(qe);return ke.delete(Ce),ke})})}},[e,i,S]),O=L.useCallback(de=>{de.kind==="dir"?X(de):d(de)},[X,d]),H=L.useCallback(de=>{M(de.currentTarget.scrollTop)},[]),j=L.useCallback(()=>{I(de=>{const Ce=!de;try{localStorage.setItem(JC,Ce?"1":"0")}catch{}return Ce})},[]),G=L.useCallback(()=>{if(!s)return;const de=e;i.listFolder(g||void 0).then(Ce=>{tr(de,W.current)&&(c(Ce),f(null))}).catch(Ce=>{tr(de,W.current)&&f(Ce instanceof Error?Ce.message:"Unable to load folder")});for(const Ce of S)i.listFolder(Ce).then(Le=>{tr(de,W.current)&&b(Me=>new Map(Me).set(Ce,Le))}).catch(()=>{})},[e,i,g,S,s]),V=v.toLowerCase(),ne=L.useMemo(()=>p?QC(p.entries,0,a,S,T,_,V,R):[],[p,a,S,T,_,V,R]),ie=!R&&p!==null&&p.entries.length>0&&ne.length===0&&!v,ve=ne.length>tD,ee=ve?Math.max(0,Math.floor(k/nh)-Q1):0,$=ve?Math.min(ne.length,Math.ceil((k+A)/nh)+Q1):ne.length,ae=ne.slice(ee,$),ge=ne.length*nh,we=ee*nh;return s?h&&!p?l.jsx("div",{className:"fexp-tree-error",children:h}):p?l.jsxs("div",{className:"fexp-tree-container",children:[l.jsxs("div",{className:"fexp-filter",children:[l.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:v,onChange:de=>y(de.target.value),"aria-label":"Filter files"}),v&&l.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>y(""),"aria-label":"Clear filter",children:"✕"}),l.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:G,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),l.jsx("button",{type:"button",className:`fexp-hidden-toggle${R?" is-active":""}`,onClick:j,"aria-pressed":R,"aria-label":R?"Hide hidden files":"Show hidden files",title:R?"Hide hidden files":"Show hidden files",children:R?l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[l.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[l.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),l.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),l.jsxs("div",{ref:Y,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:ve?H:void 0,children:[!1,ve?l.jsx("div",{style:{height:ge,position:"relative"},children:l.jsx("div",{style:{transform:`translateY(${we}px)`},children:ae.map(de=>l.jsx(tS,{row:de,onEntryClick:O},de.entry.relativePath))})}):ae.map(de=>l.jsx(tS,{row:de,onEntryClick:O},de.entry.relativePath)),ne.length===0&&v&&l.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),ne.length===0&&!v&&p.entries.length===0&&l.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),ie&&l.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):l.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):l.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function e2(e,t,i,s,a=new Set){for(const d of e)if(!(!s&&d.name.startsWith("."))){if(d.name.toLowerCase().includes(i))return!0;if(d.kind==="dir"){const p=t.get(d.relativePath);if(p&&!a.has(p.relativePath)){const c=new Set(a);if(c.add(p.relativePath),e2(p.entries,t,i,s,c))return!0}}}return!1}function rD(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function tS({row:e,onEntryClick:t}){const{entry:i,depth:s,isSelected:a,isExpanded:d,isLoading:p}=e,c=i.kind==="dir",h=s*16,f=L.useCallback(()=>t(i),[i,t]);return l.jsxs("button",{className:`fexp-tree-row${a?" is-cur":""}${c?" is-dir":" is-file"}`,style:{paddingLeft:`${h+12}px`},type:"button",role:"treeitem","aria-selected":a,"aria-expanded":c?d:void 0,onClick:f,children:[l.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:c?l.jsx(ZO,{name:i.name,open:d}):l.jsx(XO,{name:i.name})}),l.jsx("span",{className:"fexp-tree-name",children:i.name}),p&&l.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function sD(){try{return localStorage.getItem(JC)==="1"}catch{return!1}}function aD({name:e,sizeHint:t}){return l.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[l.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),l.jsx("p",{className:"fexp-bin-name",children:e}),t&&l.jsx("p",{className:"fexp-bin-meta",children:t}),l.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function oD(e,t){switch(t){case"typescript":case"javascript":return cD(e);case"json":return uD(e);case"python":return dD(e);case"css":case"scss":case"sass":case"less":return fD(e);case"html":case"xml":return pD(e);case"bash":case"shell":return mD(e);case"yaml":return gD(e);default:return[{kind:"text",value:e}]}}const lD=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 cD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),a=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
|
|
92
|
+
`,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==="`"){const{slice:s,length:a}=Ds(e,i,"`","`");t.push({kind:"str",value:s}),i+=a;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;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 a=s[0],d=e.slice(i+a.length).match(/^\s*\(/);lD.has(a)?t.push({kind:"key",value:a}):d?t.push({kind:"fn",value:a}):t.push({kind:"text",value:a}),i+=a.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 uD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:s,length:a}=Ds(e,i,'"','"'),p=e.slice(i+a).trimStart().startsWith(":");t.push({kind:p?"attr":"str",value:s}),i+=a;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 hD=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 dD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
|
|
93
|
+
`,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith('"""',i)||e.startsWith("'''",i)){const s=e.slice(i,i+3),a=e.indexOf(s,i+3),d=a===-1?e.slice(i):e.slice(i,a+3);t.push({kind:"str",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;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 a=s[0],d=e.slice(i+a.length).match(/^\s*\(/);hD.has(a)?t.push({kind:"key",value:a}):d?t.push({kind:"fn",value:a}):t.push({kind:"text",value:a}),i+=a.length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function fD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),a=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:a}),i+=a.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
|
|
94
|
+
`,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;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 a=s[0];e.slice(i+a.length).trimStart().startsWith(":")?t.push({kind:"attr",value:a}):t.push({kind:"text",value:a}),i+=a.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 pD(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("<!--",i)){const s=e.indexOf("-->",i+4),a=s===-1?e.slice(i):e.slice(i,s+3);t.push({kind:"com",value:a}),i+=a.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:a}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;continue}if(/[a-zA-Z]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);if(s){const a=e.slice(i+s[0].length).trimStart();t.push({kind:a.startsWith("=")?"attr":"text",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function mD(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 a=e.indexOf(`
|
|
95
|
+
`,i),d=a===-1?e.slice(i):e.slice(i,a);t.push({kind:"com",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:a,length:d}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:a}),i+=d;continue}if(/[a-zA-Z_]/.test(e[i])){const a=e.slice(i).match(/^[a-zA-Z_][\w]*/);if(a){t.push({kind:s.has(a[0])?"key":"text",value:a[0]}),i+=a[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function gD(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
|
|
96
|
+
`,i),a=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:a}),i+=a.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:a}=Ds(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=a;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 Ds(e,t,i,s){let a=t+i.length;for(;a<e.length;){if(e[a]==="\\"){a+=2;continue}if(e.startsWith(s,a)){a+=s.length;break}if(s!=="`"&&e[a]===`
|
|
97
|
+
`)break;a++}return{slice:e.slice(t,a),length:a-t}}function _D({content:e,lang:t,truncated:i}){const s=L.useMemo(()=>vD(e,t),[e,t]);return l.jsxs("div",{className:"fexp-code-wrap",children:[i&&l.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),l.jsx("div",{className:"fexp-code-scroll",children:l.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:l.jsx("tbody",{children:s.map((a,d)=>l.jsxs("tr",{className:"fexp-code-row",children:[l.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:d+1}),l.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:a}})]},d))})})})]})}function vD(e,t){return e.split(`
|
|
98
|
+
`).map(s=>bD(s,t))}function bD(e,t){return t==="plaintext"||t==="markdown"?nS(e)||" ":oD(e,t).map(s=>{const a=nS(s.value);return s.kind==="text"?a:`<span class="syn-${s.kind}">${a}</span>`}).join("")||" "}function nS(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function yD({src:e,name:t}){return l.jsxs("div",{className:"fexp-img-wrap",children:[l.jsx("div",{className:"fexp-img-stage",children:l.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),l.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function T_(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _a=T_();function t2(e){_a=e}var sc={exec:()=>null};function St(e,t=""){let i=typeof e=="string"?e:e.source,s={replace:(a,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(ri.caret,"$1"),i=i.replace(a,p),s},getRegex:()=>new RegExp(i,t)};return s}var SD=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ri={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")},xD=/^(?:[ \t]*(?:\n|$))+/,wD=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,CD=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Oc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ED=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,A_=/(?:[*+-]|\d{1,9}[.)])/,n2=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,i2=St(n2).replace(/bull/g,A_).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(),kD=St(n2).replace(/bull/g,A_).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(),R_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,TD=/^[^\n]+/,L_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,AD=St(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",L_).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),RD=St(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,A_).getRegex(),_d="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",M_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,LD=St("^ {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",M_).replace("tag",_d).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),r2=St(R_).replace("hr",Oc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_d).getRegex(),MD=St(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",r2).getRegex(),N_={blockquote:MD,code:wD,def:AD,fences:CD,heading:ED,hr:Oc,html:LD,lheading:i2,list:RD,newline:xD,paragraph:r2,table:sc,text:TD},iS=St("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Oc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_d).getRegex(),ND={...N_,lheading:kD,table:iS,paragraph:St(R_).replace("hr",Oc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",iS).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",_d).getRegex()},OD={...N_,html:St(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",M_).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:sc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:St(R_).replace("hr",Oc).replace("heading",` *#{1,6} *[^
|
|
99
|
+
]`).replace("lheading",i2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},DD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,s2=/^( {2,}|\\)\n(?!\s*$)/,ID=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,vd=/[\p{P}\p{S}]/u,O_=/[\s\p{P}\p{S}]/u,a2=/[^\s\p{P}\p{S}]/u,BD=St(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,O_).getRegex(),o2=/(?!~)[\p{P}\p{S}]/u,PD=/(?!~)[\s\p{P}\p{S}]/u,zD=/(?:[^\s\p{P}\p{S}]|~)/u,HD=St(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",SD?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),l2=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,$D=St(l2,"u").replace(/punct/g,vd).getRegex(),FD=St(l2,"u").replace(/punct/g,o2).getRegex(),c2="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",UD=St(c2,"gu").replace(/notPunctSpace/g,a2).replace(/punctSpace/g,O_).replace(/punct/g,vd).getRegex(),WD=St(c2,"gu").replace(/notPunctSpace/g,zD).replace(/punctSpace/g,PD).replace(/punct/g,o2).getRegex(),GD=St("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,a2).replace(/punctSpace/g,O_).replace(/punct/g,vd).getRegex(),qD=St(/\\(punct)/,"gu").replace(/punct/g,vd).getRegex(),KD=St(/^<(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(),VD=St(M_).replace("(?:-->|$)","-->").getRegex(),YD=St("^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",VD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,XD=St(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Kh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),u2=St(/^!?\[(label)\]\[(ref)\]/).replace("label",Kh).replace("ref",L_).getRegex(),h2=St(/^!?\[(ref)\](?:\[\])?/).replace("ref",L_).getRegex(),ZD=St("reflink|nolink(?!\\()","g").replace("reflink",u2).replace("nolink",h2).getRegex(),rS=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,D_={_backpedal:sc,anyPunctuation:qD,autolink:KD,blockSkip:HD,br:s2,code:jD,del:sc,emStrongLDelim:$D,emStrongRDelimAst:UD,emStrongRDelimUnd:GD,escape:DD,link:XD,nolink:h2,punctuation:BD,reflink:u2,reflinkSearch:ZD,tag:YD,text:ID,url:sc},JD={...D_,link:St(/^!?\[(label)\]\((.*?)\)/).replace("label",Kh).getRegex(),reflink:St(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kh).getRegex()},mg={...D_,emStrongRDelimAst:WD,emStrongLDelim:FD,url:St(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",rS).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:St(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",rS).getRegex()},QD={...mg,br:St(s2).replace("{2,}","*").getRegex(),text:St(mg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ih={normal:N_,gfm:ND,pedantic:OD},Il={normal:D_,gfm:mg,breaks:QD,pedantic:JD},ej={"&":"&","<":"<",">":">",'"':""","'":"'"},sS=e=>ej[e];function _r(e,t){if(t){if(ri.escapeTest.test(e))return e.replace(ri.escapeReplace,sS)}else if(ri.escapeTestNoEncode.test(e))return e.replace(ri.escapeReplaceNoEncode,sS);return e}function aS(e){try{e=encodeURI(e).replace(ri.percentDecode,"%")}catch{return null}return e}function oS(e,t){let i=e.replace(ri.findPipe,(d,p,c)=>{let h=!1,f=p;for(;--f>=0&&c[f]==="\\";)h=!h;return h?"|":" |"}),s=i.split(ri.splitPipe),a=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(;a<s.length;a++)s[a]=s[a].trim().replace(ri.slashPipe,"|");return s}function Bl(e,t,i){let s=e.length;if(s===0)return"";let a=0;for(;a<s&&e.charAt(s-a-1)===t;)a++;return e.slice(0,s-a)}function tj(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 lS(e,t,i,s,a){let d=t.href,p=t.title||null,c=e[1].replace(a.other.outputLinkReplace,"$1");s.state.inLink=!0;let h={type:e[0].charAt(0)==="!"?"image":"link",raw:i,href:d,title:p,text:c,tokens:s.inlineTokens(c)};return s.state.inLink=!1,h}function nj(e,t,i){let s=e.match(i.other.indentCodeCompensation);if(s===null)return t;let a=s[1];return t.split(`
|
|
100
|
+
`).map(d=>{let p=d.match(i.other.beginningSpace);if(p===null)return d;let[c]=p;return c.length>=a.length?d.slice(a.length):d}).join(`
|
|
101
|
+
`)}var Vh=class{options;rules;lexer;constructor(e){this.options=e||_a}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:Bl(i,`
|
|
102
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],s=nj(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=Bl(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:Bl(t[0],`
|
|
103
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=Bl(t[0],`
|
|
104
|
+
`).split(`
|
|
105
|
+
`),s="",a="",d=[];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 f=c.join(`
|
|
106
|
+
`),g=f.replace(this.rules.other.blockquoteSetextReplace,`
|
|
107
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
108
|
+
${f}`:f,a=a?`${a}
|
|
109
|
+
${g}`:g;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,d,!0),this.lexer.state.top=m,i.length===0)break;let S=d.at(-1);if(S?.type==="code")break;if(S?.type==="blockquote"){let C=S,T=C.raw+`
|
|
110
|
+
`+i.join(`
|
|
111
|
+
`),w=this.blockquote(T);d[d.length-1]=w,s=s.substring(0,s.length-C.raw.length)+w.raw,a=a.substring(0,a.length-C.text.length)+w.text;break}else if(S?.type==="list"){let C=S,T=C.raw+`
|
|
112
|
+
`+i.join(`
|
|
113
|
+
`),w=this.list(T);d[d.length-1]=w,s=s.substring(0,s.length-S.raw.length)+w.raw,a=a.substring(0,a.length-C.raw.length)+w.raw,i=T.substring(d.at(-1).raw.length).split(`
|
|
114
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:d,text:a}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim(),s=i.length>1,a={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 d=this.rules.other.listItemRegex(i),p=!1;for(;e;){let h=!1,f="",g="";if(!(t=d.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let m=t[2].split(`
|
|
115
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),S=e.split(`
|
|
116
|
+
`,1)[0],C=!m.trim(),T=0;if(this.options.pedantic?(T=2,g=m.trimStart()):C?T=t[1].length+1:(T=t[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,g=m.slice(T),T+=t[1].length),C&&this.rules.other.blankLine.test(S)&&(f+=S+`
|
|
117
|
+
`,e=e.substring(S.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(T),v=this.rules.other.hrRegex(T),y=this.rules.other.fencesBeginRegex(T),k=this.rules.other.headingBeginRegex(T),M=this.rules.other.htmlBeginRegex(T);for(;e;){let A=e.split(`
|
|
118
|
+
`,1)[0],N;if(S=A,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),N=S):N=S.replace(this.rules.other.tabCharGlobal," "),y.test(S)||k.test(S)||M.test(S)||b.test(S)||v.test(S))break;if(N.search(this.rules.other.nonSpaceChar)>=T||!S.trim())g+=`
|
|
119
|
+
`+N.slice(T);else{if(C||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(m)||k.test(m)||v.test(m))break;g+=`
|
|
120
|
+
`+S}!C&&!S.trim()&&(C=!0),f+=A+`
|
|
121
|
+
`,e=e.substring(A.length+1),m=N.slice(T)}}a.loose||(p?a.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(p=!0));let w=null,_;this.options.gfm&&(w=this.rules.other.listIsTask.exec(g),w&&(_=w[0]!=="[ ] ",g=g.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:f,task:!!w,checked:_,loose:!1,text:g,tokens:[]}),a.raw+=f}let c=a.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let h=0;h<a.items.length;h++)if(this.lexer.state.top=!1,a.items[h].tokens=this.lexer.blockTokens(a.items[h].text,[]),!a.loose){let f=a.items[h].tokens.filter(m=>m.type==="space"),g=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));a.loose=g}if(a.loose)for(let h=0;h<a.items.length;h++)a.items[h].loose=!0;return a}}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"):"",a=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:a}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=oS(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
122
|
+
`):[],d={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(let p of s)this.rules.other.tableAlignRight.test(p)?d.align.push("right"):this.rules.other.tableAlignCenter.test(p)?d.align.push("center"):this.rules.other.tableAlignLeft.test(p)?d.align.push("left"):d.align.push(null);for(let p=0;p<i.length;p++)d.header.push({text:i[p],tokens:this.lexer.inline(i[p]),header:!0,align:d.align[p]});for(let p of a)d.rows.push(oS(p,d.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:d.align[h]})));return d}}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 d=Bl(i.slice(0,-1),"\\");if((i.length-d.length)%2===0)return}else{let d=tj(t[2],"()");if(d===-2)return;if(d>-1){let p=(t[0].indexOf("!")===0?5:4)+t[1].length+d;t[2]=t[2].substring(0,d),t[0]=t[0].substring(0,p).trim(),t[3]=""}}let s=t[2],a="";if(this.options.pedantic){let d=this.rules.other.pedanticHrefTitle.exec(s);d&&(s=d[1],a=d[3])}else a=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)),lS(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.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," "),a=t[s.toLowerCase()];if(!a){let d=i[0].charAt(0);return{type:"text",raw:d,text:d}}return lS(i,a,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 a=[...s[0]].length-1,d,p,c=a,h=0,f=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+a);(s=f.exec(t))!=null;){if(d=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!d)continue;if(p=[...d].length,s[3]||s[4]){c+=p;continue}else if((s[5]||s[6])&&a%3&&!((a+p)%3)){h+=p;continue}if(c-=p,c>0)continue;p=Math.min(p,p+c+h);let g=[...s[0]][0].length,m=e.slice(0,a+s.index+g+p);if(Math.min(a,p)%2){let C=m.slice(1,-1);return{type:"em",raw:m,text:C,tokens:this.lexer.inlineTokens(C)}}let S=m.slice(2,-2);return{type:"strong",raw:m,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(i),a=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return s&&a&&(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 a;do a=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(a!==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}}}},nr=class gg{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||_a,this.options.tokenizer=this.options.tokenizer||new Vh,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:ri,block:ih.normal,inline:Il.normal};this.options.pedantic?(i.block=ih.pedantic,i.inline=Il.pedantic):this.options.gfm&&(i.block=ih.gfm,this.options.breaks?i.inline=Il.breaks:i.inline=Il.gfm),this.tokenizer.rules=i}static get rules(){return{block:ih,inline:Il}}static lex(t,i){return new gg(i).lex(t)}static lexInline(t,i){return new gg(i).inlineTokens(t)}lex(t){t=t.replace(ri.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(ri.tabCharGlobal," ").replace(ri.spaceLine,""));t;){let a;if(this.options.extensions?.block?.some(p=>(a=p.call({lexer:this},t,i))?(t=t.substring(a.raw.length),i.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);let p=i.at(-1);a.raw.length===1&&p!==void 0?p.raw+=`
|
|
125
|
+
`:i.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
|
|
126
|
+
`)?"":`
|
|
127
|
+
`)+a.raw,p.text+=`
|
|
128
|
+
`+a.text,this.inlineQueue.at(-1).src=p.text):i.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
|
|
129
|
+
`)?"":`
|
|
130
|
+
`)+a.raw,p.text+=`
|
|
131
|
+
`+a.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},i.push(a));continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),i.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),i.push(a);continue}let d=t;if(this.options.extensions?.startBlock){let p=1/0,c=t.slice(1),h;this.options.extensions.startBlock.forEach(f=>{h=f.call({lexer:this},c),typeof h=="number"&&h>=0&&(p=Math.min(p,h))}),p<1/0&&p>=0&&(d=t.substring(0,p+1))}if(this.state.top&&(a=this.tokenizer.paragraph(d))){let p=i.at(-1);s&&p?.type==="paragraph"?(p.raw+=(p.raw.endsWith(`
|
|
132
|
+
`)?"":`
|
|
133
|
+
`)+a.raw,p.text+=`
|
|
134
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(a),s=d.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);let p=i.at(-1);p?.type==="text"?(p.raw+=(p.raw.endsWith(`
|
|
135
|
+
`)?"":`
|
|
136
|
+
`)+a.raw,p.text+=`
|
|
137
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(a);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,a=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let d;for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)d=a[2]?a[2].length:0,s=s.slice(0,a.index+d)+"["+"a".repeat(a[0].length-d-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(g=>(h=g.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 g=i.at(-1);h.type==="text"&&g?.type==="text"?(g.raw+=h.raw,g.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 f=t;if(this.options.extensions?.startInline){let g=1/0,m=t.slice(1),S;this.options.extensions.startInline.forEach(C=>{S=C.call({lexer:this},m),typeof S=="number"&&S>=0&&(g=Math.min(g,S))}),g<1/0&&g>=0&&(f=t.substring(0,g+1))}if(h=this.tokenizer.inlineText(f)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(c=h.raw.slice(-1)),p=!0;let g=i.at(-1);g?.type==="text"?(g.raw+=h.raw,g.text+=h.text):i.push(h);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return i}},Yh=class{options;parser;constructor(e){this.options=e||_a}space(e){return""}code({text:e,lang:t,escaped:i}){let s=(t||"").match(ri.notSpaceStart)?.[0],a=e.replace(ri.endingNewline,"")+`
|
|
138
|
+
`;return s?'<pre><code class="language-'+_r(s)+'">'+(i?a:_r(a,!0))+`</code></pre>
|
|
139
|
+
`:"<pre><code>"+(i?a:_r(a,!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 a=t?"ol":"ul",d=t&&i!==1?' start="'+i+'"':"";return"<"+a+d+`>
|
|
145
|
+
`+s+"</"+a+`>
|
|
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+" "+_r(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 a=0;a<e.header.length;a++)i+=this.tablecell(e.header[a]);t+=this.tablerow({text:i});let s="";for(let a=0;a<e.rows.length;a++){let d=e.rows[a];i="";for(let p=0;p<d.length;p++)i+=this.tablecell(d[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>${_r(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),a=aS(e);if(a===null)return s;e=a;let d='<a href="'+e+'"';return t&&(d+=' title="'+_r(t)+'"'),d+=">"+s+"</a>",d}image({href:e,title:t,text:i,tokens:s}){s&&(i=this.parser.parseInline(s,this.parser.textRenderer));let a=aS(e);if(a===null)return _r(i);e=a;let d=`<img src="${e}" alt="${i}"`;return t&&(d+=` title="${_r(t)}"`),d+=">",d}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:_r(e.text)}},j_=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""}},ir=class _g{options;renderer;textRenderer;constructor(t){this.options=t||_a,this.options.renderer=this.options.renderer||new Yh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new j_}static parse(t,i){return new _g(i).parse(t)}static parseInline(t,i){return new _g(i).parseInline(t)}parse(t,i=!0){let s="";for(let a=0;a<t.length;a++){let d=t[a];if(this.options.extensions?.renderers?.[d.type]){let c=d,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=d;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(;a+1<t.length&&t[a+1].type==="text";)c=t[++a],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 a=0;a<t.length;a++){let d=t[a];if(this.options.extensions?.renderers?.[d.type]){let c=this.options.extensions.renderers[d.type].call({parser:this},d);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){s+=c||"";continue}}let p=d;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}},Zl=class{options;block;constructor(e){this.options=e||_a}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?nr.lex:nr.lexInline}provideParser(){return this.block?ir.parse:ir.parseInline}},d2=class{defaults=T_();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ir;Renderer=Yh;TextRenderer=j_;Lexer=nr;Tokenizer=Vh;Hooks=Zl;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 a=s;for(let d of a.header)i=i.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let p of d)i=i.concat(this.walkTokens(p.tokens,t));break}case"list":{let a=s;i=i.concat(this.walkTokens(a.items,t));break}default:{let a=s;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let p=a[d].flat(1/0);i=i.concat(this.walkTokens(p,t))}):a.tokens&&(i=i.concat(this.walkTokens(a.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(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let d=t.renderers[a.name];d?t.renderers[a.name]=function(...p){let c=a.renderer.apply(this,p);return c===!1&&(c=d.apply(this,p)),c}:t.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=t[a.level];d?d.unshift(a.tokenizer):t[a.level]=[a.tokenizer],a.start&&(a.level==="block"?t.startBlock?t.startBlock.push(a.start):t.startBlock=[a.start]:a.level==="inline"&&(t.startInline?t.startInline.push(a.start):t.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(t.childTokens[a.name]=a.childTokens)}),s.extensions=t),i.renderer){let a=this.defaults.renderer||new Yh(this.defaults);for(let d in i.renderer){if(!(d in a))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let p=d,c=i.renderer[p],h=a[p];a[p]=(...f)=>{let g=c.apply(a,f);return g===!1&&(g=h.apply(a,f)),g||""}}s.renderer=a}if(i.tokenizer){let a=this.defaults.tokenizer||new Vh(this.defaults);for(let d in i.tokenizer){if(!(d in a))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let p=d,c=i.tokenizer[p],h=a[p];a[p]=(...f)=>{let g=c.apply(a,f);return g===!1&&(g=h.apply(a,f)),g}}s.tokenizer=a}if(i.hooks){let a=this.defaults.hooks||new Zl;for(let d in i.hooks){if(!(d in a))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let p=d,c=i.hooks[p],h=a[p];Zl.passThroughHooks.has(d)?a[p]=f=>{if(this.defaults.async&&Zl.passThroughHooksRespectAsync.has(d))return(async()=>{let m=await c.call(a,f);return h.call(a,m)})();let g=c.call(a,f);return h.call(a,g)}:a[p]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await c.apply(a,f);return m===!1&&(m=await h.apply(a,f)),m})();let g=c.apply(a,f);return g===!1&&(g=h.apply(a,f)),g}}s.hooks=a}if(i.walkTokens){let a=this.defaults.walkTokens,d=i.walkTokens;s.walkTokens=function(p){let c=[];return c.push(d.call(this,p)),a&&(c=c.concat(a.call(this,p))),c}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return nr.lex(e,t??this.defaults)}parser(e,t){return ir.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let s={...i},a={...this.defaults,...s},d=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&s.async===!1)return d(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 d(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(a.hooks&&(a.hooks.options=a,a.hooks.block=e),a.async)return(async()=>{let p=a.hooks?await a.hooks.preprocess(t):t,c=await(a.hooks?await a.hooks.provideLexer():e?nr.lex:nr.lexInline)(p,a),h=a.hooks?await a.hooks.processAllTokens(c):c;a.walkTokens&&await Promise.all(this.walkTokens(h,a.walkTokens));let f=await(a.hooks?await a.hooks.provideParser():e?ir.parse:ir.parseInline)(h,a);return a.hooks?await a.hooks.postprocess(f):f})().catch(d);try{a.hooks&&(t=a.hooks.preprocess(t));let p=(a.hooks?a.hooks.provideLexer():e?nr.lex:nr.lexInline)(t,a);a.hooks&&(p=a.hooks.processAllTokens(p)),a.walkTokens&&this.walkTokens(p,a.walkTokens);let c=(a.hooks?a.hooks.provideParser():e?ir.parse:ir.parseInline)(p,a);return a.hooks&&(c=a.hooks.postprocess(c)),c}catch(p){return d(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>"+_r(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},ma=new d2;function jt(e,t){return ma.parse(e,t)}jt.options=jt.setOptions=function(e){return ma.setOptions(e),jt.defaults=ma.defaults,t2(jt.defaults),jt};jt.getDefaults=T_;jt.defaults=_a;jt.use=function(...e){return ma.use(...e),jt.defaults=ma.defaults,t2(jt.defaults),jt};jt.walkTokens=function(e,t){return ma.walkTokens(e,t)};jt.parseInline=ma.parseInline;jt.Parser=ir;jt.parser=ir.parse;jt.Renderer=Yh;jt.TextRenderer=j_;jt.Lexer=nr;jt.lexer=nr.lex;jt.Tokenizer=Vh;jt.Hooks=Zl;jt.parse=jt;jt.options;jt.setOptions;jt.use;jt.walkTokens;jt.parseInline;ir.parse;nr.lex;const{entries:f2,setPrototypeOf:cS,isFrozen:ij,getPrototypeOf:rj,getOwnPropertyDescriptor:sj}=Object;let{freeze:si,seal:Xi,create:ao}=Object,{apply:vg,construct:bg}=typeof Reflect<"u"&&Reflect;si||(si=function(t){return t});Xi||(Xi=function(t){return t});vg||(vg=function(t,i){for(var s=arguments.length,a=new Array(s>2?s-2:0),d=2;d<s;d++)a[d-2]=arguments[d];return t.apply(i,a)});bg||(bg=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return new t(...s)});const Pl=xn(Array.prototype.forEach),aj=xn(Array.prototype.lastIndexOf),uS=xn(Array.prototype.pop),zl=xn(Array.prototype.push),oj=xn(Array.prototype.splice),ti=Array.isArray,Jl=xn(String.prototype.toLowerCase),rm=xn(String.prototype.toString),hS=xn(String.prototype.match),to=xn(String.prototype.replace),dS=xn(String.prototype.indexOf),lj=xn(String.prototype.trim),cj=xn(Number.prototype.toString),uj=xn(Boolean.prototype.toString),fS=typeof BigInt>"u"?null:xn(BigInt.prototype.toString),pS=typeof Symbol>"u"?null:xn(Symbol.prototype.toString),cn=xn(Object.prototype.hasOwnProperty),Hl=xn(Object.prototype.toString),$n=xn(RegExp.prototype.test),rh=hj(TypeError);function xn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return vg(e,t,s)}}function hj(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return bg(e,i)}}function tt(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Jl;if(cS&&cS(e,null),!ti(t))return e;let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){const d=i(a);d!==a&&(ij(t)||(t[s]=d),a=d)}e[a]=!0}return e}function dj(e){for(let t=0;t<e.length;t++)cn(e,t)||(e[t]=null);return e}function mi(e){const t=ao(null);for(const[i,s]of f2(e))cn(e,i)&&(ti(s)?t[i]=dj(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=mi(s):t[i]=s);return t}function fj(e){switch(typeof e){case"string":return e;case"number":return cj(e);case"boolean":return uj(e);case"bigint":return fS?fS(e):"0";case"symbol":return pS?pS(e):"Symbol()";case"undefined":return Hl(e);case"function":case"object":{if(e===null)return Hl(e);const t=e,i=oo(t,"toString");if(typeof i=="function"){const s=i(t);return typeof s=="string"?s:Hl(s)}return Hl(e)}default:return Hl(e)}}function oo(e,t){for(;e!==null;){const s=sj(e,t);if(s){if(s.get)return xn(s.get);if(typeof s.value=="function")return xn(s.value)}e=rj(e)}function i(){return null}return i}function pj(e){try{return $n(e,""),!0}catch{return!1}}const mS=si(["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"]),sm=si(["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"]),am=si(["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"]),mj=si(["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"]),om=si(["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"]),gj=si(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),gS=si(["#text"]),_S=si(["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"]),lm=si(["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"]),vS=si(["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"]),sh=si(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_j=Xi(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vj=Xi(/<%[\w\W]*|[\w\W]*%>/gm),bj=Xi(/\$\{[\w\W]*/gm),yj=Xi(/^data-[\-\w.\u00B7-\uFFFF]+$/),Sj=Xi(/^aria-[\-\w]+$/),p2=Xi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xj=Xi(/^(?:\w+script|data):/i),wj=Xi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),m2=Xi(/^html$/i),Cj=Xi(/^[a-z][.\w]*(-[.\w]+)+$/i);var bS=Object.freeze({__proto__:null,ARIA_ATTR:Sj,ATTR_WHITESPACE:wj,CUSTOM_ELEMENT:Cj,DATA_ATTR:yj,DOCTYPE_NAME:m2,ERB_EXPR:vj,IS_ALLOWED_URI:p2,IS_SCRIPT_OR_DATA:xj,MUSTACHE_EXPR:_j,TMPLIT_EXPR:bj});const $l={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ej=function(){return typeof window>"u"?null:window},kj=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const a="data-tt-policy-suffix";i&&i.hasAttribute(a)&&(s=i.getAttribute(a));const d="dompurify"+(s?"#"+s:"");try{return t.createPolicy(d,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},yS=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function g2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ej();const t=je=>g2(je);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==$l.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const s=i,a=s.currentScript,{DocumentFragment:d,HTMLTemplateElement:p,Node:c,Element:h,NodeFilter:f,NamedNodeMap:g=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:S,trustedTypes:C}=e,T=h.prototype,w=oo(T,"cloneNode"),_=oo(T,"remove"),b=oo(T,"nextSibling"),v=oo(T,"childNodes"),y=oo(T,"parentNode");if(typeof p=="function"){const je=i.createElement("template");je.content&&je.content.ownerDocument&&(i=je.content.ownerDocument)}let k,M="";const{implementation:A,createNodeIterator:N,createDocumentFragment:R,getElementsByTagName:I}=i,{importNode:Y}=s;let z=yS();t.isSupported=typeof f2=="function"&&typeof y=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:q,ERB_EXPR:B,TMPLIT_EXPR:W,DATA_ATTR:F,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:O}=bS;let{IS_ALLOWED_URI:H}=bS,j=null;const G=tt({},[...mS,...sm,...am,...om,...gS]);let V=null;const ne=tt({},[..._S,...lm,...vS,...sh]);let ie=Object.seal(ao(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}})),ve=null,ee=null;const $=Object.seal(ao(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,ge=!0,we=!1,de=!0,Ce=!1,Le=!0,Me=!1,qe=!1,ke=!1,ye=!1,Oe=!1,wt=!1,On=!0,Xn=!1;const en="user-content-";let ft=!0,tn=!1,Kt={},Ht=null;const nn=tt({},["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 pn=null;const sn=tt({},["audio","video","img","source","image","track"]);let Zn=null;const rt=tt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kn="http://www.w3.org/1998/Math/MathML",$t="http://www.w3.org/2000/svg",Rt="http://www.w3.org/1999/xhtml";let Lt=Rt,wr=!1,wn=null;const Di=tt({},[kn,$t,Rt],rm);let Dn=tt({},["mi","mo","mn","ms","mtext"]),ji=tt({},["annotation-xml"]);const Zi=tt({},["title","style","font","a","script"]);let Mt=null;const J=["application/xhtml+xml","text/html"],pe="text/html";let xe=null,He=null;const Ct=i.createElement("form"),gt=function(Z){return Z instanceof RegExp||Z instanceof Function},Ne=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===Z)return;(!Z||typeof Z!="object")&&(Z={}),Z=mi(Z),Mt=J.indexOf(Z.PARSER_MEDIA_TYPE)===-1?pe:Z.PARSER_MEDIA_TYPE,xe=Mt==="application/xhtml+xml"?rm:Jl,j=cn(Z,"ALLOWED_TAGS")&&ti(Z.ALLOWED_TAGS)?tt({},Z.ALLOWED_TAGS,xe):G,V=cn(Z,"ALLOWED_ATTR")&&ti(Z.ALLOWED_ATTR)?tt({},Z.ALLOWED_ATTR,xe):ne,wn=cn(Z,"ALLOWED_NAMESPACES")&&ti(Z.ALLOWED_NAMESPACES)?tt({},Z.ALLOWED_NAMESPACES,rm):Di,Zn=cn(Z,"ADD_URI_SAFE_ATTR")&&ti(Z.ADD_URI_SAFE_ATTR)?tt(mi(rt),Z.ADD_URI_SAFE_ATTR,xe):rt,pn=cn(Z,"ADD_DATA_URI_TAGS")&&ti(Z.ADD_DATA_URI_TAGS)?tt(mi(sn),Z.ADD_DATA_URI_TAGS,xe):sn,Ht=cn(Z,"FORBID_CONTENTS")&&ti(Z.FORBID_CONTENTS)?tt({},Z.FORBID_CONTENTS,xe):nn,ve=cn(Z,"FORBID_TAGS")&&ti(Z.FORBID_TAGS)?tt({},Z.FORBID_TAGS,xe):mi({}),ee=cn(Z,"FORBID_ATTR")&&ti(Z.FORBID_ATTR)?tt({},Z.FORBID_ATTR,xe):mi({}),Kt=cn(Z,"USE_PROFILES")?Z.USE_PROFILES&&typeof Z.USE_PROFILES=="object"?mi(Z.USE_PROFILES):Z.USE_PROFILES:!1,ae=Z.ALLOW_ARIA_ATTR!==!1,ge=Z.ALLOW_DATA_ATTR!==!1,we=Z.ALLOW_UNKNOWN_PROTOCOLS||!1,de=Z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ce=Z.SAFE_FOR_TEMPLATES||!1,Le=Z.SAFE_FOR_XML!==!1,Me=Z.WHOLE_DOCUMENT||!1,ye=Z.RETURN_DOM||!1,Oe=Z.RETURN_DOM_FRAGMENT||!1,wt=Z.RETURN_TRUSTED_TYPE||!1,ke=Z.FORCE_BODY||!1,On=Z.SANITIZE_DOM!==!1,Xn=Z.SANITIZE_NAMED_PROPS||!1,ft=Z.KEEP_CONTENT!==!1,tn=Z.IN_PLACE||!1,H=pj(Z.ALLOWED_URI_REGEXP)?Z.ALLOWED_URI_REGEXP:p2,Lt=typeof Z.NAMESPACE=="string"?Z.NAMESPACE:Rt,Dn=cn(Z,"MATHML_TEXT_INTEGRATION_POINTS")&&Z.MATHML_TEXT_INTEGRATION_POINTS&&typeof Z.MATHML_TEXT_INTEGRATION_POINTS=="object"?mi(Z.MATHML_TEXT_INTEGRATION_POINTS):tt({},["mi","mo","mn","ms","mtext"]),ji=cn(Z,"HTML_INTEGRATION_POINTS")&&Z.HTML_INTEGRATION_POINTS&&typeof Z.HTML_INTEGRATION_POINTS=="object"?mi(Z.HTML_INTEGRATION_POINTS):tt({},["annotation-xml"]);const he=cn(Z,"CUSTOM_ELEMENT_HANDLING")&&Z.CUSTOM_ELEMENT_HANDLING&&typeof Z.CUSTOM_ELEMENT_HANDLING=="object"?mi(Z.CUSTOM_ELEMENT_HANDLING):ao(null);if(ie=ao(null),cn(he,"tagNameCheck")&>(he.tagNameCheck)&&(ie.tagNameCheck=he.tagNameCheck),cn(he,"attributeNameCheck")&>(he.attributeNameCheck)&&(ie.attributeNameCheck=he.attributeNameCheck),cn(he,"allowCustomizedBuiltInElements")&&typeof he.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=he.allowCustomizedBuiltInElements),Ce&&(ge=!1),Oe&&(ye=!0),Kt&&(j=tt({},gS),V=ao(null),Kt.html===!0&&(tt(j,mS),tt(V,_S)),Kt.svg===!0&&(tt(j,sm),tt(V,lm),tt(V,sh)),Kt.svgFilters===!0&&(tt(j,am),tt(V,lm),tt(V,sh)),Kt.mathMl===!0&&(tt(j,om),tt(V,vS),tt(V,sh))),$.tagCheck=null,$.attributeCheck=null,cn(Z,"ADD_TAGS")&&(typeof Z.ADD_TAGS=="function"?$.tagCheck=Z.ADD_TAGS:ti(Z.ADD_TAGS)&&(j===G&&(j=mi(j)),tt(j,Z.ADD_TAGS,xe))),cn(Z,"ADD_ATTR")&&(typeof Z.ADD_ATTR=="function"?$.attributeCheck=Z.ADD_ATTR:ti(Z.ADD_ATTR)&&(V===ne&&(V=mi(V)),tt(V,Z.ADD_ATTR,xe))),cn(Z,"ADD_URI_SAFE_ATTR")&&ti(Z.ADD_URI_SAFE_ATTR)&&tt(Zn,Z.ADD_URI_SAFE_ATTR,xe),cn(Z,"FORBID_CONTENTS")&&ti(Z.FORBID_CONTENTS)&&(Ht===nn&&(Ht=mi(Ht)),tt(Ht,Z.FORBID_CONTENTS,xe)),cn(Z,"ADD_FORBID_CONTENTS")&&ti(Z.ADD_FORBID_CONTENTS)&&(Ht===nn&&(Ht=mi(Ht)),tt(Ht,Z.ADD_FORBID_CONTENTS,xe)),ft&&(j["#text"]=!0),Me&&tt(j,["html","head","body"]),j.table&&(tt(j,["tbody"]),delete ve.tbody),Z.TRUSTED_TYPES_POLICY){if(typeof Z.TRUSTED_TYPES_POLICY.createHTML!="function")throw rh('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw rh('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Z.TRUSTED_TYPES_POLICY,M=k.createHTML("")}else k===void 0&&(k=kj(C,a)),k!==null&&typeof M=="string"&&(M=k.createHTML(""));si&&si(Z),He=Z},Re=tt({},[...sm,...am,...mj]),Fe=tt({},[...om,...gj]),Bt=function(Z){let he=y(Z);(!he||!he.tagName)&&(he={namespaceURI:Lt,tagName:"template"});const Ae=Jl(Z.tagName),Xe=Jl(he.tagName);return wn[Z.namespaceURI]?Z.namespaceURI===$t?he.namespaceURI===Rt?Ae==="svg":he.namespaceURI===kn?Ae==="svg"&&(Xe==="annotation-xml"||Dn[Xe]):!!Re[Ae]:Z.namespaceURI===kn?he.namespaceURI===Rt?Ae==="math":he.namespaceURI===$t?Ae==="math"&&ji[Xe]:!!Fe[Ae]:Z.namespaceURI===Rt?he.namespaceURI===$t&&!ji[Xe]||he.namespaceURI===kn&&!Dn[Xe]?!1:!Fe[Ae]&&(Zi[Ae]||!Re[Ae]):!!(Mt==="application/xhtml+xml"&&wn[Z.namespaceURI]):!1},nt=function(Z){zl(t.removed,{element:Z});try{y(Z).removeChild(Z)}catch{_(Z)}},mn=function(Z,he){try{zl(t.removed,{attribute:he.getAttributeNode(Z),from:he})}catch{zl(t.removed,{attribute:null,from:he})}if(he.removeAttribute(Z),Z==="is")if(ye||Oe)try{nt(he)}catch{}else try{he.setAttribute(Z,"")}catch{}},me=function(Z){let he=null,Ae=null;if(ke)Z="<remove></remove>"+Z;else{const Et=hS(Z,/^[\r\n\t ]+/);Ae=Et&&Et[0]}Mt==="application/xhtml+xml"&&Lt===Rt&&(Z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Z+"</body></html>");const Xe=k?k.createHTML(Z):Z;if(Lt===Rt)try{he=new S().parseFromString(Xe,Mt)}catch{}if(!he||!he.documentElement){he=A.createDocument(Lt,"template",null);try{he.documentElement.innerHTML=wr?M:Xe}catch{}}const Je=he.body||he.documentElement;return Z&&Ae&&Je.insertBefore(i.createTextNode(Ae),Je.childNodes[0]||null),Lt===Rt?I.call(he,Me?"html":"body")[0]:Me?he.documentElement:Je},ot=function(Z){return N.call(Z.ownerDocument||Z,Z,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},_t=function(Z){return Z instanceof m&&(typeof Z.nodeName!="string"||typeof Z.textContent!="string"||typeof Z.removeChild!="function"||!(Z.attributes instanceof g)||typeof Z.removeAttribute!="function"||typeof Z.setAttribute!="function"||typeof Z.namespaceURI!="string"||typeof Z.insertBefore!="function"||typeof Z.hasChildNodes!="function")},Ue=function(Z){return typeof c=="function"&&Z instanceof c};function Ee(je,Z,he){Pl(je,Ae=>{Ae.call(t,Z,he,He)})}const pt=function(Z){let he=null;if(Ee(z.beforeSanitizeElements,Z,null),_t(Z))return nt(Z),!0;const Ae=xe(Z.nodeName);if(Ee(z.uponSanitizeElement,Z,{tagName:Ae,allowedTags:j}),Le&&Z.hasChildNodes()&&!Ue(Z.firstElementChild)&&$n(/<[/\w!]/g,Z.innerHTML)&&$n(/<[/\w!]/g,Z.textContent)||Le&&Z.namespaceURI===Rt&&Ae==="style"&&Ue(Z.firstElementChild)||Z.nodeType===$l.progressingInstruction||Le&&Z.nodeType===$l.comment&&$n(/<[/\w]/g,Z.data))return nt(Z),!0;if(ve[Ae]||!($.tagCheck instanceof Function&&$.tagCheck(Ae))&&!j[Ae]){if(!ve[Ae]&&Wn(Ae)&&(ie.tagNameCheck instanceof RegExp&&$n(ie.tagNameCheck,Ae)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ae)))return!1;if(ft&&!Ht[Ae]){const Xe=y(Z)||Z.parentNode,Je=v(Z)||Z.childNodes;if(Je&&Xe){const Et=Je.length;for(let Yt=Et-1;Yt>=0;--Yt){const Xt=w(Je[Yt],!0);Xe.insertBefore(Xt,b(Z))}}}return nt(Z),!0}return Z instanceof h&&!Bt(Z)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&$n(/<\/no(script|embed|frames)/i,Z.innerHTML)?(nt(Z),!0):(Ce&&Z.nodeType===$l.text&&(he=Z.textContent,Pl([q,B,W],Xe=>{he=to(he,Xe," ")}),Z.textContent!==he&&(zl(t.removed,{element:Z.cloneNode()}),Z.textContent=he)),Ee(z.afterSanitizeElements,Z,null),!1)},Vt=function(Z,he,Ae){if(ee[he]||On&&(he==="id"||he==="name")&&(Ae in i||Ae in Ct))return!1;const Xe=V[he]||$.attributeCheck instanceof Function&&$.attributeCheck(he,Z);if(!(ge&&!ee[he]&&$n(F,he))){if(!(ae&&$n(P,he))){if(!Xe||ee[he]){if(!(Wn(Z)&&(ie.tagNameCheck instanceof RegExp&&$n(ie.tagNameCheck,Z)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Z))&&(ie.attributeNameCheck instanceof RegExp&&$n(ie.attributeNameCheck,he)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(he,Z))||he==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&$n(ie.tagNameCheck,Ae)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ae))))return!1}else if(!Zn[he]){if(!$n(H,to(Ae,X,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&Z!=="script"&&dS(Ae,"data:")===0&&pn[Z])){if(!(we&&!$n(K,to(Ae,X,"")))){if(Ae)return!1}}}}}}return!0},Jn=tt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Wn=function(Z){return!Jn[Jl(Z)]&&$n(O,Z)},yi=function(Z){Ee(z.beforeSanitizeAttributes,Z,null);const{attributes:he}=Z;if(!he||_t(Z))return;const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let Xe=he.length;for(;Xe--;){const Je=he[Xe],{name:Et,namespaceURI:Yt,value:Xt}=Je,Se=xe(Et),Pe=Xt;let ze=Et==="value"?Pe:lj(Pe);if(Ae.attrName=Se,Ae.attrValue=ze,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,Ee(z.uponSanitizeAttribute,Z,Ae),ze=Ae.attrValue,Xn&&(Se==="id"||Se==="name")&&dS(ze,en)!==0&&(mn(Et,Z),ze=en+ze),Le&&$n(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ze)){mn(Et,Z);continue}if(Se==="attributename"&&hS(ze,"href")){mn(Et,Z);continue}if(Ae.forceKeepAttr)continue;if(!Ae.keepAttr){mn(Et,Z);continue}if(!de&&$n(/\/>/i,ze)){mn(Et,Z);continue}Ce&&Pl([q,B,W],Zt=>{ze=to(ze,Zt," ")});const vt=xe(Z.nodeName);if(!Vt(vt,Se,ze)){mn(Et,Z);continue}if(k&&typeof C=="object"&&typeof C.getAttributeType=="function"&&!Yt)switch(C.getAttributeType(vt,Se)){case"TrustedHTML":{ze=k.createHTML(ze);break}case"TrustedScriptURL":{ze=k.createScriptURL(ze);break}}if(ze!==Pe)try{Yt?Z.setAttributeNS(Yt,Et,ze):Z.setAttribute(Et,ze),_t(Z)?nt(Z):uS(t.removed)}catch{mn(Et,Z)}}Ee(z.afterSanitizeAttributes,Z,null)},Gn=function(Z){let he=null;const Ae=ot(Z);for(Ee(z.beforeSanitizeShadowDOM,Z,null);he=Ae.nextNode();)Ee(z.uponSanitizeShadowNode,he,null),pt(he),yi(he),he.content instanceof d&&Gn(he.content);Ee(z.afterSanitizeShadowDOM,Z,null)};return t.sanitize=function(je){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Ae=null,Xe=null,Je=null;if(wr=!je,wr&&(je="<!-->"),typeof je!="string"&&!Ue(je)&&(je=fj(je),typeof je!="string"))throw rh("dirty is not a string, aborting");if(!t.isSupported)return je;if(qe||Ne(Z),t.removed=[],typeof je=="string"&&(tn=!1),tn){const Xt=je.nodeName;if(typeof Xt=="string"){const Se=xe(Xt);if(!j[Se]||ve[Se])throw rh("root node is forbidden and cannot be sanitized in-place")}}else if(je instanceof c)he=me("<!---->"),Ae=he.ownerDocument.importNode(je,!0),Ae.nodeType===$l.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?he=Ae:he.appendChild(Ae);else{if(!ye&&!Ce&&!Me&&je.indexOf("<")===-1)return k&&wt?k.createHTML(je):je;if(he=me(je),!he)return ye?null:wt?M:""}he&&ke&&nt(he.firstChild);const Et=ot(tn?je:he);for(;Xe=Et.nextNode();)pt(Xe),yi(Xe),Xe.content instanceof d&&Gn(Xe.content);if(tn)return je;if(ye){if(Ce){he.normalize();let Xt=he.innerHTML;Pl([q,B,W],Se=>{Xt=to(Xt,Se," ")}),he.innerHTML=Xt}if(Oe)for(Je=R.call(he.ownerDocument);he.firstChild;)Je.appendChild(he.firstChild);else Je=he;return(V.shadowroot||V.shadowrootmode)&&(Je=Y.call(s,Je,!0)),Je}let Yt=Me?he.outerHTML:he.innerHTML;return Me&&j["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&$n(m2,he.ownerDocument.doctype.name)&&(Yt="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
|
|
158
|
+
`+Yt),Ce&&Pl([q,B,W],Xt=>{Yt=to(Yt,Xt," ")}),k&&wt?k.createHTML(Yt):Yt},t.setConfig=function(){let je=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ne(je),qe=!0},t.clearConfig=function(){He=null,qe=!1},t.isValidAttribute=function(je,Z,he){He||Ne({});const Ae=xe(je),Xe=xe(Z);return Vt(Ae,Xe,he)},t.addHook=function(je,Z){typeof Z=="function"&&zl(z[je],Z)},t.removeHook=function(je,Z){if(Z!==void 0){const he=aj(z[je],Z);return he===-1?void 0:oj(z[je],he,1)[0]}return uS(z[je])},t.removeHooks=function(je){z[je]=[]},t.removeAllHooks=function(){z=yS()},t}var ac=g2(),cm,SS;function Tj(){if(SS)return cm;SS=1;function e(J){return J instanceof Map?J.clear=J.delete=J.set=function(){throw new Error("map is read-only")}:J instanceof Set&&(J.add=J.clear=J.delete=function(){throw new Error("set is read-only")}),Object.freeze(J),Object.getOwnPropertyNames(J).forEach(pe=>{const xe=J[pe],He=typeof xe;(He==="object"||He==="function")&&!Object.isFrozen(xe)&&e(xe)}),J}class t{constructor(pe){pe.data===void 0&&(pe.data={}),this.data=pe.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(J){return J.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s(J,...pe){const xe=Object.create(null);for(const He in J)xe[He]=J[He];return pe.forEach(function(He){for(const Ct in He)xe[Ct]=He[Ct]}),xe}const a="</span>",d=J=>!!J.scope,p=(J,{prefix:pe})=>{if(J.startsWith("language:"))return J.replace("language:","language-");if(J.includes(".")){const xe=J.split(".");return[`${pe}${xe.shift()}`,...xe.map((He,Ct)=>`${He}${"_".repeat(Ct+1)}`)].join(" ")}return`${pe}${J}`};class c{constructor(pe,xe){this.buffer="",this.classPrefix=xe.classPrefix,pe.walk(this)}addText(pe){this.buffer+=i(pe)}openNode(pe){if(!d(pe))return;const xe=p(pe.scope,{prefix:this.classPrefix});this.span(xe)}closeNode(pe){d(pe)&&(this.buffer+=a)}value(){return this.buffer}span(pe){this.buffer+=`<span class="${pe}">`}}const h=(J={})=>{const pe={children:[]};return Object.assign(pe,J),pe};class f{constructor(){this.rootNode=h(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(pe){this.top.children.push(pe)}openNode(pe){const xe=h({scope:pe});this.add(xe),this.stack.push(xe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(pe){return this.constructor._walk(pe,this.rootNode)}static _walk(pe,xe){return typeof xe=="string"?pe.addText(xe):xe.children&&(pe.openNode(xe),xe.children.forEach(He=>this._walk(pe,He)),pe.closeNode(xe)),pe}static _collapse(pe){typeof pe!="string"&&pe.children&&(pe.children.every(xe=>typeof xe=="string")?pe.children=[pe.children.join("")]:pe.children.forEach(xe=>{f._collapse(xe)}))}}class g extends f{constructor(pe){super(),this.options=pe}addText(pe){pe!==""&&this.add(pe)}startScope(pe){this.openNode(pe)}endScope(){this.closeNode()}__addSublanguage(pe,xe){const He=pe.root;xe&&(He.scope=`language:${xe}`),this.add(He)}toHTML(){return new c(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function m(J){return J?typeof J=="string"?J:J.source:null}function S(J){return w("(?=",J,")")}function C(J){return w("(?:",J,")*")}function T(J){return w("(?:",J,")?")}function w(...J){return J.map(xe=>m(xe)).join("")}function _(J){const pe=J[J.length-1];return typeof pe=="object"&&pe.constructor===Object?(J.splice(J.length-1,1),pe):{}}function b(...J){return"("+(_(J).capture?"":"?:")+J.map(He=>m(He)).join("|")+")"}function v(J){return new RegExp(J.toString()+"|").exec("").length-1}function y(J,pe){const xe=J&&J.exec(pe);return xe&&xe.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(J,{joinWith:pe}){let xe=0;return J.map(He=>{xe+=1;const Ct=xe;let gt=m(He),Ne="";for(;gt.length>0;){const Re=k.exec(gt);if(!Re){Ne+=gt;break}Ne+=gt.substring(0,Re.index),gt=gt.substring(Re.index+Re[0].length),Re[0][0]==="\\"&&Re[1]?Ne+="\\"+String(Number(Re[1])+Ct):(Ne+=Re[0],Re[0]==="("&&xe++)}return Ne}).map(He=>`(${He})`).join(pe)}const A=/\b\B/,N="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",I="\\b\\d+(\\.\\d+)?",Y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",z="\\b(0b[01]+)",q="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",B=(J={})=>{const pe=/^#![ ]*\//;return J.binary&&(J.begin=w(pe,/.*\b/,J.binary,/\b.*/)),s({scope:"meta",begin:pe,end:/$/,relevance:0,"on:begin":(xe,He)=>{xe.index!==0&&He.ignoreMatch()}},J)},W={begin:"\\\\[\\s\\S]",relevance:0},F={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[W]},P={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[W]},K={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},X=function(J,pe,xe={}){const He=s({scope:"comment",begin:J,end:pe,contains:[]},xe);He.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 Ct=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 He.contains.push({begin:w(/[ ]+/,"(",Ct,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),He},O=X("//","$"),H=X("/\\*","\\*/"),j=X("#","$"),G={scope:"number",begin:I,relevance:0},V={scope:"number",begin:Y,relevance:0},ne={scope:"number",begin:z,relevance:0},ie={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[W,{begin:/\[/,end:/\]/,relevance:0,contains:[W]}]},ve={scope:"title",begin:N,relevance:0},ee={scope:"title",begin:R,relevance:0},$={begin:"\\.\\s*"+R,relevance:0};var ge=Object.freeze({__proto__:null,APOS_STRING_MODE:F,BACKSLASH_ESCAPE:W,BINARY_NUMBER_MODE:ne,BINARY_NUMBER_RE:z,COMMENT:X,C_BLOCK_COMMENT_MODE:H,C_LINE_COMMENT_MODE:O,C_NUMBER_MODE:V,C_NUMBER_RE:Y,END_SAME_AS_BEGIN:function(J){return Object.assign(J,{"on:begin":(pe,xe)=>{xe.data._beginMatch=pe[1]},"on:end":(pe,xe)=>{xe.data._beginMatch!==pe[1]&&xe.ignoreMatch()}})},HASH_COMMENT_MODE:j,IDENT_RE:N,MATCH_NOTHING_RE:A,METHOD_GUARD:$,NUMBER_MODE:G,NUMBER_RE:I,PHRASAL_WORDS_MODE:K,QUOTE_STRING_MODE:P,REGEXP_MODE:ie,RE_STARTERS_RE:q,SHEBANG:B,TITLE_MODE:ve,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:ee});function we(J,pe){J.input[J.index-1]==="."&&pe.ignoreMatch()}function de(J,pe){J.className!==void 0&&(J.scope=J.className,delete J.className)}function Ce(J,pe){pe&&J.beginKeywords&&(J.begin="\\b("+J.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",J.__beforeBegin=we,J.keywords=J.keywords||J.beginKeywords,delete J.beginKeywords,J.relevance===void 0&&(J.relevance=0))}function Le(J,pe){Array.isArray(J.illegal)&&(J.illegal=b(...J.illegal))}function Me(J,pe){if(J.match){if(J.begin||J.end)throw new Error("begin & end are not supported with match");J.begin=J.match,delete J.match}}function qe(J,pe){J.relevance===void 0&&(J.relevance=1)}const ke=(J,pe)=>{if(!J.beforeMatch)return;if(J.starts)throw new Error("beforeMatch cannot be used with starts");const xe=Object.assign({},J);Object.keys(J).forEach(He=>{delete J[He]}),J.keywords=xe.keywords,J.begin=w(xe.beforeMatch,S(xe.begin)),J.starts={relevance:0,contains:[Object.assign(xe,{endsParent:!0})]},J.relevance=0,delete xe.beforeMatch},ye=["of","and","for","in","not","or","if","then","parent","list","value"],Oe="keyword";function wt(J,pe,xe=Oe){const He=Object.create(null);return typeof J=="string"?Ct(xe,J.split(" ")):Array.isArray(J)?Ct(xe,J):Object.keys(J).forEach(function(gt){Object.assign(He,wt(J[gt],pe,gt))}),He;function Ct(gt,Ne){pe&&(Ne=Ne.map(Re=>Re.toLowerCase())),Ne.forEach(function(Re){const Fe=Re.split("|");He[Fe[0]]=[gt,On(Fe[0],Fe[1])]})}}function On(J,pe){return pe?Number(pe):Xn(J)?0:1}function Xn(J){return ye.includes(J.toLowerCase())}const en={},ft=J=>{console.error(J)},tn=(J,...pe)=>{console.log(`WARN: ${J}`,...pe)},Kt=(J,pe)=>{en[`${J}/${pe}`]||(console.log(`Deprecated as of ${J}. ${pe}`),en[`${J}/${pe}`]=!0)},Ht=new Error;function nn(J,pe,{key:xe}){let He=0;const Ct=J[xe],gt={},Ne={};for(let Re=1;Re<=pe.length;Re++)Ne[Re+He]=Ct[Re],gt[Re+He]=!0,He+=v(pe[Re-1]);J[xe]=Ne,J[xe]._emit=gt,J[xe]._multi=!0}function pn(J){if(Array.isArray(J.begin)){if(J.skip||J.excludeBegin||J.returnBegin)throw ft("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ht;if(typeof J.beginScope!="object"||J.beginScope===null)throw ft("beginScope must be object"),Ht;nn(J,J.begin,{key:"beginScope"}),J.begin=M(J.begin,{joinWith:""})}}function sn(J){if(Array.isArray(J.end)){if(J.skip||J.excludeEnd||J.returnEnd)throw ft("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ht;if(typeof J.endScope!="object"||J.endScope===null)throw ft("endScope must be object"),Ht;nn(J,J.end,{key:"endScope"}),J.end=M(J.end,{joinWith:""})}}function Zn(J){J.scope&&typeof J.scope=="object"&&J.scope!==null&&(J.beginScope=J.scope,delete J.scope)}function rt(J){Zn(J),typeof J.beginScope=="string"&&(J.beginScope={_wrap:J.beginScope}),typeof J.endScope=="string"&&(J.endScope={_wrap:J.endScope}),pn(J),sn(J)}function kn(J){function pe(Ne,Re){return new RegExp(m(Ne),"m"+(J.case_insensitive?"i":"")+(J.unicodeRegex?"u":"")+(Re?"g":""))}class xe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Re,Fe){Fe.position=this.position++,this.matchIndexes[this.matchAt]=Fe,this.regexes.push([Fe,Re]),this.matchAt+=v(Re)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Re=this.regexes.map(Fe=>Fe[1]);this.matcherRe=pe(M(Re,{joinWith:"|"}),!0),this.lastIndex=0}exec(Re){this.matcherRe.lastIndex=this.lastIndex;const Fe=this.matcherRe.exec(Re);if(!Fe)return null;const Bt=Fe.findIndex((mn,me)=>me>0&&mn!==void 0),nt=this.matchIndexes[Bt];return Fe.splice(0,Bt),Object.assign(Fe,nt)}}class He{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Re){if(this.multiRegexes[Re])return this.multiRegexes[Re];const Fe=new xe;return this.rules.slice(Re).forEach(([Bt,nt])=>Fe.addRule(Bt,nt)),Fe.compile(),this.multiRegexes[Re]=Fe,Fe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Re,Fe){this.rules.push([Re,Fe]),Fe.type==="begin"&&this.count++}exec(Re){const Fe=this.getMatcher(this.regexIndex);Fe.lastIndex=this.lastIndex;let Bt=Fe.exec(Re);if(this.resumingScanAtSamePosition()&&!(Bt&&Bt.index===this.lastIndex)){const nt=this.getMatcher(0);nt.lastIndex=this.lastIndex+1,Bt=nt.exec(Re)}return Bt&&(this.regexIndex+=Bt.position+1,this.regexIndex===this.count&&this.considerAll()),Bt}}function Ct(Ne){const Re=new He;return Ne.contains.forEach(Fe=>Re.addRule(Fe.begin,{rule:Fe,type:"begin"})),Ne.terminatorEnd&&Re.addRule(Ne.terminatorEnd,{type:"end"}),Ne.illegal&&Re.addRule(Ne.illegal,{type:"illegal"}),Re}function gt(Ne,Re){const Fe=Ne;if(Ne.isCompiled)return Fe;[de,Me,rt,ke].forEach(nt=>nt(Ne,Re)),J.compilerExtensions.forEach(nt=>nt(Ne,Re)),Ne.__beforeBegin=null,[Ce,Le,qe].forEach(nt=>nt(Ne,Re)),Ne.isCompiled=!0;let Bt=null;return typeof Ne.keywords=="object"&&Ne.keywords.$pattern&&(Ne.keywords=Object.assign({},Ne.keywords),Bt=Ne.keywords.$pattern,delete Ne.keywords.$pattern),Bt=Bt||/\w+/,Ne.keywords&&(Ne.keywords=wt(Ne.keywords,J.case_insensitive)),Fe.keywordPatternRe=pe(Bt,!0),Re&&(Ne.begin||(Ne.begin=/\B|\b/),Fe.beginRe=pe(Fe.begin),!Ne.end&&!Ne.endsWithParent&&(Ne.end=/\B|\b/),Ne.end&&(Fe.endRe=pe(Fe.end)),Fe.terminatorEnd=m(Fe.end)||"",Ne.endsWithParent&&Re.terminatorEnd&&(Fe.terminatorEnd+=(Ne.end?"|":"")+Re.terminatorEnd)),Ne.illegal&&(Fe.illegalRe=pe(Ne.illegal)),Ne.contains||(Ne.contains=[]),Ne.contains=[].concat(...Ne.contains.map(function(nt){return Rt(nt==="self"?Ne:nt)})),Ne.contains.forEach(function(nt){gt(nt,Fe)}),Ne.starts&>(Ne.starts,Re),Fe.matcher=Ct(Fe),Fe}if(J.compilerExtensions||(J.compilerExtensions=[]),J.contains&&J.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return J.classNameAliases=s(J.classNameAliases||{}),gt(J)}function $t(J){return J?J.endsWithParent||$t(J.starts):!1}function Rt(J){return J.variants&&!J.cachedVariants&&(J.cachedVariants=J.variants.map(function(pe){return s(J,{variants:null},pe)})),J.cachedVariants?J.cachedVariants:$t(J)?s(J,{starts:J.starts?s(J.starts):null}):Object.isFrozen(J)?s(J):J}var Lt="11.11.1";class wr extends Error{constructor(pe,xe){super(pe),this.name="HTMLInjectionError",this.html=xe}}const wn=i,Di=s,Dn=Symbol("nomatch"),ji=7,Zi=function(J){const pe=Object.create(null),xe=Object.create(null),He=[];let Ct=!0;const gt="Could not find the language '{}', did you forget to load/include a language module?",Ne={disableAutodetect:!0,name:"Plain text",contains:[]};let Re={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:g};function Fe(Se){return Re.noHighlightRe.test(Se)}function Bt(Se){let Pe=Se.className+" ";Pe+=Se.parentNode?Se.parentNode.className:"";const ze=Re.languageDetectRe.exec(Pe);if(ze){const vt=Z(ze[1]);return vt||(tn(gt.replace("{}",ze[1])),tn("Falling back to no-highlight mode for this block.",Se)),vt?ze[1]:"no-highlight"}return Pe.split(/\s+/).find(vt=>Fe(vt)||Z(vt))}function nt(Se,Pe,ze){let vt="",Zt="";typeof Pe=="object"?(vt=Se,ze=Pe.ignoreIllegals,Zt=Pe.language):(Kt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Kt("10.7.0",`Please use highlight(code, options) instead.
|
|
159
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),Zt=Se,vt=Pe),ze===void 0&&(ze=!0);const qn={code:vt,language:Zt};Yt("before:highlight",qn);const Si=qn.result?qn.result:mn(qn.language,qn.code,ze);return Si.code=qn.code,Yt("after:highlight",Si),Si}function mn(Se,Pe,ze,vt){const Zt=Object.create(null);function qn(Te,Ie){return Te.keywords[Ie]}function Si(){if(!Ke.keywords){gn.addText(kt);return}let Te=0;Ke.keywordPatternRe.lastIndex=0;let Ie=Ke.keywordPatternRe.exec(kt),Ze="";for(;Ie;){Ze+=kt.substring(Te,Ie.index);const lt=jn.case_insensitive?Ie[0].toLowerCase():Ie[0],rn=qn(Ke,lt);if(rn){const[Ii,Ho]=rn;if(gn.addText(Ze),Ze="",Zt[lt]=(Zt[lt]||0)+1,Zt[lt]<=ji&&(Jr+=Ho),Ii.startsWith("_"))Ze+=Ie[0];else{const Bc=jn.classNameAliases[Ii]||Ii;xi(Ie[0],Bc)}}else Ze+=Ie[0];Te=Ke.keywordPatternRe.lastIndex,Ie=Ke.keywordPatternRe.exec(kt)}Ze+=kt.substring(Te),gn.addText(Ze)}function ai(){if(kt==="")return;let Te=null;if(typeof Ke.subLanguage=="string"){if(!pe[Ke.subLanguage]){gn.addText(kt);return}Te=mn(Ke.subLanguage,kt,!0,Ic[Ke.subLanguage]),Ic[Ke.subLanguage]=Te._top}else Te=ot(kt,Ke.subLanguage.length?Ke.subLanguage:null);Ke.relevance>0&&(Jr+=Te.relevance),gn.__addSublanguage(Te._emitter,Te.language)}function zt(){Ke.subLanguage!=null?ai():Si(),kt=""}function xi(Te,Ie){Te!==""&&(gn.startScope(Ie),gn.addText(Te),gn.endScope())}function Dc(Te,Ie){let Ze=1;const lt=Ie.length-1;for(;Ze<=lt;){if(!Te._emit[Ze]){Ze++;continue}const rn=jn.classNameAliases[Te[Ze]]||Te[Ze],Ii=Ie[Ze];rn?xi(Ii,rn):(kt=Ii,Si(),kt=""),Ze++}}function ba(Te,Ie){return Te.scope&&typeof Te.scope=="string"&&gn.openNode(jn.classNameAliases[Te.scope]||Te.scope),Te.beginScope&&(Te.beginScope._wrap?(xi(kt,jn.classNameAliases[Te.beginScope._wrap]||Te.beginScope._wrap),kt=""):Te.beginScope._multi&&(Dc(Te.beginScope,Ie),kt="")),Ke=Object.create(Te,{parent:{value:Ke}}),Ke}function Bo(Te,Ie,Ze){let lt=y(Te.endRe,Ze);if(lt){if(Te["on:end"]){const rn=new t(Te);Te["on:end"](Ie,rn),rn.isMatchIgnored&&(lt=!1)}if(lt){for(;Te.endsParent&&Te.parent;)Te=Te.parent;return Te}}if(Te.endsWithParent)return Bo(Te.parent,Ie,Ze)}function ya(Te){return Ke.matcher.regexIndex===0?(kt+=Te[0],1):(Qr=!0,0)}function kd(Te){const Ie=Te[0],Ze=Te.rule,lt=new t(Ze),rn=[Ze.__beforeBegin,Ze["on:begin"]];for(const Ii of rn)if(Ii&&(Ii(Te,lt),lt.isMatchIgnored))return ya(Ie);return Ze.skip?kt+=Ie:(Ze.excludeBegin&&(kt+=Ie),zt(),!Ze.returnBegin&&!Ze.excludeBegin&&(kt=Ie)),ba(Ze,Te),Ze.returnBegin?0:Ie.length}function oi(Te){const Ie=Te[0],Ze=Pe.substring(Te.index),lt=Bo(Ke,Te,Ze);if(!lt)return Dn;const rn=Ke;Ke.endScope&&Ke.endScope._wrap?(zt(),xi(Ie,Ke.endScope._wrap)):Ke.endScope&&Ke.endScope._multi?(zt(),Dc(Ke.endScope,Te)):rn.skip?kt+=Ie:(rn.returnEnd||rn.excludeEnd||(kt+=Ie),zt(),rn.excludeEnd&&(kt=Ie));do Ke.scope&&gn.closeNode(),!Ke.skip&&!Ke.subLanguage&&(Jr+=Ke.relevance),Ke=Ke.parent;while(Ke!==lt.parent);return lt.starts&&ba(lt.starts,Te),rn.returnEnd?0:Ie.length}function Po(){const Te=[];for(let Ie=Ke;Ie!==jn;Ie=Ie.parent)Ie.scope&&Te.unshift(Ie.scope);Te.forEach(Ie=>gn.openNode(Ie))}let Bs={};function Sa(Te,Ie){const Ze=Ie&&Ie[0];if(kt+=Te,Ze==null)return zt(),0;if(Bs.type==="begin"&&Ie.type==="end"&&Bs.index===Ie.index&&Ze===""){if(kt+=Pe.slice(Ie.index,Ie.index+1),!Ct){const lt=new Error(`0 width match regex (${Se})`);throw lt.languageName=Se,lt.badRule=Bs.rule,lt}return 1}if(Bs=Ie,Ie.type==="begin")return kd(Ie);if(Ie.type==="illegal"&&!ze){const lt=new Error('Illegal lexeme "'+Ze+'" for mode "'+(Ke.scope||"<unnamed>")+'"');throw lt.mode=Ke,lt}else if(Ie.type==="end"){const lt=oi(Ie);if(lt!==Dn)return lt}if(Ie.type==="illegal"&&Ze==="")return kt+=`
|
|
160
|
+
`,1;if(zo>1e5&&zo>Ie.index*3)throw new Error("potential infinite loop, way more iterations than matches");return kt+=Ze,Ze.length}const jn=Z(Se);if(!jn)throw ft(gt.replace("{}",Se)),new Error('Unknown language: "'+Se+'"');const jc=kn(jn);let xa="",Ke=vt||jc;const Ic={},gn=new Re.__emitter(Re);Po();let kt="",Jr=0,Cr=0,zo=0,Qr=!1;try{if(jn.__emitTokens)jn.__emitTokens(Pe,gn);else{for(Ke.matcher.considerAll();;){zo++,Qr?Qr=!1:Ke.matcher.considerAll(),Ke.matcher.lastIndex=Cr;const Te=Ke.matcher.exec(Pe);if(!Te)break;const Ie=Pe.substring(Cr,Te.index),Ze=Sa(Ie,Te);Cr=Te.index+Ze}Sa(Pe.substring(Cr))}return gn.finalize(),xa=gn.toHTML(),{language:Se,value:xa,relevance:Jr,illegal:!1,_emitter:gn,_top:Ke}}catch(Te){if(Te.message&&Te.message.includes("Illegal"))return{language:Se,value:wn(Pe),illegal:!0,relevance:0,_illegalBy:{message:Te.message,index:Cr,context:Pe.slice(Cr-100,Cr+100),mode:Te.mode,resultSoFar:xa},_emitter:gn};if(Ct)return{language:Se,value:wn(Pe),illegal:!1,relevance:0,errorRaised:Te,_emitter:gn,_top:Ke};throw Te}}function me(Se){const Pe={value:wn(Se),illegal:!1,relevance:0,_top:Ne,_emitter:new Re.__emitter(Re)};return Pe._emitter.addText(Se),Pe}function ot(Se,Pe){Pe=Pe||Re.languages||Object.keys(pe);const ze=me(Se),vt=Pe.filter(Z).filter(Ae).map(zt=>mn(zt,Se,!1));vt.unshift(ze);const Zt=vt.sort((zt,xi)=>{if(zt.relevance!==xi.relevance)return xi.relevance-zt.relevance;if(zt.language&&xi.language){if(Z(zt.language).supersetOf===xi.language)return 1;if(Z(xi.language).supersetOf===zt.language)return-1}return 0}),[qn,Si]=Zt,ai=qn;return ai.secondBest=Si,ai}function _t(Se,Pe,ze){const vt=Pe&&xe[Pe]||ze;Se.classList.add("hljs"),Se.classList.add(`language-${vt}`)}function Ue(Se){let Pe=null;const ze=Bt(Se);if(Fe(ze))return;if(Yt("before:highlightElement",{el:Se,language:ze}),Se.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Se);return}if(Se.children.length>0&&(Re.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(Se)),Re.throwUnescapedHTML))throw new wr("One of your code blocks includes unescaped HTML.",Se.innerHTML);Pe=Se;const vt=Pe.textContent,Zt=ze?nt(vt,{language:ze,ignoreIllegals:!0}):ot(vt);Se.innerHTML=Zt.value,Se.dataset.highlighted="yes",_t(Se,ze,Zt.language),Se.result={language:Zt.language,re:Zt.relevance,relevance:Zt.relevance},Zt.secondBest&&(Se.secondBest={language:Zt.secondBest.language,relevance:Zt.secondBest.relevance}),Yt("after:highlightElement",{el:Se,result:Zt,text:vt})}function Ee(Se){Re=Di(Re,Se)}const pt=()=>{Wn(),Kt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Vt(){Wn(),Kt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Jn=!1;function Wn(){function Se(){Wn()}if(document.readyState==="loading"){Jn||window.addEventListener("DOMContentLoaded",Se,!1),Jn=!0;return}document.querySelectorAll(Re.cssSelector).forEach(Ue)}function yi(Se,Pe){let ze=null;try{ze=Pe(J)}catch(vt){if(ft("Language definition for '{}' could not be registered.".replace("{}",Se)),Ct)ft(vt);else throw vt;ze=Ne}ze.name||(ze.name=Se),pe[Se]=ze,ze.rawDefinition=Pe.bind(null,J),ze.aliases&&he(ze.aliases,{languageName:Se})}function Gn(Se){delete pe[Se];for(const Pe of Object.keys(xe))xe[Pe]===Se&&delete xe[Pe]}function je(){return Object.keys(pe)}function Z(Se){return Se=(Se||"").toLowerCase(),pe[Se]||pe[xe[Se]]}function he(Se,{languageName:Pe}){typeof Se=="string"&&(Se=[Se]),Se.forEach(ze=>{xe[ze.toLowerCase()]=Pe})}function Ae(Se){const Pe=Z(Se);return Pe&&!Pe.disableAutodetect}function Xe(Se){Se["before:highlightBlock"]&&!Se["before:highlightElement"]&&(Se["before:highlightElement"]=Pe=>{Se["before:highlightBlock"](Object.assign({block:Pe.el},Pe))}),Se["after:highlightBlock"]&&!Se["after:highlightElement"]&&(Se["after:highlightElement"]=Pe=>{Se["after:highlightBlock"](Object.assign({block:Pe.el},Pe))})}function Je(Se){Xe(Se),He.push(Se)}function Et(Se){const Pe=He.indexOf(Se);Pe!==-1&&He.splice(Pe,1)}function Yt(Se,Pe){const ze=Se;He.forEach(function(vt){vt[ze]&&vt[ze](Pe)})}function Xt(Se){return Kt("10.7.0","highlightBlock will be removed entirely in v12.0"),Kt("10.7.0","Please use highlightElement now."),Ue(Se)}Object.assign(J,{highlight:nt,highlightAuto:ot,highlightAll:Wn,highlightElement:Ue,highlightBlock:Xt,configure:Ee,initHighlighting:pt,initHighlightingOnLoad:Vt,registerLanguage:yi,unregisterLanguage:Gn,listLanguages:je,getLanguage:Z,registerAliases:he,autoDetection:Ae,inherit:Di,addPlugin:Je,removePlugin:Et}),J.debugMode=function(){Ct=!1},J.safeMode=function(){Ct=!0},J.versionString=Lt,J.regex={concat:w,lookahead:S,either:b,optional:T,anyNumberOfTimes:C};for(const Se in ge)typeof ge[Se]=="object"&&e(ge[Se]);return Object.assign(J,ge),J},Mt=Zi({});return Mt.newInstance=()=>Zi({}),cm=Mt,Mt.HighlightJS=Mt,Mt.default=Mt,cm}var Aj=Tj();const Gi=Qg(Aj);function xS(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 a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},d=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,a]};a.contains.push(c);const h={match:/\\"/},f={className:"string",begin:/'/,end:/'/},g={match:/\\'/},m={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},S=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=e.SHEBANG({binary:`(${S.join("|")})`,relevance:10}),T={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},w=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],b={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["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"],M=["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:_,built_in:[...v,...y,"set","shopt",...k,...M]},contains:[C,e.SHEBANG(),T,m,d,p,b,c,h,f,g,i]}}const wS="[A-Za-z$_][0-9A-Za-z$_]*",Rj=["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"],Lj=["true","false","null","undefined","NaN","Infinity"],_2=["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"],v2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],b2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Mj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Nj=[].concat(b2,_2,v2);function CS(e){const t=e.regex,i=(X,{after:O})=>{const H="</"+X[0].slice(1);return X.input.indexOf(H,O)!==-1},s=wS,a={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,O)=>{const H=X[0].length+X.index,j=X.input[H];if(j==="<"||j===","){O.ignoreMatch();return}j===">"&&(i(X,{after:H})||O.ignoreMatch());let G;const V=X.input.substring(H);if(G=V.match(/^\s*=/)){O.ignoreMatch();return}if((G=V.match(/^\s+extends\s+/))&&G.index===0){O.ignoreMatch();return}}},c={$pattern:wS,keyword:Rj,literal:Lj,built_in:Nj,"variable.language":Mj},h="[0-9](_?[0-9])*",f=`\\.(${h})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${h})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(y)});const k=[].concat(v,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:M},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"}}]},R={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:{_:[..._2,...v2]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Y={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(X){return t.concat("(?!",X.join("|"),")")}const B={match:t.concat(/\b/,q([...b2,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,v,{match:/\$\d+/},m,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin: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:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:d},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},Y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},B,z,N,F,{match:/\$[(.]/}]}}function Oj(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],a={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,i,e.QUOTE_STRING_MODE,a,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function ES(e){const t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},a={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}]},d={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}]},f={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},m=e.inherit(f,{contains:[]}),S=e.inherit(g,{contains:[]});f.contains.push(S),g.contains.push(m);let C=[i,h];return[f,g,m,S].forEach(b=>{b.contains=b.contains.concat(C)}),C=C.concat(f,g),{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,d,f,g,{className:"quote",begin:"^>\\s+",contains:C,end:"$"},a,s,h,p,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function kS(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:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:c,illegal:/#/},g={begin:/\{\{/,relevance:0},m={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,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,g,f]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,g,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,g,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S="[0-9](_?[0-9])*",C=`(\\b(${S}))?\\.(${S})|\\b(${S})\\.`,T=`\\b|${s.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${S})|(${C}))[eE][+-]?(${S})[jJ]?(?=${T})`},{begin:`(${C})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${T})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${T})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${T})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${T})`},{begin:`\\b(${S})[jJ](?=${T})`}]},_={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,m,e.HASH_COMMENT_MODE]}]};return f.contains=[m,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"},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,m]}]}}const Xh="[A-Za-z$_][0-9A-Za-z$_]*",y2=["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"],S2=["true","false","null","undefined","NaN","Infinity"],x2=["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"],w2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],C2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],E2=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],k2=[].concat(C2,x2,w2);function Dj(e){const t=e.regex,i=(X,{after:O})=>{const H="</"+X[0].slice(1);return X.input.indexOf(H,O)!==-1},s=Xh,a={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,O)=>{const H=X[0].length+X.index,j=X.input[H];if(j==="<"||j===","){O.ignoreMatch();return}j===">"&&(i(X,{after:H})||O.ignoreMatch());let G;const V=X.input.substring(H);if(G=V.match(/^\s*=/)){O.ignoreMatch();return}if((G=V.match(/^\s+extends\s+/))&&G.index===0){O.ignoreMatch();return}}},c={$pattern:Xh,keyword:y2,literal:S2,built_in:k2,"variable.language":E2},h="[0-9](_?[0-9])*",f=`\\.(${h})`,g="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${g})((${f})|\\.)?|(${f}))[eE][+-]?(${h})\\b`},{begin:`\\b(${g})\\b((${f})\\b|\\.)?|(${f})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:c,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},v={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:c,contains:["self"].concat(y)});const k=[].concat(v,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:c,contains:["self"].concat(k)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:c,contains:M},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"}}]},R={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:{_:[...x2,...w2]}},I={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},Y={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},z={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function q(X){return t.concat("(?!",X.join("|"),")")}const B={match:t.concat(/\b/,q([...C2,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},W={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",K={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:c,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),I,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,v,{match:/\$\d+/},m,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},K,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin: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:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:d},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},Y,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},W,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},B,z,N,F,{match:/\$[(.]/}]}}function TS(e){const t=e.regex,i=Dj(e),s=Xh,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},p={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},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"],f={$pattern:Xh,keyword:y2.concat(h),literal:S2,built_in:k2.concat(a),"variable.language":E2},g={className:"meta",begin:"@"+s},m=(w,_,b)=>{const v=w.contains.findIndex(y=>y.label===_);if(v===-1)throw new Error("can not find mode to replace");w.contains.splice(v,1,b)};Object.assign(i.keywords,f),i.exports.PARAMS_CONTAINS.push(g);const S=i.contains.find(w=>w.scope==="attr"),C=Object.assign({},S,{match:t.concat(s,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,S,C]),i.contains=i.contains.concat([g,d,p,C]),m(i,"shebang",e.SHEBANG()),m(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 jj=/\[\[wiki:([^\]]+)\]\]/g,Ij=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,Bj=/^(\S[^:]*?):[ \t]*(.*)$/,Pj=new d2({gfm:!0,breaks:!1}),AS={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},um=Jj();function Sc(e,t={}){const{entries:i,content:s}=$j(e),a=Wj(s,t.resolveWikiLink),d=Pj.parse(a,{async:!1}),p=Uj(i),c=ac.sanitize(p+d,AS),h=new DOMParser().parseFromString(c,"text/html");return qj(h,t.omitDuplicateTitle),Gj(h),Kj(h),Yj(h),{html:ac.sanitize(h.body.innerHTML,AS),toc:Xj(h)}}function zj(e){const t=new TextEncoder().encode(e);let i="";for(const s of t)i+=String.fromCharCode(s);return btoa(i)}function Hj(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 $j(e){const t=Ij.exec(e);return t?{entries:Fj(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function Fj(e){const t=[];for(const i of e.split(/\r?\n/)){const s=i.replace(/\s+$/,"");if(s.trim()==="")continue;const a=Bj.exec(s);if(a){const[,c="",h=""]=a;t.push({key:c.trim(),value:h.trim()});continue}const d=t[t.length-1];if(!d)continue;const p=s.trim();d.value=d.value?`${d.value} ${p}`:p}return t}function Uj(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${oc(i.key)}</dt><dd>${oc(i.value)}</dd>`).join("")}</dl>`}function Wj(e,t){return e.replace(jj,(i,s)=>{const a=s.trim();if(!a)return"";if(!t)return oc(`[[wiki:${a}]]`);const d=t(a);if(d===null)return oc(`[[wiki:${a}]]`);const p=oc(a),c=encodeURIComponent(a);return`<a href="${d}" data-entry-id="${c}">${p}</a>`})}function Gj(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const s=i.textContent?.trim()??"",a=t8(s||"section"),d=t.get(a)??0;t.set(a,d+1),i.id=d===0?a:`${a}-${d+1}`}}function qj(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||RS(i.textContent??"")===RS(t)&&i.remove()}function Kj(e){for(const t of e.querySelectorAll("pre > code")){const i=Qj(t.className),s=t.textContent??"",a=t.parentElement;if(!a)continue;if(i==="mermaid"){const p=e.createElement("div");p.className="diagram-block",p.setAttribute("data-mermaid-source",zj(s)),p.setAttribute("data-diagram-state","pending"),a.replaceWith(p);continue}const d=Zj(s,i);t.innerHTML=d,t.classList.add("hljs"),a.classList.add("code-block"),a.dataset.code=s,a.insertBefore(Vj(e,i||"text"),a.firstChild)}}function Vj(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 a=e.createElement("span");a.className="code-block-language",a.textContent=t;const d=e.createElement("button");return d.className="copy-code",d.type="button",d.dataset.action="copy-code",d.setAttribute("aria-label",`Copy ${t} code`),d.textContent="Copy",i.append(s,a,d),i}function Yj(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";e8(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function Xj(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 Zj(e,t){return t&&um.getLanguage(t)?um.highlight(e,{language:t}).value:um.highlightAuto(e).value}function Jj(){return Gi.registerLanguage("bash",xS),Gi.registerLanguage("sh",xS),Gi.registerLanguage("javascript",CS),Gi.registerLanguage("js",CS),Gi.registerLanguage("json",Oj),Gi.registerLanguage("markdown",ES),Gi.registerLanguage("md",ES),Gi.registerLanguage("python",kS),Gi.registerLanguage("py",kS),Gi.registerLanguage("typescript",TS),Gi.registerLanguage("ts",TS),Gi}function Qj(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function e8(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function t8(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function RS(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function oc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const n8="modulepreload",i8=function(e){return"/console/"+e},LS={},r8=function(t,i,s){let a=Promise.resolve();if(i&&i.length>0){let h=function(f){return Promise.all(f.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),c=p?.nonce||p?.getAttribute("nonce");a=h(i.map(f=>{if(f=i8(f),f in LS)return;LS[f]=!0;const g=f.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":n8,g||(S.as="script"),S.crossOrigin="",S.href=f,c&&S.setAttribute("nonce",c),document.head.appendChild(S),g)return new Promise((C,T)=>{S.addEventListener("load",C),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${f}`)))})}))}function d(p){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=p,window.dispatchEvent(c),!c.defaultPrevented)throw p}return a.then(p=>{for(const c of p||[])c.status==="rejected"&&d(c.reason);return t().catch(d)})},s8=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",a8=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),o8=/^on/i,l8={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},MS="diagramInteractionBound",c8=/^oklch\s*\(\s*([^)]+)\s*\)$/i,u8=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Vi=[25,50,75,100,125,150,200],h8=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let hm=null;const NS=new WeakSet;let d8=0,f8=0,xc=null;function As(e){const t=e.trim();if(!t)return t;const i=j8(t);return i?I8(i):t}function I_(e){if(NS.has(e))return;NS.add(e),OS(e);const t=e instanceof Node?e:document.body;new MutationObserver(s=>{let a=!1;for(const d of s)if(d.type==="childList"){xc&&!xc.trigger.isConnected&&Ql(!1);for(const p of d.addedNodes)if(p instanceof Element&&(p.matches?.(".diagram-block[data-mermaid-source]")||p.querySelector?.(".diagram-block[data-mermaid-source]"))){a=!0;break}if(a)break}a&&OS(e)}).observe(t,{childList:!0,subtree:!0})}function OS(e){const t=e.querySelectorAll(s8);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",p8(i))}async function p8(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=Hj(t)}catch{dm(e,"Invalid diagram source");return}if(!i.trim()){dm(e,"Empty diagram source");return}try{const s=await g8(),a=`mermaid-diagram-${++d8}`,{svg:d}=await s.render(a,i);e.innerHTML=m8(d),b8(e,d),y8(e),S8(e),e.dataset.diagramState="rendered"}catch(s){const a=s instanceof Error?s.message:String(s);dm(e,a)}}function dm(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function m8(e){const t=(i,s)=>{o8.test(s.attrName)&&(s.keepAttr=!1)};ac.addHook("uponSanitizeAttribute",t);try{return ac.sanitize(e,l8)}finally{ac.removeHook("uponSanitizeAttribute",t)}}async function g8(){return hm||(hm=(async()=>{const e=await r8(()=>import("./mermaid.core-BdlXsBT1.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:_8(),themeCSS:v8(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),hm}function _8(){const e=getComputedStyle(document.documentElement),t=(w,_)=>{const b=e.getPropertyValue(w).trim();return As(b||_)},i=(w,_)=>e.getPropertyValue(w).trim()||_,s=t("--brass","#c69a4a"),a=t("--brass-bright","#e6b86a"),d=t("--brass-deep","#a0782a"),p=t("--aurora","#8bd7e6"),c=t("--aurora-deep","#1f8aa8"),h=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),g=t("--ink-fog","#a6afbb"),m=t("--ink-pearl","#e6e9ef"),S=t("--ink-spectral","#bcc4d0"),C=[a,s,p,h,As("oklch(70% 0.11 68)"),c,As("oklch(76% 0.09 205)"),d,As("oklch(68% 0.14 30)"),g,As("oklch(62% 0.08 228)"),As("oklch(52% 0.05 248)")],T=Object.fromEntries(h8.map((w,_)=>[w,C[_]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:m,primaryBorderColor:s,secondaryColor:"transparent",secondaryTextColor:m,secondaryBorderColor:a,tertiaryColor:"transparent",tertiaryTextColor:S,tertiaryBorderColor:s,lineColor:c,edgeLabelBackground:"transparent",titleColor:a,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:s,clusterBkg:"transparent",clusterBorder:s,pieTitleTextColor:a,pieTitleTextSize:i("--font-size-title-lg","19px"),pieSectionTextColor:m,pieSectionTextSize:i("--font-size-md","13px"),pieLegendTextColor:m,pieLegendTextSize:i("--font-size-lg","14px"),pieStrokeColor:d,pieStrokeWidth:"1.35px",pieOuterStrokeColor:a,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...T}}function v8(){const e=getComputedStyle(document.documentElement),t=(f,g)=>{const m=e.getPropertyValue(f).trim();return As(m||g)},i=t("--brass-deep","#a0782a"),s=t("--brass-bright","#e6b86a"),a=t("--aurora-deep","#1f8aa8"),d=t("--ink-abyss","#131920"),p=As("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: ${a};
|
|
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: ${d};
|
|
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: ${d};
|
|
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 b8(e,t){const i=new DOMParser().parseFromString(t,"image/svg+xml"),s=Array.from(i.querySelectorAll("a")),a=Array.from(e.querySelectorAll("a")),d=Math.min(s.length,a.length);for(let p=0;p<d;p++){const c=s[p],h=a[p];if(!c||!h)continue;const f=c.getAttribute("href")??c.getAttribute("xlink:href")??"",g=A2(f);g&&h.setAttribute("href",g)}}function y8(e){const t=e.querySelector("svg");if(!t)return;let i;try{i=t.getBBox()}catch{return}const{x:s,y:a,width:d,height:p}=i;!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(d)||!Number.isFinite(p)||s<0||a<0||d<=0||p<=0||t.setAttribute("viewBox",`${fo(s)} ${fo(a)} ${fo(d)} ${fo(p)}`)}function S8(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),N8(e),e.dataset[MS]!=="true"&&(e.dataset[MS]="true",e.addEventListener("click",x8),e.addEventListener("keydown",w8))}function x8(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Zh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),T2(t))}function w8(e){if(e.key!=="Enter"&&e.key!==" "||Zh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),T2(t))}function T2(e){const t=e.querySelector("svg");if(!t)return;Ql(!1);const i=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",s=document.createElement(i?"dialog":"div"),a=++f8,d=`diagram-lightbox-title-${a}`;s.className="diagram-lightbox",s.setAttribute("aria-labelledby",d),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=d,h.textContent="MANIFEST · DIAGRAM";const f=document.createElement("button");f.className="diagram-lightbox__close",f.type="button",f.setAttribute("aria-label","Close expanded diagram"),f.textContent="Close";const g=document.createElement("div");g.className="diagram-lightbox__controls",g.setAttribute("aria-label","Diagram zoom controls");const m=ah("−","Zoom out","out"),S=document.createElement("span");S.className="diagram-lightbox__zoom-readout",S.setAttribute("aria-live","polite");const C=ah("+","Zoom in","in"),T=ah("Fit","Fit diagram to viewport","fit"),w=ah("Reset","Reset diagram zoom","reset");g.append(m,S,C,T,w);const _=document.createElement("div");_.className="diagram-lightbox__viewport";const b=k8(t),v=t.cloneNode(!0);v.removeAttribute("style"),A8(v,`diagram-lightbox-svg-${a}`),_.append(v),c.append(h,g,f),p.append(c,_),s.append(p),document.body.append(s);const y=new C8(_,v,S,b);m.addEventListener("click",()=>y.zoomOut()),C.addEventListener("click",()=>y.zoomIn()),T.addEventListener("click",()=>y.fit()),w.addEventListener("click",()=>y.reset());const k=R8(s),M=R=>{(R.target===s||R.target===f)&&Ql(!0)},A=R=>{if(R.key==="Escape"){R.preventDefault(),Ql(!0);return}y.handleKeyboard(R)||R.key==="Tab"&&M8(R,s)},N={dialog:s,trigger:e,inertStates:k,onClick:M,onKeyDown:A,cleanupPanZoom:()=>y.destroy()};i&&(N.onCancel=R=>{R.preventDefault(),Ql(!0)},s.addEventListener("cancel",N.onCancel),s.showModal()),s.addEventListener("click",M),document.addEventListener("keydown",A,!0),xc=N,y.fit(),f.focus()}function ah(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 C8{constructor(t,i,s,a){this.viewport=t,this.svg=i,this.readout=s,this.baseSize=a,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=Vi.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,Vi.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Vi.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),a=Math.floor(s*100),d=Vi.findIndex(c=>c>a),p=d===-1?Vi.length-1:Math.max(0,d-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*(oh(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(oh(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=oh(this.zoomIndex),s=i/100;this.svg.setAttribute("width",fo(this.baseSize.width*s)),this.svg.setAttribute("height",fo(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 a=this.svgWidth,d=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/a*this.svgWidth-(i-p.left),this.viewport.scrollTop=h/d*this.svgHeight-(s-p.top)}onPointerDown=t=>{if(t.button!==0||Zh(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,a=oh(this.pinchStart.zoomIndex)*s;this.applyZoom(T8(a));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,Vi.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{Zh(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Vi.indexOf(200)?Vi.indexOf(100):Vi.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 E8(e){const t=DS(e.getAttribute("width")),i=DS(e.getAttribute("height"));if(t&&i)return{width:t,height:i};const s=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],a=s[2],d=s[3],p=a!==void 0&&Number.isFinite(a)&&a>0?a:null,c=d!==void 0&&Number.isFinite(d)&&d>0?d:null;return{width:t??p??800,height:i??c??600}}function k8(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:E8(e)}function DS(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 fo(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function T8(e){let t=0,i=Number.POSITIVE_INFINITY;return Vi.forEach((s,a)=>{const d=Math.abs(s-e);d<i&&(i=d,t=a)}),t}function oh(e){return Vi[e]??Vi[0]}function A8(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 Ql(e){const t=xc;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),L8(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),xc=null,e&&t.trigger.isConnected&&t.trigger.focus())}function R8(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 L8(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 M8(e,t){const i=Array.from(t.querySelectorAll(a8)).filter(D8);if(i.length===0){e.preventDefault(),t.focus();return}const s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function N8(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Zh(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!O8(t)}function O8(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function D8(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function A2(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:A2(s.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const s=t.slice(7);let a;try{a=decodeURIComponent(s)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(a)?`/entry/${encodeURIComponent(a)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function j8(e){const t=c8.exec(e);if(!t)return null;const i=t[1]?.trim();if(!i)return null;const s=i.indexOf("/"),a=s>=0?i.slice(0,s):i,d=s>=0?i.slice(s+1).trim():"",p=a.trim().split(/[\s,]+/).filter(Boolean);if(p.length!==3)return null;const[c,h,f]=p;if(!c||!h||!f)return null;const g=fm(c,1),m=fm(h,.4),S=B8(f);if(g===null||m===null||S===null)return null;let C=1;if(s>=0){const T=fm(d,1);if(T===null)return null;C=T}return{L:g,C:m,h:S,alpha:C}}function I8(e){const t=e.h*Math.PI/180,i=e.C*Math.cos(t),s=e.C*Math.sin(t),a=e.L,d=a+.3963377774*i+.2158037573*s,p=a-.1055613458*i-.0638541728*s,c=a-.0894841775*i-1.291485548*s,h=d**3,f=p**3,g=c**3,m=4.0767416621*h-3.3077115913*f+.2309699292*g,S=-1.2684380046*h+2.6097574011*f-.3413193965*g,C=-.0041960863*h-.7034186147*f+1.707614701*g,T=lh(pm(m)),w=lh(pm(S)),_=lh(pm(C));if(e.alpha<1){const b=lh(e.alpha);return`#${ta(T)}${ta(w)}${ta(_)}${ta(b)}`}return`#${ta(T)}${ta(w)}${ta(_)}`}function fm(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 B8(e){const t=u8.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function pm(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 lh(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function ta(e){return e.toString(16).padStart(2,"0")}const P8=new Set([".png",".jpg",".jpeg",".webp",".gif"]),z8=new Set(["img.shields.io"]),H8=/^[a-z][a-z0-9+.-]*:/i;function jS(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||H8.test(i))return null;const s=R2(i);if(!s)return null;const a=U8(s);return a===null?null:W8(a,t)}function $8(e){const t=R2(e).toLowerCase();return[...P8].some(i=>t.endsWith(i))}function IS(e,t,i=null){const s=i?`${i.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${s}${t}`)}`}function F8(e){try{const t=new URL(e);return t.protocol==="https:"&&z8.has(t.hostname)}catch{return!1}}function R2(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function U8(e){try{return decodeURI(e)}catch{return null}}function W8(e,t){const i=e.replace(/\\/g,"/"),s=t.replace(/\\/g,"/"),a=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",d=i.startsWith("/")?i:`${a}/${i}`,p=[];for(const c of d.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 G8({content:e,onOpenPath:t,relativePath:i,theaterId:s,contextRelPath:a,truncated:d}){const p=L.useMemo(()=>{const S=Sc(e).html,C=new DOMParser().parseFromString(S,"text/html");return mm(C.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:s,contextRelPath:a}),C.body.innerHTML},[e,i,s,a]),c=L.useRef(null);L.useEffect(()=>{const S=c.current;if(!S)return;I_(S),mm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:a});const C=new MutationObserver(()=>mm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:a}));return C.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>C.disconnect()},[p,i,s,a]);const h=L.useCallback(S=>{const C=S.target.closest('[data-action="copy-code"]');if(!C)return;const T=C.closest("pre")?.getAttribute("data-code");if(!T)return;navigator.clipboard?.writeText(T);const w=C.textContent;C.textContent="Copied",window.setTimeout(()=>{C.textContent=w},1200)},[]),f=L.useCallback(S=>{const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const w=T.dataset.fexpOpenPath;w&&(S.preventDefault(),t(w))},[t]),g=L.useCallback(S=>{if(S.key!=="Enter"&&S.key!==" ")return;const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const w=T.dataset.fexpOpenPath;w&&(S.preventDefault(),t(w))},[t]),m=L.useCallback(S=>{h(S),f(S)},[h,f]);return l.jsxs("div",{className:"fexp-md-wrap",children:[d&&l.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),l.jsx("div",{ref:c,className:"markdown-body",onClick:m,onKeyDown:g,dangerouslySetInnerHTML:{__html:p}})]})}function mm(e,t){for(const i of e.querySelectorAll("a[href]")){const s=i.getAttribute("href")??"",a=jS(s,t.currentRelativePath);a?(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("data-fexp-open-path",a),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")??"",a=i.getAttribute("data-fexp-local-image-path");if(i.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&a&&s===IS(t.theaterId,a,t.contextRelPath)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&F8(s)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const d=jS(s,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&d&&$8(d)){i.setAttribute("src",IS(t.theaterId,d,t.contextRelPath)),i.setAttribute("data-fexp-local-image-path",d),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&q8(i)}}function q8(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,B_=248,P_=200,Jh=160,Qh=4;function V8(e){return e-P_-Qh>=Jh}function Y8(e,t,i){const s=i-P_-Qh;return s<Jh?e:Math.max(Jh,Math.min(s,e-t))}function X8(e){const t=P_+Qh;return`minmax(0, 1fr) ${Qh}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Z8(e){return e?K8:null}const L2="fleet-console.file-explorer.treePaneWidth",z_={selectedPath:null,viewState:{kind:"none"}},J8={...z_,treePaneWidth:B_},M2=new Map,BS=new Map,yg=new Set;let ed=i7();function Q8(e){return L.useSyncExternalStore(n7,()=>t7(e),()=>J8)}function PS(e,t){e&&D2(e,{selectedPath:t})}function Cs(e,t){e&&D2(e,{viewState:t})}function e7(e){ed=j2(e);try{localStorage.setItem(L2,String(ed))}catch{}N2()}function N2(){for(const e of yg)e()}function O2(e){return M2.get(e)??z_}function t7(e){const t=e??"__none__",i=e!=null?O2(e):z_,s=BS.get(t);if(s&&s.selectedPath===i.selectedPath&&s.viewState===i.viewState&&s.treePaneWidth===ed)return s;const a={...i,treePaneWidth:ed};return BS.set(t,a),a}function D2(e,t){M2.set(e,{...O2(e),...t}),N2()}function n7(e){return yg.add(e),()=>{yg.delete(e)}}function i7(){try{return j2(Number(localStorage.getItem(L2)))}catch{return B_}}function j2(e){return!Number.isFinite(e)||e<=0?B_:Math.max(Jh,Math.round(e))}const r7=new Set([".png",".jpg",".jpeg",".webp",".gif"]),s7={id:"file-explorer",title:"Files",icon:l7,pathAware:!0,render:e=>l.jsx(o7,{...e})};function a7(e,t){return{listFolder:async i=>{if(!e)throw new Error("no_theater");const s=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:pg(t,i??"")})});if(!s.ok){const p=await s.json();throw new Error(p.error??"list_failed")}const a=await s.json(),d=ZC(t,a);if(!d)throw new Error("context_boundary");return d}}}function o7(e){const{theaterId:t}=e,i=e.pathContext.relPath,s=QO(t,i),{selectedPath:a,viewState:d,treePaneWidth:p}=Q8(s),c=L.useRef(p);c.current=p;const h=L.useRef(null),[f,g]=L.useState(!1),m=L.useMemo(()=>a7(t,i),[t,i]),S=L.useCallback(async(b,v)=>{if(!t){Cs(t,{kind:"error",message:"no_theater"});return}PS(s,b);const y=v??b.split("/").filter(Boolean).at(-1)??b,k=y.slice(y.lastIndexOf(".")).toLowerCase();if(r7.has(k)){const M=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(pg(i,b)??"")}`:"";Cs(s,{kind:"image",relativePath:b,name:y,src:M});return}Cs(s,{kind:"loading"});try{const M=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:pg(i,b)})});if(!M.ok){const R=await M.json();throw new Error(R.error??"read_failed")}const A=await M.json();if(A.binary){Cs(s,{kind:"binary",name:y});return}const N=ZC(i,{relativePath:A.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(N===void 0)throw new Error("context_boundary");Cs(s,{kind:"code",relativePath:N,content:A.content,lang:A.lang,truncated:A.truncated})}catch(M){const A=M instanceof Error?M.message:"Unable to load file";A==="binary_file"?Cs(s,{kind:"binary",name:y}):Cs(s,{kind:"error",message:A})}},[i,s,t]),C=L.useCallback(async b=>{b.kind==="file"&&await S(b.relativePath,b.name)},[S]),T=L.useCallback(()=>{Cs(s,{kind:"none"}),PS(s,null)},[s]),w=L.useCallback(b=>{b.preventDefault();const v=h.current;if(!v)return;const y=v.getBoundingClientRect().width;if(!V8(y))return;const k=b.clientX,M=c.current;g(!0);const A=R=>{const I=R.clientX-k,Y=Y8(M,I,y);c.current=Y,e7(Y)},N=()=>{document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",N),g(!1)};document.addEventListener("pointermove",A),document.addEventListener("pointerup",N)},[]),_=d.kind!=="none";return L.useLayoutEffect(()=>{e.requestExtraWidth?.(Z8(_))},[e,_]),l.jsxs("div",{ref:h,className:`fexp-root${_?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:_?{gridTemplateColumns:X8(p)}:void 0,children:[_&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"fexp-viewer-pane",children:[l.jsxs("div",{className:"fexp-viewer-head",children:[l.jsx("span",{className:"fexp-viewer-filename",children:d.kind!=="loading"&&d.kind!=="error"?"relativePath"in d?d.relativePath:d.name:""}),l.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:T,"aria-label":"Close viewer",children:"✕"})]}),l.jsxs("div",{className:"fexp-viewer-body",children:[d.kind==="loading"&&l.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),d.kind==="error"&&l.jsx("div",{className:"fexp-viewer-error",children:d.message}),d.kind==="code"&&d.lang==="markdown"&&l.jsx(G8,{content:d.content,onOpenPath:S,relativePath:d.relativePath,theaterId:t,truncated:d.truncated,contextRelPath:i}),d.kind==="code"&&d.lang!=="markdown"&&l.jsx(_D,{content:d.content,lang:d.lang,truncated:d.truncated}),d.kind==="image"&&l.jsx(yD,{src:d.src,name:d.name}),d.kind==="binary"&&l.jsx(aD,{name:d.name})]})]}),l.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),l.jsx("div",{className:"fexp-tree-pane",children:l.jsx(iD,{files:m,theaterId:t,contextKey:s,contextRelPath:i,selectedPath:a,onSelect:C},s)})]})}function l7(){return l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:l.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 c7={id:"file-explorer",railPanels:[s7]},u7=[c7],h7={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function d7(e){const t={dirs:{},files:[]};for(const i of e){const s=i.path.split("/");s.pop();let a=t;for(const d of s)a.dirs[d]||(a.dirs[d]={dirs:{},files:[]}),a=a.dirs[d];a.files.push(i)}return t}function I2({files:e,selectedPath:t,onSelect:i}){const s=d7(e);return l.jsx(B2,{node:s,depth:0,selectedPath:t,onSelect:i})}function B2({node:e,depth:t,selectedPath:i,onSelect:s}){return l.jsxs(l.Fragment,{children:[Object.entries(e.dirs).map(([a,d])=>l.jsx(f7,{dirKey:a,node:d,depth:t,selectedPath:i,onSelect:s},a)),e.files.map(a=>l.jsx(p7,{entry:a,depth:t,selectedPath:i,onSelect:s},a.path))]})}function f7({dirKey:e,node:t,depth:i,selectedPath:s,onSelect:a}){const[d,p]=L.useState(!1),c=L.useCallback(()=>p(m=>!m),[]);let h=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const m=Object.keys(f.dirs)[0];h+="/"+m,f=f.dirs[m]}const g=i*16+12;return l.jsxs("div",{className:`diff-folder${d?" is-collapsed":""}`,children:[l.jsxs("button",{type:"button",className:"diff-folder-row",style:{paddingLeft:`${g}px`},onClick:c,"aria-expanded":!d,children:[l.jsx("svg",{className:"diff-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("svg",{className:"diff-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:l.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"})}),l.jsx("span",{className:"diff-folder-name",children:h})]}),!d&&l.jsx(B2,{node:f,depth:i+1,selectedPath:s,onSelect:a})]})}function p7({entry:e,depth:t,selectedPath:i,onSelect:s}){const a=e.path===i,d=L.useCallback(()=>s(e),[e,s]),p=t*16+12,c=e.path.split("/").pop()??e.path;return l.jsxs("button",{type:"button",className:`diff-file-row${a?" is-cur":""}`,style:{paddingLeft:`${p}px`},title:e.path,onClick:d,children:[l.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:h7[e.status]??e.status}),l.jsx("span",{className:"diff-file-name",children:l.jsx("span",{className:"diff-file-fn",children:c})}),l.jsxs("span",{className:"diff-nums",children:[e.additions>0&&l.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&l.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const zS="fleet-console.diff.changesCollapsed",m7={M:"modified",A:"added",D:"deleted",R:"renamed",T:"type changed",U:"untracked"};function g7(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.path.toLowerCase().includes(i)):e}function _7(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function v7({ctx:e,viewMode:t,selectedPath:i,subPath:s,onSelect:a,filterText:d}){const[p,c]=L.useState({kind:"loading"}),[h,f]=L.useState(0),[g,m]=L.useState(()=>_7(zS));L.useEffect(()=>{if(!e.theaterId){c({kind:"error",message:"no_theater"});return}let _=!1;return c({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:s})}).then(async b=>{if(!b.ok){const k=(await b.json()).error??"git_failed";_||c(k==="no_git_repo"||k==="git_unavailable"?{kind:"notice",reason:k}:{kind:"error",message:k});return}const v=await b.json();_||c({kind:"ok",files:v.files})}).catch(b=>{_||c({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.theaterId,s,h]);const S=L.useCallback(()=>f(_=>_+1),[]),C=L.useCallback(()=>{m(_=>{const b=!_;try{localStorage.setItem(zS,b?"1":"0")}catch{}return b})},[]),T=L.useMemo(()=>p.kind==="ok"?g7(p.files,d):[],[d,p]);if(p.kind==="loading")return l.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(p.kind==="notice"){const _=p.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=p.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 l.jsxs("div",{className:"diff-sections-notice",children:[l.jsx("strong",{className:"diff-notice-title",children:_}),l.jsx("span",{className:"diff-notice-body",children:b}),l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]})}if(p.kind==="error")return l.jsxs("div",{className:"diff-sections-error",children:[l.jsx("span",{children:p.message}),l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]});const w=d?`${T.length}/${p.files.length}`:String(p.files.length);return l.jsx("div",{className:"diff-sections",children:l.jsxs("div",{className:`diff-section${g?" is-collapsed":""}`,children:[l.jsxs("button",{type:"button",className:"diff-section-head",onClick:C,children:[l.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{className:"diff-section-name",children:"Changes"}),l.jsx("span",{className:"diff-count-badge",children:w})]}),!g&&l.jsx("div",{className:"diff-section-rows",children:T.length===0?l.jsx("div",{className:"diff-empty-row",children:d?"No matching items":"No changes"}):t==="tree"?l.jsx(I2,{files:T,selectedPath:i,onSelect:a}):T.map(_=>l.jsx(P2,{entry:_,isSelected:_.path===i,onSelect:a},_.path))})]})})}function P2({entry:e,isSelected:t,onSelect:i}){const s=L.useCallback(()=>i(e),[e,i]),a=e.path.endsWith("/")?e.path.slice(0,-1):e.path,d=a.lastIndexOf("/"),p=d>=0?a.slice(0,d+1):"",c=(d>=0?a.slice(d+1):a)+(e.path.endsWith("/")?"/":"");return l.jsxs("button",{type:"button",className:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[l.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":m7[e.status]??e.status,children:e.status}),l.jsxs("span",{className:"diff-file-name",children:[l.jsx("span",{className:"diff-file-fn",children:c}),p&&l.jsx("span",{className:"diff-file-dir",children:p})]}),l.jsxs("span",{className:"diff-nums",children:[e.additions>0&&l.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&l.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}function z2(e,t){return JSON.stringify([e,t])}const Sg=12,no=28,gm=3,b7=5,HS=["var(--brass)","var(--aurora)","var(--warn)","var(--positive)","color-mix(in oklch, var(--brass) 70%, var(--aurora))","color-mix(in oklch, var(--aurora) 70%, var(--positive))","color-mix(in oklch, var(--warn) 72%, var(--brass))","color-mix(in oklch, var(--ink-spectral) 76%, var(--aurora))"];function Fl(e){return e*Sg+6}function na(e){return HS[e%HS.length]??"var(--ink-fog)"}function y7({node:e,laneCount:t,collapsed:i=!1}){const s=Math.max(t,1),a=i?10:0,d=s*Sg+a,p=Fl(e.lane),c=no/2;return l.jsxs("svg",{width:d,height:no,viewBox:`0 0 ${d} ${no}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(h=>l.jsx("line",{x1:Fl(h),y1:0,x2:Fl(h),y2:no,stroke:na(h),strokeWidth:1.5},`pt-${h}`)),e.connectAbove&&l.jsx("line",{x1:p,y1:0,x2:p,y2:c-gm,stroke:na(e.lane),strokeWidth:1.5}),e.connectBelow&&l.jsx("line",{x1:p,y1:c+gm,x2:p,y2:no,stroke:na(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(h=>l.jsx("line",{x1:Fl(h),y1:0,x2:p,y2:c,stroke:na(h),strokeWidth:1.5,strokeLinecap:"round"},`mf-${h}`)),e.branchToLanes.map(h=>l.jsx("line",{x1:p,y1:c,x2:Fl(h),y2:no,stroke:na(h),strokeWidth:1.5,strokeLinecap:"round"},`bt-${h}`)),e.isHead&&l.jsx("circle",{cx:p,cy:c,r:b7,fill:"none",stroke:na(e.lane),strokeWidth:1.5}),l.jsx("circle",{cx:p,cy:c,r:gm,fill:na(e.lane)}),i&&l.jsx("text",{x:s*Sg+2,y:c+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const _m=8;function S7(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],i=[];let s=!1,a=0;for(let d=0;d<e.length;d++){const p=e[d],c=p.fullHash,h=[...p.parents],f=[];for(let w=0;w<t.length;w++)t[w]===c&&f.push(w);let g,m=!1;const S=[];if(f.length===0){const w=t.indexOf(null);w>=0?g=w:t.length<_m?(g=t.length,t.push(null)):(s=!0,g=_m-1,t[g]=null,m=!0)}else{g=Math.min(...f);for(const w of f)w!==g&&(S.push(w),t[w]=null)}const C=[];if(h.length===0)t[g]=null;else{t[g]=m?null: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,C.push(b);else if(t.length<_m){const v=t.length;t.push(w),C.push(v)}else s=!0}}const T=t.map((w,_)=>({h:w,i:_})).filter(({h:w,i:_})=>w!==null&&_!==g).map(({i:w})=>w);a=Math.max(a,g,...C,...T),i.push({lane:g,isHead:p.refs.some(w=>w==="HEAD"||w.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:h.length>0&&t[g]===h[0],passThroughLanes:T,mergeFromLanes:S,branchToLanes:C})}return{nodes:i,activeLaneCount:a+1,collapsed:s}}const x7=new Set(["import","export","from","const","let","var","function","return","await","async","new","interface","type","extends","implements","class","if","else","for","while","switch","case","of","in","typeof","void","null","undefined","true","false","as","default","throw","try","catch","describe","it","expect","require","module","public","private","readonly"]);function w7(e){let t="",i=0;const s=(a,d)=>`<span class="diff-token-${a}">${d}</span>`;for(;i<e.length;){const a=e[i];if(a==="&"){const d=e.indexOf(";",i+1);if(d>=0){t+=e.slice(i,d+1),i=d+1;continue}}if(a==="/"&&e[i+1]==="/"||a==="#"){t+=s("comment",e.slice(i));break}if(a==='"'||a==="'"||a==="`"){const d=a,p=i++;for(;i<e.length;){if(e[i]==="\\"){i+=2;continue}if(e[i++]===d)break}t+=s("string",e.slice(p,i));continue}if(/[0-9]/.test(a)&&!/[A-Za-z0-9_$]/.test(e[i-1]??"")){const d=i;for(;i<e.length&&/[0-9.xXa-fA-F]/.test(e[i]);)i++;t+=s("number",e.slice(d,i));continue}if(/[A-Za-z_$]/.test(a)){const d=i;for(;i<e.length&&/[A-Za-z0-9_$]/.test(e[i]);)i++;const p=e.slice(d,i);t+=x7.has(p)?s("keyword",p):/^[A-Z]/.test(p)?s("type",p):p;continue}if("{}()[].,;:=<>+-*/&|?!".includes(a)){t+=s("punctuation",a),i++;continue}t+=a,i++}return t}const C7=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,E7=/^diff --git a\/(.+) b\/(.+)$/;function k7(e){if(!e)return[];const t=e.split(`
|
|
214
|
+
`);t[t.length-1]===""&&t.pop();const i=[];let s=0,a=0,d=!0;for(const p of t)if(!p.startsWith("\\")){if(p.startsWith("diff --git ")){const c=E7.exec(p),h=c?.[1],f=c?.[2]??p,g=h!==void 0&&h!==f?h:void 0;i.push({kind:"file-label",text:f,oldPath:g}),d=!0;continue}if(d){if(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")){i.push({kind:"meta",text:p});continue}if(p.startsWith("index ")||p.startsWith("--- ")||p.startsWith("+++ "))continue;if(!p.startsWith("@@")){p!==""&&i.push({kind:"ctx",text:` ${p}`});continue}}if(p.startsWith("@@")){d=!1;const c=C7.exec(p);if(c){s=parseInt(c[1]??"0",10),a=parseInt(c[2]??"0",10);const h=c[3]?.trimEnd()??"",f=`@@ -${c[1]??""} +${c[2]??""} @@${h?` ${h.trimStart()}`:""}`;i.push({kind:"hunk-label",text:f})}else i.push({kind:"hunk-label",text:p});continue}p.startsWith("+")?i.push({kind:"add",text:p,newLine:a++}):p.startsWith("-")?i.push({kind:"del",text:p,oldLine:s++}):i.push({kind:"ctx",text:p,oldLine:s++,newLine:a++})}return i}function ch(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function H2({ctx:e,file:t,mode:i,subPath:s,commit:a}){const[d,p]=L.useState({kind:"loading"});if(L.useEffect(()=>{if(!e.theaterId){p({kind:"error",message:"no_theater"});return}let g=!1;return p({kind:"loading"}),a?e.api.fetch("diff","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:a.theaterId,ref:a.fullHash,filePath:t.path,...t.oldPath??a.oldPath?{oldPath:t.oldPath??a.oldPath}:{},subPath:a.subPath})}).then(async m=>{if(!m.ok)throw new Error((await m.json()).error??"git_failed");const S=await m.json();g||p({kind:"ok",result:S})}).catch(m=>{g||p({kind:"error",message:m instanceof Error?m.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 m=>{if(!m.ok)throw new Error((await m.json()).error??"git_failed");const S=await m.json();g||p({kind:"ok",result:S})}).catch(m=>{g||p({kind:"error",message:m instanceof Error?m.message:"unknown"})}),()=>{g=!0}},[e.api,e.theaterId,t.oldPath,t.path,i,s,a]),d.kind==="loading")return l.jsx("div",{className:"diff-hunk-loading",children:"Loading…"});if(d.kind==="error")return l.jsx("div",{className:"diff-hunk-error",children:d.message});const{result:c}=d,f=k7(c.content).filter(g=>g.kind!=="file-label");return l.jsxs("div",{className:"diff-hunk-wrap",children:[c.truncated&&l.jsx("div",{className:"diff-truncated-badge",children:"Diff truncated"}),l.jsx("div",{className:"diff-hunk-scroll",children:l.jsx("table",{className:"diff-hunk-table",cellSpacing:0,cellPadding:0,children:l.jsx("tbody",{children:f.map((g,m)=>l.jsx("tr",{className:`diff-line diff-line-${g.kind}`,children:g.kind==="hunk-label"?l.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:ch(g.text)}}):g.kind==="meta"?l.jsx("td",{colSpan:4,className:"diff-line-meta",dangerouslySetInnerHTML:{__html:ch(g.text)}}):g.kind==="file-label"?l.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:ch(g.text)}}):l.jsxs(l.Fragment,{children:[l.jsx("td",{className:"diff-gutter diff-gutter-old",children:g.oldLine??""}),l.jsx("td",{className:"diff-gutter diff-gutter-new",children:g.newLine??""}),l.jsx("td",{className:"diff-marker",children:g.kind==="add"?"+":g.kind==="del"?"−":""}),l.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:w7(ch(g.text.length>0?g.text.slice(1):g.text))}})]})},m))})})})]})}function $2(e,t=new Date){const i=new Date(e*1e3);if(!Number.isFinite(i.getTime()))return"—";const s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,a=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),d=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),p=Math.round((a-d)/864e5);return p===0?`Today ${s}`:p===1?`Yesterday ${s}`:`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function H_(e){const t=[];for(const i of e.refs)if(i==="HEAD")t.push({label:"HEAD",kind:"head"});else if(i.startsWith("HEAD -> refs/heads/"))t.push({label:i.slice(19),kind:"branch"});else if(i.startsWith("HEAD -> "))t.push({label:i.slice(8),kind:"branch"});else if(i.startsWith("tag: refs/tags/"))t.push({label:i.slice(15),kind:"tag"});else if(i.startsWith("tag: "))t.push({label:i.slice(5),kind:"tag"});else if(i.startsWith("refs/remotes/")){const s=i.slice(13);s.endsWith("/HEAD")||t.push({label:s,kind:"remote"})}else 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 F2=140,U2=140,Yr=4,W2=null;function T7({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:s,hunkPaneMinWidth:a,dividerWidth:d}){const p=i-a-d;return p<s?W2:Math.max(s,Math.min(p,e-t))}function A7(e){const t=F2+Yr;return`minmax(0, 1fr) ${Yr}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function R7(e){const t=U2+Yr;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Yr}px minmax(0, 1fr)`}function G2(e,t,i,s,a,d=Yr){const p=i-a-d;return p<s?W2:Math.max(s,Math.min(p,e+t))}function L7(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Yr}px minmax(120px, 1fr)`}function M7(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Yr}px minmax(140px, 1fr)`}function q2({documentTarget:e,windowTarget:t,onMove:i,onFinish:s}){let a=!0;const d=()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),t.removeEventListener("blur",p)},p=()=>{a&&(a=!1,d(),s())},c=()=>{a&&(a=!1,d())};return e.addEventListener("pointermove",i),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),t.addEventListener("blur",p),c}const N7=400,K2="fleet-console.history.listPaneWidth",$S="fleet-console.history.headerHeight",FS="fleet-console.history.fileListWidth",V2="fleet-console.history.filesView",O7=360,Y2=220,D7=214,j7=180;function I7(e,t){return t.find(i=>i.branch===null&&i.sha===e.fullHash)??null}function B7(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.subject.toLowerCase().includes(i)||s.authorName.toLowerCase().includes(i)||s.shortHash.toLowerCase().includes(i)||s.fullHash.toLowerCase().includes(i)||s.refs.some(a=>a.toLowerCase().includes(i))||H_(s).some(a=>a.label.toLowerCase().includes(i))):e}function P7(e){return e==="Escape"}function US({current:e}){return e?l.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:l.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):l.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:l.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2"})})}function z7({entry:e,checkouts:t,selected:i,graphNode:s,laneCount:a,layoutCollapsed:d,onSelect:p}){const c=H_(e),h=I7(e,t);return l.jsxs("button",{type:"button",className:`history-commit-row${i?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>p(e),children:[l.jsx("span",{className:"history-commit-subject",children:e.subject}),l.jsx("span",{className:"history-commit-sha",children:e.shortHash}),l.jsx("span",{className:"history-commit-time",children:$2(e.authorAt)}),l.jsxs("span",{className:"history-commit-badges",children:[c.map(f=>{const g=f.kind==="branch"?t.find(m=>m.branch===f.label):null;return l.jsxs("span",{className:`history-badge history-badge--${f.kind}`,children:[g&&l.jsx(US,{current:g.isCurrent}),f.label]},`${f.kind}:${f.label}`)}),h&&l.jsxs("span",{className:"history-badge history-badge--worktree",children:[l.jsx(US,{current:h.isCurrent}),"detached"]})]}),l.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:l.jsx(y7,{node:s,laneCount:a,collapsed:d})})]})}function H7({ctx:e,target:t,onSelectCommit:i,onClose:s}){const[a,d]=L.useState({kind:"loading"}),[p,c]=L.useState("details"),[h,f]=L.useState(null),[g,m]=L.useState(!1),[S,C]=L.useState(()=>xg($S,D7)),[T,w]=L.useState(()=>xg(FS,j7)),[_,b]=L.useState(G7),v=L.useRef(null),y=L.useRef(null),k=L.useRef(null),M=L.useRef(S),A=L.useRef(T),N=L.useMemo(()=>({fullHash:t.fullHash,theaterId:e.theaterId??"",subPath:e.pathContext.relPath??""}),[t.fullHash,e.theaterId,e.pathContext.relPath]);L.useEffect(()=>{let Y=!1;return d({kind:"loading"}),e.api.fetch("diff","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,ref:t.fullHash,subPath:e.pathContext.relPath??""})}).then(async z=>{if(!z.ok)throw new Error((await z.json()).error??"git_failed");return z.json()}).then(z=>{Y||(d({kind:"ok",result:z}),f(z.files[0]?.path??null))}).catch(z=>{Y||d({kind:"error",message:z instanceof Error?z.message:"unknown"})}),()=>{Y=!0}},[e.api,e.pathContext.relPath,e.theaterId,t.fullHash]),L.useEffect(()=>()=>k.current?.(),[]);const R=L.useCallback((Y,z)=>{Y.preventDefault();const q=z==="y"?v.current:y.current;if(!q)return;const B=z==="y"?M.current:A.current,W=z==="y"?Y.clientY:Y.clientX,F=z==="y"?q.getBoundingClientRect().height:q.getBoundingClientRect().width;k.current?.(),k.current=q2({documentTarget:document,windowTarget:window,onMove:P=>{const K=P,X=G2(B,(z==="y"?K.clientY:K.clientX)-W,F,120,120);X!==null&&(z==="y"?(M.current=X,C(X)):(A.current=X,w(X)))},onFinish:()=>{const P=z==="y"?M.current:A.current;try{localStorage.setItem(z==="y"?$S:FS,String(P))}catch{}k.current=null}})},[]),I=a.kind==="loading"?l.jsx("div",{className:"history-inspector-empty",children:"Loading commit…"}):a.kind==="error"?l.jsx("div",{className:"history-inspector-empty history-inspector-error",children:a.message}):(()=>{const{meta:Y,files:z}=a.result,q=z.find(O=>O.path===h)??z[0]??null,B=z.reduce((O,H)=>O+H.additions,0),W=z.reduce((O,H)=>O+H.deletions,0),F=t.entry,P=(O,H)=>{f(O.path),H&&c("changes")},K=O=>{b(O);try{localStorage.setItem(V2,O)}catch{}},X=()=>{const O=navigator.clipboard?.writeText(t.fullHash);O&&O.then(()=>{m(!0),window.setTimeout(()=>m(!1),1200)}).catch(()=>{})};return p==="details"?l.jsxs("div",{ref:v,className:"history-details-tab",style:{gridTemplateRows:L7(S)},children:[l.jsx($7,{meta:Y,entry:F,fullHash:t.fullHash,copied:g,onCopy:X,onParent:O=>i({fullHash:O})}),l.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:O=>R(O,"y")}),l.jsx(WS,{files:z,selectedPath:h,additions:B,deletions:W,viewMode:_,onViewMode:K,onSelect:O=>P(O,!0)})]}):l.jsx("div",{className:"history-changes-tab",children:l.jsxs("div",{ref:y,className:"history-changes-columns",style:{gridTemplateColumns:M7(T)},children:[l.jsx(WS,{files:z,selectedPath:h,additions:B,deletions:W,viewMode:_,onViewMode:K,onSelect:O=>P(O,!1)}),l.jsx("div",{className:"history-divider",onPointerDown:O=>R(O,"x")}),q?l.jsxs("div",{className:"history-file-diff",children:[l.jsxs("div",{className:"history-file-diff-head",children:[l.jsx("span",{title:q.path,children:q.path}),l.jsxs("div",{children:[l.jsx("button",{type:"button","aria-label":"Previous file",disabled:z.indexOf(q)===0,onClick:()=>P(z[z.indexOf(q)-1],!1),children:"‹"}),l.jsx("button",{type:"button","aria-label":"Next file",disabled:z.indexOf(q)===z.length-1,onClick:()=>P(z[z.indexOf(q)+1],!1),children:"›"})]})]}),l.jsx(H2,{ctx:e,file:q,mode:"unified",subPath:e.pathContext.relPath??"",commit:N})]}):l.jsx("div",{className:"history-inspector-empty",children:"No changed files"})]})})})();return l.jsxs("div",{className:"history-inspector",onKeyDown:Y=>{P7(Y.key)&&(Y.preventDefault(),s())},children:[l.jsxs("div",{className:"history-segmented",children:[l.jsx("button",{type:"button","aria-pressed":p==="details",onClick:()=>c("details"),children:"Details"}),l.jsxs("button",{type:"button","aria-pressed":p==="changes",onClick:()=>c("changes"),children:["Changes ",a.kind==="ok"&&l.jsx("span",{children:a.result.files.length})]}),l.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":"Close inspector",title:"Close inspector",onClick:s,children:"✕"})]}),I]})}function $7({meta:e,entry:t,fullHash:i,copied:s,onCopy:a,onParent:d}){return l.jsxs("div",{className:"history-inspector-head",children:[l.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&l.jsx("pre",{className:"history-inspector-message",children:e.body}),l.jsxs("div",{className:"history-author",children:[l.jsx("span",{className:"history-avatar",children:q7(e.authorName)}),l.jsxs("span",{children:[l.jsx("b",{children:e.authorName}),l.jsx("small",{children:e.authorEmail})]}),l.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(),children:t?.relTime??$2(e.authorAt)})]}),l.jsxs("div",{className:"history-inspector-ids",children:[l.jsxs("button",{type:"button",className:`history-sha-copy${s?" is-copied":""}`,onClick:a,children:[i,l.jsx("span",{children:s?"copied":"copy"})]}),e.parents.map(p=>l.jsxs("button",{type:"button",className:"history-parent",onClick:()=>d(p.full),children:["parent ",p.short]},p.full))]}),t&&l.jsx("div",{className:"history-ref-chips",children:H_(t).map(p=>l.jsx("span",{className:`history-badge history-badge--${p.kind}`,children:p.label},`${p.kind}:${p.label}`))})]})}function WS({files:e,selectedPath:t,additions:i,deletions:s,viewMode:a,onViewMode:d,onSelect:p}){return l.jsxs("section",{className:"history-commit-files",children:[l.jsxs("div",{className:"history-files-title",children:[l.jsx("span",{className:"history-files-label",children:"Changed files"}),l.jsxs("span",{className:"history-files-stats",children:[e.length," ",l.jsxs("i",{children:["+",i]})," ",l.jsxs("em",{children:["−",s]})]}),l.jsxs("div",{className:"diff-view-toggle history-files-view-toggle",children:[l.jsx("button",{type:"button",className:`diff-toggle-btn${a==="list"?" is-active":""}`,title:"List view","aria-label":"List view","aria-pressed":a==="list",onClick:()=>d("list"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsx("button",{type:"button",className:`diff-toggle-btn${a==="tree"?" is-active":""}`,title:"Tree view","aria-label":"Tree view","aria-pressed":a==="tree",onClick:()=>d("tree"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),l.jsx("div",{className:"history-files-scroll",children:a==="tree"?l.jsx(I2,{files:e,selectedPath:t,onSelect:p}):e.map(c=>l.jsx(P2,{entry:c,isSelected:c.path===t,onSelect:p},c.path))})]})}function F7({ctx:e}){return l.jsx(U7,{ctx:e},z2(e.theaterId,e.pathContext.relPath))}function U7({ctx:e}){const[t,i]=L.useState({kind:"loading"}),[s,a]=L.useState(null),[d,p]=L.useState(""),[c,h]=L.useState(0),[f,g]=L.useState(W7),m=L.useRef(null),S=L.useRef(null),C=L.useRef(f),T=e.pathContext.relPath??"";L.useEffect(()=>{if(!e.theaterId){i({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let v=!1;return i({kind:"loading"}),e.api.fetch("diff","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:T})}).then(async y=>{if(!y.ok)throw new Error((await y.json()).error??"git_failed");return y.json()}).then(y=>{v||i({kind:"ok",commits:y.commits,checkouts:y.checkouts,truncated:y.truncated??!1})}).catch(y=>{v||i({kind:"error",message:y instanceof Error?y.message:"unknown"})}),()=>{v=!0}},[e.api,e.theaterId,c,T]),L.useLayoutEffect(()=>(e.requestExtraWidth?.(s?N7:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,s]),L.useEffect(()=>()=>S.current?.(),[]);const w=L.useCallback(v=>{v.preventDefault();const y=m.current;if(!y)return;const k=C.current,M=v.clientX,A=y.getBoundingClientRect().width;S.current?.(),S.current=q2({documentTarget:document,windowTarget:window,onMove:N=>{const R=G2(k,N.clientX-M,A,Y2,U2,Yr);R!==null&&(C.current=R,g(R))},onFinish:()=>{try{localStorage.setItem(K2,String(C.current))}catch{}S.current=null}})},[]),_=L.useMemo(()=>t.kind==="ok"?B7(t.commits,d):[],[d,t]),b=t.kind==="ok"?S7(_):null;return l.jsxs("div",{ref:m,className:"history-root",style:s?{gridTemplateColumns:R7(f)}:void 0,children:[l.jsxs("div",{className:"history-list-pane",children:[l.jsxs("div",{className:"history-toolbar",children:[l.jsxs("div",{className:"history-filter",children:[l.jsx("input",{className:"history-filter-input",placeholder:"Filter…",value:d,onChange:v=>p(v.target.value)}),d&&l.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>p(""),children:"✕"})]}),t.kind==="ok"&&l.jsx("span",{className:"history-count",children:d?`${_.length}/${t.commits.length}`:t.commits.length})]}),l.jsxs("div",{className:"history-list",children:[t.kind==="loading"&&l.jsx("div",{className:"history-empty",children:"Loading…"}),t.kind==="error"&&l.jsxs("div",{className:"history-error",children:[t.message,l.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:()=>h(v=>v+1),children:"Retry"})]}),t.kind==="ok"&&t.commits.length===0&&l.jsx("div",{className:"history-empty",children:"No history"}),t.kind==="ok"&&t.commits.length>0&&_.length===0&&l.jsx("div",{className:"history-empty",children:"No matching items"}),t.kind==="ok"&&b&&_.map((v,y)=>l.jsx(z7,{entry:v,checkouts:t.checkouts,selected:s?.fullHash===v.fullHash,graphNode:b.nodes[y],laneCount:b.activeLaneCount,layoutCollapsed:b.collapsed,onSelect:k=>a({fullHash:k.fullHash,entry:k})},v.fullHash)),t.kind==="ok"&&(t.truncated||t.commits.length>=200)&&l.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"history-divider",onPointerDown:w}),l.jsx("div",{className:"history-detail-pane",children:l.jsx(H7,{ctx:e,target:s,onSelectCommit:a,onClose:()=>a(null)})})]})]})}function W7(){return xg(K2,O7,Y2)}function G7(){try{const e=localStorage.getItem(V2);if(e==="list"||e==="tree")return e}catch{}return"list"}function xg(e,t,i=0){try{const s=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(s)&&s>=i)return s}catch{}return t}function q7(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}function K7(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M5 3v12M10 7v8M14 11v4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),l.jsx("path",{d:"M5 7c1.8 0 2.4 0 5 0M10 11c1.4 0 2.2 0 4 0",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}const V7={id:"history",title:"History",icon:()=>l.jsx(K7,{}),pathAware:!0,render:e=>l.jsx(F7,{ctx:e})},wg=new Set;let $_={file:null};function X2(){for(const e of wg)e()}function Y7(e){return wg.add(e),()=>{wg.delete(e)}}function GS(){return $_}function X7(e,t){const i=L.useSyncExternalStore(Y7,GS,GS);return!i.file||i.file.theaterId!==e||i.file.subPath!==t?null:i.file}function Z7(e,t,i){$_={file:{entry:e,subPath:t,theaterId:i}},X2()}function qS(){$_={file:null},X2()}const Z2="fleet-console.diff.viewMode",J2="fleet-console.diff.listPaneWidth",J7=400,Q7=248,Q2=220;function eI(){try{const e=localStorage.getItem(Z2);if(e==="list"||e==="tree")return e}catch{}return"list"}function tI(){try{const e=localStorage.getItem(J2),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(Q2,t)}catch{}return Q7}function nI(e){return e.entry.status==="U"?"untracked":"unified"}function iI({ctx:e}){const t=z2(e.theaterId,e.pathContext.relPath);return l.jsx(rI,{ctx:e},t)}function rI({ctx:e}){const[t,i]=L.useState(eI),[s,a]=L.useState(""),d=e.pathContext.relPath??"",p=X7(e.theaterId??null,d),[c,h]=L.useState(tI),f=L.useRef(c),g=L.useRef(null),[m,S]=L.useState(!1);L.useLayoutEffect(()=>()=>qS(),[]);const C=L.useCallback(v=>{e.theaterId&&Z7(v,d,e.theaterId)},[e.theaterId,d]),T=L.useCallback(()=>qS(),[]),w=L.useCallback(v=>{i(v);try{localStorage.setItem(Z2,v)}catch{}},[]),_=L.useCallback(v=>{v.preventDefault();const y=g.current;if(!y)return;const k=y.getBoundingClientRect().width,M=v.clientX,A=f.current;S(!0);const N=I=>{const Y=T7({startWidth:A,dx:I.clientX-M,containerWidth:k,listPaneMinWidth:Q2,hunkPaneMinWidth:F2,dividerWidth:Yr});Y!==null&&(f.current=Y,h(Y))},R=()=>{document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",R),S(!1);try{localStorage.setItem(J2,String(f.current))}catch{}};document.addEventListener("pointermove",N),document.addEventListener("pointerup",R)},[]);L.useLayoutEffect(()=>(e.requestExtraWidth?.(p?J7:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,p]);const b=p?nI(p):null;return l.jsxs("div",{ref:g,className:`diff-root${p?" has-hunk":""}${m?" is-dragging":""}`,style:p?{gridTemplateColumns:A7(c)}:void 0,children:[p&&b?l.jsxs("div",{className:"diff-hunk-pane",children:[l.jsxs("div",{className:"diff-hunk-head",children:[l.jsx("span",{children:p.entry.path}),l.jsx("button",{type:"button",onClick:T,children:"✕"})]}),l.jsx(H2,{ctx:e,file:p.entry,mode:b,subPath:p.subPath})]}):null,p?l.jsx("div",{className:"diff-divider",onPointerDown:_,"aria-hidden":"true"}):null,l.jsxs("div",{className:"diff-list-pane",children:[l.jsxs("div",{className:"diff-toolbar",children:[l.jsxs("div",{className:"diff-filter",children:[l.jsx("input",{type:"text",className:"diff-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:s,onChange:v=>a(v.target.value)}),s?l.jsx("button",{type:"button",className:"diff-filter-clear","aria-label":"Clear filter",onClick:()=>a(""),children:"✕"}):null]}),l.jsxs("div",{className:"diff-view-toggle",children:[l.jsx("button",{type:"button",className:`diff-toggle-btn${t==="list"?" is-active":""}`,title:"List view","aria-pressed":t==="list",onClick:()=>w("list"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),l.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),l.jsx("button",{type:"button",className:`diff-toggle-btn${t==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":t==="tree",onClick:()=>w("tree"),children:l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),l.jsx(v7,{ctx:e,viewMode:t,selectedPath:p?.entry.path??null,subPath:d,onSelect:C,filterText:s})]})]})}function sI(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),l.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),l.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const aI={id:"diff",title:"Diff",icon:()=>l.jsx(sI,{}),pathAware:!0,render:e=>l.jsx(iI,{ctx:e})},oI={id:"diff",railPanels:[aI,V7]},lI=[oI],uh=["claude-code","codex","cursor","opencode"],cI={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},uI="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function hI({source:e,skill:t,theaterId:i,relPath:s,onCancel:a,onStarted:d,jobLog:p}){const[c,h]=L.useState(i?"project":"global"),[f,g]=L.useState(!0),[m,S]=L.useState(new Set(uh)),{status:C,start:T}=p,w=C==="running",_=C==="done",b=C==="error",v=L.useCallback(()=>{g(!0),S(new Set(uh))},[]),y=L.useCallback(M=>{g(!1),S(A=>{const N=new Set(A);return N.has(M)?N.delete(M):N.add(M),N})},[]),k=L.useCallback(()=>{const M=f?uh:Array.from(m);if(M.length===0)return;const A={source:e,skill:t,scope:c,agents:M};c==="project"&&i&&(A.theaterId=i,A.relPath=s),T("/plugins/skills/install",A),d(c)},[f,m,e,t,c,i,s,T,d]);return l.jsxs("div",{className:"skills-install-flow",children:[l.jsxs("div",{className:"skills-scope-toggle",children:[l.jsx("button",{type:"button",className:`skills-scope-btn${c==="project"?" is-active":""}`,onClick:()=>h("project"),disabled:!i||w||_,title:i?void 0:"Select a Theater to install project skills",children:"Project"}),l.jsx("button",{type:"button",className:`skills-scope-btn${c==="global"?" is-active":""}`,onClick:()=>h("global"),disabled:w||_,children:"Global"})]}),l.jsxs("div",{className:"skills-agents-row",children:[l.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:v,disabled:w||_,children:"All agents"}),uh.map(M=>l.jsx("button",{type:"button",className:`skills-agent-chip${!f&&m.has(M)?" is-active":""}`,onClick:()=>y(M),disabled:w||_,children:cI[M]},M))]}),l.jsx("p",{className:"skills-permission-warning",children:uI}),!w&&!_&&!b&&l.jsxs("div",{className:"skills-card-actions",children:[l.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:a,children:"Cancel"}),l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:k,disabled:!f&&m.size===0,children:"Install now"})]})]})}const dI=4e3;function eE({status:e,lines:t,runningLabel:i,doneLabel:s,errorLabel:a,onDismiss:d,onRetry:p}){const[c,h]=L.useState(!1),f=L.useRef(null),g=L.useRef(null);L.useEffect(()=>{e==="running"&&h(!1)},[e]),L.useEffect(()=>{const _=f.current;_&&(_.scrollTop=_.scrollHeight)},[t]),L.useEffect(()=>{if(e==="done")return g.current=setTimeout(()=>{h(!1),d()},dI),()=>{g.current&&(clearTimeout(g.current),g.current=null)}},[e,d]);const m=L.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null),h(!1),d()},[d]),S=L.useCallback(()=>h(_=>!_),[]);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:a;return l.jsxs("div",{className:"skills-dock",children:[c&&l.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((_,b)=>l.jsx("div",{className:"skills-dock-log-line",children:_},b)),e==="done"&&l.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",s]}),e==="error"&&l.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",a]})]}),l.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${c?" is-open":""}`,"aria-expanded":c,onClick:S,onKeyDown:_=>{_.target===_.currentTarget&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),S())},children:[l.jsx("span",{className:C,"aria-hidden":"true"}),l.jsx("span",{className:T,"aria-live":"polite",children:w}),e==="running"&&t.length>0&&l.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&l.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"}),e==="error"&&l.jsxs(l.Fragment,{children:[p!=null&&l.jsx("button",{type:"button",className:"skills-dock-retry",onClick:_=>{_.stopPropagation(),p()},children:"Retry"}),l.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"})]}),l.jsx("span",{className:`skills-dock-chevron${c?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const fI={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},Cg=new Set;let Nn=fI;function Is(){for(const e of Cg)e()}function pI(e){return Cg.add(e),()=>{Cg.delete(e)}}function KS(){return Nn}function F_(){return L.useSyncExternalStore(pI,KS,KS)}function hh(e){Nn={...Nn,activeTab:e},Is()}function VS(e){Nn={...Nn,scope:e},Is()}function mI(e){Nn={...Nn,filterText:e},Is()}function gI(e){Nn={...Nn,searchQuery:e},Is()}function lo(e,t){Nn={...Nn,searchResults:e,searchLoading:t},Is()}function td(e,t){return JSON.stringify([e,t])}function Eg(e,t){return e.installedContextKey===t}function vm(e,t,i){Nn.installedContextKey===e&&(Nn={...Nn,installedList:t,installedLoading:i},Is())}function kg(e){Nn={...Nn,installFormOpenId:e},Is()}function _I(e){Nn={...Nn,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Is()}const YS=750;function tE(){const[e,t]=L.useState({status:"idle",lines:[]}),i=L.useRef(null),s=L.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);L.useEffect(()=>()=>s(),[s]);const a=L.useCallback(()=>{s(),t({status:"idle",lines:[]})},[s]),d=L.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:f}=await h.json();let g=0;const m=async()=>{const S=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${g}`).catch(()=>null);if(!S?.ok){t(T=>({...T,status:"error"}));return}const C=await S.json();g=C.nextCursor,t(T=>({...T,lines:[...T.lines,...C.lines]})),C.status==="running"?i.current=setTimeout(()=>{m()},YS):t(T=>({...T,status:C.status}))};i.current=setTimeout(()=>{m()},YS)})()},[s]);return{...e,start:d,reset:a}}const vI=300,Th=2;function bI(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function yI(e){if(e.length<Th){lo([],!1);return}lo([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){lo([],!1);return}const i=await t.json();lo(i.skills??[],!1)}catch{lo([],!1)}}function SI({result:e,theaterId:t,relPath:i,isFormOpen:s,onInstallClick:a,onReadMore:d,onInstallStarted:p,jobLog:c}){const h={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return l.jsxs("div",{className:`skills-card${s?" is-expanded":""}`,children:[l.jsxs("div",{className:"skills-card-header",children:[l.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>d(h,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&l.jsx("span",{className:"skills-card-installs",children:bI(e.installs)})]}),l.jsx("span",{className:"skills-card-meta",children:e.source}),l.jsx("div",{className:"skills-card-actions",children:l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:a,children:s?"Cancel":"Install"})}),s&&l.jsx(hI,{source:e.source,skill:e.name,theaterId:t,relPath:i,onCancel:a,onStarted:f=>p(e.name,f),jobLog:c})]})}function xI({theaterId:e,relPath:t,onReadMore:i,onInstallSuccess:s}){const{searchQuery:a,searchResults:d,searchLoading:p,installFormOpenId:c}=F_(),h=L.useRef(null),f=tE(),[g,m]=L.useState(null),S=L.useCallback(T=>{if(gI(T),h.current&&clearTimeout(h.current),T.length<Th){lo([],!1);return}h.current=setTimeout(()=>{yI(T)},vI)},[]);L.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),L.useEffect(()=>{f.status!=="done"||!g||(s(g.name,g.scope),kg(null),m(null))},[f.status,g,s]);const C=g?`Installing ${g.name}…`:"Installing…";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"skills-tab-body",children:[l.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:a,onChange:T=>S(T.target.value),"aria-label":"Search skills registry"}),p&&l.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!p&&a.length>=Th&&d.length===0&&l.jsxs("div",{className:"skills-empty-state",children:['No results for "',a,'".']}),!p&&a.length>0&&a.length<Th&&l.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),l.jsx("div",{className:"skills-card-list",children:d.map(T=>l.jsx(SI,{result:T,theaterId:e,relPath:t,isFormOpen:c===T.id,onInstallClick:()=>kg(c===T.id?null:T.id),onReadMore:i,onInstallStarted:(w,_)=>m({name:w,scope:_}),jobLog:f},T.id))})]}),l.jsx(eE,{status:f.status,lines:f.lines,runningLabel:C,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const wI=2600;function CI({skill:e,onReadMore:t,onUpdate:i,onRemove:s,isUpdating:a}){const[d,p]=L.useState(!1),c=L.useRef(null),h=L.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]),f=L.useCallback(()=>{d?(h(),p(!1),s?.(e.name,e.scope)):(p(!0),c.current=setTimeout(()=>p(!1),wI))},[d,h,s,e.name,e.scope]);return L.useEffect(()=>()=>h(),[h]),l.jsxs("div",{className:"skills-card",children:[l.jsxs("div",{className:"skills-card-header",children:[l.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),l.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&l.jsx("span",{className:"skills-card-meta",children:e.source}),l.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),l.jsxs("div",{className:"skills-card-actions",children:[i&&l.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>i(e.scope),disabled:a,children:a?"Updating…":"Update all"}),s&&l.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${d?" is-armed":""}`,onClick:f,"aria-label":d?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:d?"Remove?":"✕"})]})]})}async function EI(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",s=await fetch(`/plugins/skills/list${i}`);return s.ok?(await s.json()).skills??[]:[]}function kI({theaterId:e,relPath:t,onReadMore:i,refreshKey:s}){const a=F_(),{scope:d,filterText:p}=a,c=td(e,t),h=Eg(a,c)?a.installedList:[],f=Eg(a,c)&&a.installedLoading,g=tE(),m=L.useRef(null),S=L.useCallback((y,k)=>{const M=td(y,k);vm(M,[],!0),EI(y,k).then(A=>vm(M,A,!1)).catch(()=>vm(M,[],!1))},[]);L.useEffect(()=>{S(e,t)},[e,t,S,s]),L.useEffect(()=>{(g.status==="done"||g.status==="error")&&S(e,t)},[g.status,e,t,S]);const C=L.useCallback(y=>{const k=y;m.current=k;const M={scope:k};k==="project"&&e&&(M.theaterId=e,M.relPath=t),g.start("/plugins/skills/update",M)},[e,t,g]),T=L.useCallback((y,k)=>{const M={scope:k,skill:y};k==="project"&&e&&(M.theaterId=e,M.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}).then(()=>S(e,t)).catch(()=>null)},[e,t,S]),w=L.useCallback(()=>{m.current&&C(m.current)},[C]),_=d==="project"&&!e?"global":d,b=h.filter(y=>y.scope!==_?!1:p?y.name.toLowerCase().includes(p.toLowerCase()):!0),v=g.status==="running"&&m.current===_;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"skills-tab-body",children:[l.jsxs("div",{className:"skills-scope-toggle",children:[l.jsx("button",{type:"button",className:`skills-scope-btn${_==="project"?" is-active":""}`,onClick:()=>VS("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),l.jsx("button",{type:"button",className:`skills-scope-btn${_==="global"?" is-active":""}`,onClick:()=>VS("global"),children:"Global"})]}),l.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:p,onChange:y=>mI(y.target.value),"aria-label":"Filter installed skills"}),f&&l.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&b.length===0&&l.jsx("div",{className:"skills-empty-state",children:p?"No skills match the filter.":`No ${_} skills installed.`}),l.jsx("div",{className:"skills-card-list",children:b.map(y=>l.jsx(CI,{skill:y,onReadMore:i,onUpdate:C,onRemove:T,isUpdating:v},`${y.scope}:${y.name}`))})]}),l.jsx(eE,{status:g.status,lines:g.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:g.reset,onRetry:w})]})}function bm(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 TI({content:e}){const t=L.useMemo(()=>{const a=Sc(e).html,d=new DOMParser().parseFromString(a,"text/html");return bm(d.body),d.body.innerHTML},[e]),i=L.useRef(null);L.useEffect(()=>{const a=i.current;if(!a)return;bm(a);const d=new MutationObserver(()=>bm(a));return d.observe(a,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>d.disconnect()},[t]);const s=L.useCallback(a=>{const d=a.target.closest('[data-action="copy-code"]');if(!d)return;const p=d.closest("pre")?.getAttribute("data-code");if(!p)return;navigator.clipboard?.writeText(p);const c=d.textContent;d.textContent="Copied",window.setTimeout(()=>{d.textContent=c},1200)},[]);return l.jsx("div",{ref:i,className:"markdown-body",onClick:s,dangerouslySetInnerHTML:{__html:t}})}const AI=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),RI="Skills run with full agent permissions. Review before use.";function LI(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(AI)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function MI({skill:e,isInstalled:t,theaterId:i,relPath:s,onClose:a,onInstall:d}){const[p,c]=L.useState(null),[h,f]=L.useState(!1),g=L.useRef(null),m=L.useRef(null),S=L.useRef(null);if(L.useEffect(()=>{e&&g.current===null&&(g.current=document.activeElement)},[e]),L.useEffect(()=>{if(!e){c(null);return}f(!0),c(null);let T=!1;return(async()=>{try{let _;if(t){const v={scope:e.scope,skill:e.name};e.scope==="project"&&i&&(v.theaterId=i,v.relPath=s),_=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}else _=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:i,relPath:s})});if(T)return;if(!_.ok){f(!1);return}const b=await _.json();T||(c(b.markdown??""),f(!1))}catch{T||f(!1)}})(),()=>{T=!0}},[e,t,i,s]),L.useEffect(()=>{if(!e)return;const T=w=>{w.key==="Escape"?(w.preventDefault(),a()):w.key==="Tab"&&LI(w,S.current),w.stopImmediatePropagation()};return m.current?.focus(),window.addEventListener("keydown",T,!0),()=>{window.removeEventListener("keydown",T,!0);const w=g.current;g.current=null,w?.focus?.()}},[e,a]),L.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const C=e.displayPath||e.source||null;return js.createPortal(l.jsx("div",{className:"skills-overlay-backdrop",onClick:a,"aria-hidden":"true",children:l.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:T=>T.stopPropagation(),children:[l.jsxs("div",{className:"skills-overlay-header",children:[l.jsx("span",{className:"skills-overlay-title",children:e.name}),C&&l.jsx("span",{className:"skills-overlay-meta",children:C}),l.jsx("button",{ref:m,type:"button",className:"skills-overlay-close",onClick:a,"aria-label":"Close",children:"✕"})]}),l.jsxs("div",{className:"skills-overlay-body",children:[h&&l.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!h&&p===null&&l.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),p!==null&&l.jsx(TI,{content:p})]}),l.jsxs("div",{className:"skills-overlay-footer",children:[l.jsx("p",{className:"skills-permission-warning",children:RI}),!t&&l.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{a(),d()},children:"Install"})]})]})}),document.body)}const NI=3200;function OI({message:e,onDismiss:t}){return L.useEffect(()=>{if(!e)return;const i=setTimeout(t,NI);return()=>clearTimeout(i)},[e,t]),e?l.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function DI({ctx:e}){const t=td(e.theaterId,e.pathContext.relPath);return l.jsx(jI,{ctx:e},t)}function jI({ctx:e}){const{theaterId:t}=e,i=F_(),{activeTab:s}=i,a=td(e.theaterId,e.pathContext.relPath),[d,p]=L.useState(null),[c,h]=L.useState(null),[f,g]=L.useState(0),m=Eg(i,a)?i.installedList.length:0;L.useLayoutEffect(()=>{_I(a)},[a]);const S=L.useCallback(_=>{p({skill:_,isInstalled:!0})},[]),C=L.useCallback((_,b)=>{p({skill:_,isInstalled:!1,registryId:b})},[]),T=L.useCallback((_,b)=>{h(`Installed ${_} to ${b}`),g(v=>v+1),hh("installed")},[]),w=L.useCallback(()=>{d?.registryId&&(kg(d.registryId),hh("find")),p(null)},[d]);return l.jsxs("div",{className:"skills-root",children:[l.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":s==="installed",className:`skills-tab-btn${s==="installed"?" is-active":""}`,onClick:()=>hh("installed"),children:["Installed",m>0?` ${m}`:""]}),l.jsx("button",{type:"button",role:"tab","aria-selected":s==="find",className:`skills-tab-btn${s==="find"?" is-active":""}`,onClick:()=>hh("find"),children:"Find"})]}),s==="installed"?l.jsx(kI,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,refreshKey:f}):l.jsx(xI,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:C,onInstallSuccess:T}),l.jsx(OI,{message:c,onDismiss:()=>h(null)}),l.jsx(MI,{skill:d?.skill??null,isInstalled:d?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>p(null),onInstall:w})]})}function II(){return l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:l.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 BI={id:"skills",title:"Skills",icon:II,pathAware:!0,render:e=>l.jsx(DI,{ctx:e})},PI={id:"skills",railPanels:[BI]},zI=[PI],nE=[...GO,...u7,...lI,...zI],HI=rE(nE),iE=L.createContext(HI),$I=iE.Provider;async function FI(){const e=[...nE],t=new Set(e.map(s=>s.id)),i=await UI();for(const s of i){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}const a=await WI(s);if(a){if(t.has(a.id)){console.warn(`Skipping external plugin with duplicate id: ${a.id}`);continue}t.add(a.id),e.push(a)}}return rE(e)}function jo(){return L.useContext(iE)}async function UI(){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(qI):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function WI(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return GI(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 rE(e){const t=new Set,i=[];for(const s of e)for(const a of s.railPanels??[]){if(t.has(a.id)){console.warn(`Skipping rail panel with duplicate id: ${a.id}`);continue}t.add(a.id),i.push(a)}return{plugins:e,operationKinds:e.flatMap(s=>s.operationKinds??[]),settingsSections:e.flatMap(s=>s.settingsSections??[]),notificationKinds:e.flatMap(s=>s.notificationKinds??[]),railPanels:i}}function GI(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function qI(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 KI=288,VI=520,Ul=12;function sE({anchor:e,viewportBounds:t,placement:i="cursor",catalog:s,canLaunch:a,renderKindIcon:d,onLaunchKind:p,onClose:c}){const h=L.useRef(null),f=L.useRef(null);return L.useEffect(()=>{const g=S=>{h.current?.contains(S.target)||c()},m=S=>{S.key==="Escape"&&c()};return document.addEventListener("mousedown",g),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",m)}},[c]),L.useEffect(()=>{f.current?.focus()},[]),l.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:h,style:XI(e,t,i),"data-canvas-blocker":!0,children:l.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:f,children:[l.jsxs("div",{className:"canvas-context-menu-head",children:[l.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:l.jsx(YI,{})}),l.jsx("span",{className:"canvas-context-menu-head-text",children:l.jsx("strong",{children:"Canvas controls"})})]}),l.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),s.length>0?s.map((g,m)=>l.jsxs("div",{children:[m>0?l.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,l.jsx("p",{className:"canvas-context-menu-plugin",children:g.title}),g.kinds.map(S=>{const C=S.disabled===!0||!a;return l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:C,title:S.disabledReason,onClick:()=>p(g.id,S),children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:d(g.id,S)??l.jsx(ZI,{})}),l.jsx("span",{className:"theater-menu-label",children:S.title}),S.disabledReason?l.jsx("span",{className:"operation-launch-menu-reason",children:S.disabledReason}):null]},`${g.id}:${S.id}`)})]},g.id)):l.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]})})}function YI(){return l.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),l.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"}),l.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function XI(e,t,i){const s=t?Math.max(Ul,Math.min(e.x,t.width-KI-Ul)):e.x;if(i==="above")return{left:s,bottom:Math.max(Ul,e.y)};const a=t?Math.max(Ul,Math.min(e.y,t.height-VI-Ul)):e.y;return{left:s,top:a}}function ZI(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function aE(e,t){const i=document.activeElement;e===null||!(i instanceof Node)||!e.contains(i)||document.querySelector(t)?.focus()}const dh="directory-browser-sectors";function oE({open:e,onCancel:t,onConfirm:i}){const[s,a]=L.useState(null),[d,p]=L.useState(null),[c,h]=L.useState(null),[f,g]=L.useState(""),[m,S]=L.useState(""),[C,T]=L.useState(0),w=L.useRef(null),_=L.useRef(null),b=async(F,P)=>{p(F),h(null),g(""),T(0);try{const K=await GR(F,P);a(K)}catch(K){if(K instanceof DOMException&&K.name==="AbortError")return;h(K instanceof dt?K.message:String(K))}finally{p(null)}};L.useEffect(()=>{if(!e)return;const F=new AbortController;return b(null,F.signal),()=>F.abort()},[e]),L.useEffect(()=>{e&&w.current?.focus()},[e,s?.path]);const v=s?.entries??[],y=L.useMemo(()=>{const F=f.trim().toLowerCase();return F===""?v:v.filter(P=>P.name.toLowerCase().includes(F))},[v,f]),k=L.useMemo(()=>s?JI(s):[],[s]),M=s?XS(s.path):null,A=s?.roots??[],N=A.length>1,R=y.length===0?-1:Math.min(C,y.length-1);if(L.useEffect(()=>{if(R<0)return;_.current?.querySelector(`[data-index="${R}"]`)?.scrollIntoView({block:"nearest"})},[R,s?.path]),!e)return null;const I=F=>{F.accessible&&d===null&&b(F.path)},Y=()=>{s?.parentPath!=null&&d===null&&b(s.parentPath)},z=()=>{const F=m.trim();F!==""&&d===null&&b(F)},q=s?.path??null,B=R>=0?`${dh}-${R}`:void 0,W=F=>{switch(F.key){case"Escape":f!==""?g(""):t();return;case"ArrowDown":F.preventDefault(),T(P=>Math.min(P+1,Math.max(y.length-1,0)));return;case"ArrowUp":F.preventDefault(),T(P=>Math.max(P-1,0));return;case"Enter":{F.preventDefault();const P=y[R];P&&I(P);return}case"Backspace":f===""&&(F.preventDefault(),Y());return;default:return}};return js.createPortal(l.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[l.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),l.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:W,children:[l.jsxs("header",{className:"directory-browser-header",children:[l.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:l.jsx(tB,{})}),l.jsxs("div",{className:"directory-browser-heading",children:[l.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),l.jsx("h2",{children:"Add Theater"})]}),l.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),N?l.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[l.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),l.jsx("div",{className:"directory-browser-root-chips",children:A.map(F=>{const P=M!=null&&XS(F)===M;return l.jsx("button",{type:"button",className:`directory-browser-root-chip ${P?"is-active":""}`,"aria-current":P?"location":void 0,disabled:d!==null,title:F,onClick:()=>{d===null&&b(F)},onKeyDown:K=>K.stopPropagation(),children:eB(F)},F)})})]}):null,l.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:k.map((F,P)=>{const K=P===k.length-1;return l.jsxs("span",{className:"directory-browser-course-seg",children:[P>0?l.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,l.jsx("button",{type:"button",className:`directory-browser-crumb ${K?"is-current":""}`,"aria-current":K?"location":void 0,disabled:K||d!==null,title:F.path,onClick:()=>{b(F.path)},children:F.label})]},F.path)})}),l.jsxs("div",{className:"directory-browser-toolbar",children:[l.jsxs("div",{className:"directory-browser-filter",children:[l.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:l.jsx(iB,{})}),l.jsx("input",{ref:w,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":dh,value:f,spellCheck:!1,autoComplete:"off",onChange:F=>{g(F.target.value),T(0)}})]}),l.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||d!==null,title:"Up one folder (Backspace)",onClick:Y,children:[l.jsx(rB,{}),l.jsx("span",{children:"Up"})]})]}),l.jsxs("div",{className:"directory-browser-jump",children:[l.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:m,spellCheck:!1,autoComplete:"off",onChange:F=>S(F.target.value),onKeyDown:F=>{F.stopPropagation(),F.key==="Enter"&&(F.preventDefault(),z())}}),l.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:m.trim()===""||d!==null,onClick:z,onKeyDown:F=>F.stopPropagation(),children:"Go"})]}),c?l.jsx("p",{className:"directory-browser-error",role:"alert",children:c}):null,l.jsx("div",{className:"directory-browser-list",id:dh,role:"listbox","aria-label":"Folders","aria-busy":d!==null,"aria-activedescendant":B,ref:_,children:d!==null?l.jsxs("p",{className:"directory-browser-state is-live",children:[l.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):y.length===0?l.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):y.map((F,P)=>l.jsxs("div",{id:`${dh}-${P}`,"data-index":P,role:"option","aria-selected":P===R,"aria-disabled":!F.accessible,className:`directory-browser-sector ${P===R?"is-active":""} ${F.accessible?"":"is-locked"}`,title:F.path,onClick:()=>{T(P),I(F)},children:[l.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:l.jsx(nB,{})}),l.jsx("span",{className:"directory-browser-sector-name",children:F.name}),F.accessible?l.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):l.jsxs("span",{className:"directory-browser-sector-lock",children:[l.jsx(sB,{})," Locked"]})]},F.path))}),s?.truncated?l.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,l.jsxs("footer",{className:"directory-browser-actions",children:[l.jsxs("div",{className:"directory-browser-target",children:[l.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),l.jsx("span",{className:"directory-browser-target-path",title:q??"",children:q??"Loading…"})]}),l.jsxs("div",{className:"directory-browser-buttons",children:[l.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),l.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:q===null||d!==null,onClick:()=>q&&i(q),children:"Add Theater"})]})]})]})]}),document.body)}function JI(e){if(QI(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:\\",a=[{label:s,path:s}];let d=s.replace(/\\$/,"");for(const p of e.path.slice(s.length).split("\\").filter(Boolean))d+=`\\${p}`,a.push({label:p,path:d});return a}function QI(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function XS(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function eB(e){return e.replace(/[\\/]+$/,"")||e}function tB(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),l.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 nB(){return l.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:l.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 iB(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function rB(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 sB(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.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 bd=[{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 ko(e){return bd.find(t=>t.key===e)?.color??null}function ZS(e){return typeof e.accent=="string"?e.accent:null}const JS=8,aB=260;function QS(e){const{anchor:t,onClose:i}=e,[s,a]=L.useState(void 0);return L.useLayoutEffect(()=>{const d=Math.max(8,Math.min(t.left,window.innerWidth-208)),p=t.bottom+JS,c=p+aB>window.innerHeight;a(c?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-t.top+JS)}:{position:"fixed",left:d,top:Math.round(p)})},[t]),L.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",d),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]),js.createPortal(l.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?l.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:s,onPointerDown:d=>d.stopPropagation(),children:e.kind==="chip"?l.jsx(oB,{...e}):l.jsx(lB,{...e})}):null}),document.body)}function oB({operation:e,groups:t,accentKey:i,actions:s,onClose:a}){const[d,p]=L.useState(!1),[c,h]=L.useState(`Group ${t.length+1}`),f=L.useRef(!1),g=L.useRef(null);L.useEffect(()=>{d&&g.current?.select()},[d]);const m=()=>{const S=c.trim();S&&(s.onCreateGroup(S),a())};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(S=>{const C=ko(S.color),T=e.groupId===S.id;return l.jsxs("button",{type:"button",className:`group-context-menu-item${T?" is-selected":""}`,role:"menuitemradio","aria-checked":T,onClick:()=>{s.onSetGroupId(T?null:S.id),a()},children:[l.jsx("span",{className:"group-context-menu-item__dot",style:C?{background:C}:void 0,"aria-hidden":"true"}),l.jsx("span",{className:"group-context-menu-item__name",children:S.name}),T?l.jsx(cB,{}):null]},S.id)}),d?l.jsx("input",{ref:g,className:"group-context-menu-new-input",type:"text",value:c,onChange:S=>h(S.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:S=>{S.key==="Enter"&&!f.current&&(S.preventDefault(),m()),S.key==="Escape"&&(S.preventDefault(),p(!1))},onBlur:()=>p(!1),"aria-label":"New group name",placeholder:"Group name"}):l.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>p(!0),children:l.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),l.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),a()},children:[l.jsx("span",{}),"None"]}),l.jsx("div",{className:"group-context-menu-swatches",children:bd.map(S=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":S.label,"aria-pressed":i===S.key,onClick:()=>{s.onSetAccent(S.key),a()},children:l.jsx("span",{style:{background:S.color}})},S.key))})]})}function lB({group:e,actions:t,onClose:i}){const[s,a]=L.useState(e.name),[d,p]=L.useState(!1),c=L.useRef(!1),h=()=>{const f=s.trim();if(!f||f===e.name){i();return}t.onRename(f),i()};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),l.jsx("div",{className:"group-context-menu-swatches",children:bd.map(f=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":f.label,"aria-pressed":e.color===f.key,onClick:()=>{t.onSetColor(f.key),i()},children:l.jsx("span",{style:{background:f.color}})},f.key))}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),l.jsx("input",{className:"group-context-menu-new-input",type:"text",value:s,onChange:f=>a(f.target.value),onCompositionStart:()=>{c.current=!0},onCompositionEnd:()=>{c.current=!1},onKeyDown:f=>{f.key==="Enter"&&!c.current&&(f.preventDefault(),h()),f.key==="Escape"&&(f.preventDefault(),i())},onBlur:h,"aria-label":"Group name"}),l.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),l.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${d?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!d){p(!0);return}t.onUngroupAll(),i()},"aria-label":d?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:d?"Confirm ungroup all?":"Ungroup all"})]})}function cB(){return l.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:l.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const uB="fleet-console.canvas.",lE="fleet-console.formation-layout",hB=400,Tg=640,Ag=400,ex=40,dB=320,fB=200,pB=8,mB=0,tx=96,gB=.25,_B=1,ym=.2,nx=.5,vB=.001,po={x:0,y:0,zoom:1},xo={viewport:po,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Rg=new Set,Lg=new Set,Mg=new Set,Ng=new Set,wc=new Map,yd=new Map;let En=null,Os=null,Ve=xo,Fn=null,vr=!1,U_=HB(),Ls=po,da=null,nd=0;function W_(e){return Rg.add(e),()=>{Rg.delete(e)}}function To(){return Ve}function Og(){return Fn}function Dg(){return vr}function ix(){return U_}function bB(){return En}function cE(){return L.useSyncExternalStore(W_,To,To)}function uE(){return L.useSyncExternalStore(MB,sx,sx)}function Sd(){return L.useSyncExternalStore(RB,Dg,Dg)}function hE(){return L.useSyncExternalStore(LB,ix,ix)}function dE(){return L.useSyncExternalStore(W_,ax,ax)}function bi(e){Ve={viewport:e.viewport??Ve.viewport,operations:e.operations??Ve.operations,operationOrder:e.operationOrder??Ve.operationOrder,operationAccent:e.operationAccent??Ve.operationAccent,minimized:e.minimized??Ve.minimized,collapsedGroups:e.collapsedGroups??Ve.collapsedGroups},IB(),mE()}function yB(e){const t=Ve.collapsedGroups.includes(e)?Ve.collapsedGroups.filter(i=>i!==e):[...Ve.collapsedGroups,e];bi({collapsedGroups:t})}function SB(){return L.useSyncExternalStore(W_,ox,ox)}function jg(e){K_();const t=V_(e);Ls=t,bi({viewport:t})}function fE(e){const t=V_(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||jB()){jg(t);return}Ls=t,da===null&&(da=window.requestAnimationFrame(_E))}function Ig(e,t){const i=ga();bi({operations:{...Ve.operations,[e]:{...Y_(t,i),zIndex:i}}})}function xB(e,t,i=dB,s=fB,a=pB,d=mB,p="grid"){if(!Number.isFinite(t)||t<=0)return[];const c=Math.max(0,e.width-d*2),h=Math.max(0,e.height-d*2);if(p==="columns"){const w=Math.max(0,c-a*(t-1)),_=w/t,b=Math.min(i,_),v=Math.min(Math.max(b,_),w),y=h,k=Math.min(s,y),M=Math.min(Math.max(k,y),h);return Array.from({length:t},(A,N)=>({x:e.x+d+N*(v+a),y:e.y+d,width:v,height:M}))}if(p==="rows"){const w=c,_=Math.min(i,w),b=Math.min(Math.max(_,w),c),v=Math.max(0,h-a*(t-1)),y=v/t,k=Math.min(s,y),M=Math.min(Math.max(k,y),v);return Array.from({length:t},(A,N)=>({x:e.x+d,y:e.y+d+N*(M+a),width:b,height:M}))}const f=Math.ceil(Math.sqrt(t)),g=Math.ceil(t/f),m=Math.max(0,h-a*(g-1)),S=m/g,C=Math.min(s,S),T=Math.min(Math.max(C,S),m);return Array.from({length:t},(w,_)=>{const b=Math.floor(_/f),v=_%f,y=b===g-1?t-(g-1)*f:f,k=Math.max(0,c-a*(y-1)),M=k/y,A=Math.min(i,M),N=Math.min(Math.max(A,M),k);return{x:e.x+d+v*(N+a),y:e.y+d+b*(T+a),width:N,height:T}})}function pE(e){Ve.minimized.includes(e)||(Fn===e&&Xr(),bi({minimized:[...Ve.minimized,e]}))}function wB(e){const t=new Set,s=[...Ve.minimized.filter(a=>t.has(a)||!(a in Ve.operations)?!1:(t.add(a),!0)),...e.filter(a=>t.has(a)||!(a in Ve.operations)?!1:(t.add(a),!0))];gE(Ve.minimized,s)||(Fn&&s.includes(Fn)&&Xr(),bi({minimized:s}))}function fh(e){if(!Ve.minimized.includes(e))return;Fn===e&&Xr();const t=Ve.minimized.filter(a=>a!==e),i=Ve.operations[e];if(!i){bi({minimized:t});return}const s=ga();bi({minimized:t,operations:{...Ve.operations,[e]:{...i,zIndex:s}}})}function Sm(e){bi({operationOrder:yE(e)})}function ga(){return nd+=1,nd}function CB(e){const t=Ve.operations[e];if(t)return t;const i=Object.keys(Ve.operations).length,s={x:i*ex,y:i*ex,width:Tg,height:Ag,zIndex:ga()};return bi({operations:{...Ve.operations,[e]:s}}),s}function EB(e){const t=new Set(e),i={};let s=!1;for(const[g,m]of Object.entries(Ve.operations))t.has(g)?i[g]=m:s=!0;const a=Ve.minimized.filter(g=>t.has(g)),d=a.length!==Ve.minimized.length,p=Ve.operationOrder.filter(g=>t.has(g)),c=p.length!==Ve.operationOrder.length,h=Object.fromEntries(Object.entries(Ve.operationAccent).filter(([g])=>t.has(g))),f=Object.keys(h).length!==Object.keys(Ve.operationAccent).length;Fn&&(!t.has(Fn)||a.includes(Fn))&&Xr(),(s||d||c||f)&&bi({operations:i,minimized:a,operationOrder:p,operationAccent:h})}function kB(e){BB(),K_(),OB(),En=e,Ve=e?zB(e):xo;const t=e?wc.get(e)??null:null,i=Fn!==t;Fn=t;const s=e?yd.has(e):!1,a=vr!==s;vr=s,Ls=Ve.viewport,nd=Math.max(nd,SE(Ve.operations)),mE(),i&&q_(),a&&xd()}function rx(e,t){const i=Ve.operations[e];if(!i)return;const s=Math.max(gB,Math.min(_B,Math.min((t.width-tx)/i.width,(t.height-tx)/i.height))),a={x:t.width/2-(i.x+i.width/2)*s,y:t.height/2-(i.y+i.height/2)*s,zoom:s};K_(),Ls=a;const d=ga(),p=Ve.minimized.includes(e);bi({viewport:a,operations:{...Ve.operations,[e]:{...Y_(i,d),zIndex:d}},...p?{minimized:Ve.minimized.filter(c=>c!==e)}:{}})}function lc(e){G_(),En&&wc.set(En,e);const t=DB(e),i=!gE(Ve.minimized,t),s=Fn!==e;s&&(Fn=e),i&&bi({minimized:t}),s&&q_()}function Xr(){En&&wc.delete(En),Fn!==null&&(Fn=null,q_())}function TB(){if(En){if(vr){G_();return}Xr(),yd.set(En,!0),vr=!0,xd()}}function xm(e){if(En){if(vr&&U_===e){G_();return}AB(e),vr||(Xr(),yd.set(En,!0),vr=!0,xd())}}function G_(){En&&yd.delete(En),vr&&(vr=!1,xd())}function AB(e){U_=e,$B(e),NB()}function RB(e){return Mg.add(e),()=>{Mg.delete(e)}}function LB(e){return Ng.add(e),()=>{Ng.delete(e)}}function mE(){for(const e of Rg)e()}function MB(e){return Lg.add(e),()=>{Lg.delete(e)}}function sx(){return Fn}function xd(){for(const e of Mg)e()}function NB(){for(const e of Ng)e()}function ax(){return Ve.minimized}function ox(){return Ve.collapsedGroups}function q_(){for(const e of Lg)e()}function OB(){En&&(Fn?wc.set(En,Fn):wc.delete(En))}function DB(e){return Object.keys(Ve.operations).filter(t=>t!==e)}function gE(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}function _E(){const e=Ve.viewport,t=Ls.x-e.x,i=Ls.y-e.y,s=Ls.zoom-e.zoom;if(Math.abs(t)<nx&&Math.abs(i)<nx&&Math.abs(s)<vB){da=null,bi({viewport:Ls});return}bi({viewport:{x:e.x+t*ym,y:e.y+i*ym,zoom:e.zoom+s*ym}}),da=typeof window<"u"?window.requestAnimationFrame(_E):null}function K_(){da===null||typeof window>"u"||(window.cancelAnimationFrame(da),da=null)}function jB(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function IB(){!En||typeof window>"u"||(PB(),Os=window.setTimeout(()=>{Os=null,vE(En,Ve)},hB))}function BB(){!Os||!En||typeof window>"u"||(window.clearTimeout(Os),Os=null,vE(En,Ve))}function PB(){!Os||typeof window>"u"||(window.clearTimeout(Os),Os=null)}function zB(e){if(typeof window>"u")return xo;try{const t=window.localStorage.getItem(bE(e));if(!t)return xo;const i=JSON.parse(t);return FB(i)}catch{return xo}}function vE(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(bE(e),JSON.stringify(t))}catch{}}function HB(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(lE);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function $B(e){if(!(typeof window>"u"))try{window.localStorage.setItem(lE,e)}catch{}}function bE(e){return`${uB}${e}`}function FB(e){if(!Ao(e))return xo;const t=GB(e.operations);return{viewport:V_(e.viewport),operations:t,operationOrder:yE(e.operationOrder),operationAccent:UB(e.operationAccent),minimized:WB(e.minimized,t),collapsedGroups:KB(e.collapsedGroups)}}function yE(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 UB(e){if(!Ao(e))return{};const t={};for(const[i,s]of Object.entries(e))typeof s=="string"&&(t[i]=s);return t}function WB(e,t){if(!Array.isArray(e))return[];const i=new Set,s=[];for(const a of e)typeof a!="string"||i.has(a)||!(a in t)||(i.add(a),s.push(a));return s}function V_(e){if(!Ao(e))return po;const t=cc(e.x,po.x),i=cc(e.y,po.y),s=Bg(e.zoom,po.zoom);return{x:t,y:i,zoom:s}}function GB(e){if(!Ao(e))return{};const t={};for(const[i,s]of Object.entries(e))Ao(s)&&(t[i]=Y_(s,qB(t)));return t}function Y_(e,t){return Ao(e)?{x:cc(e.x,0),y:cc(e.y,0),width:Bg(e.width,Tg),height:Bg(e.height,Ag),zIndex:cc(e.zIndex,t)}:{x:0,y:0,width:Tg,height:Ag,zIndex:t}}function qB(e){return SE(e)+1}function SE(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function cc(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Bg(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ao(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KB(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 VB(e,t,i,s){if(!i)return{groupId:null,index:0};for(const d of t){const p=d.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 f=c.querySelector(`[data-group-section-id="${p}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:d.groupId,index:0};const g=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const m of g){const S=m.dataset.sideBarChipId;if(!S||S===s)continue;const C=m.getBoundingClientRect();if(e<=C.top+C.height/2)return{groupId:d.groupId,index:Math.max(0,d.entryIds.indexOf(S))}}return{groupId:d.groupId,index:d.entryIds.length}}const a=t[t.length-1];return{groupId:a?.groupId??null,index:a?.entryIds.length??0}}function YB(e,t,i,s){if(!i)return 0;const a=Array.from(i.querySelectorAll("[data-drop-zone-group-id]"));for(const d of a){const p=d.dataset.dropZoneGroupId;if(!p||p==="__ungrouped__"||p===s)continue;const c=t.indexOf(p);if(c===-1)continue;const h=d.getBoundingClientRect();if(e<=h.top+h.height/2)return c}return t.length}function XB(e,t,i,s){const a=e.filter(g=>g!==t),d=new Set(s),p=a.filter(g=>d.has(g)),c=Math.max(0,Math.min(i,p.length));if(p.length===0)return[...a,t];if(c<p.length){const g=a.indexOf(p[c]),m=[...a];return m.splice(g,0,t),m}const h=a.indexOf(p[p.length-1]),f=[...a];return f.splice(h+1,0,t),f}function ZB(e,t,i,s){const a=new Set(s),d=e.filter(m=>a.has(m)),p=d.indexOf(t),c=d.filter(m=>m!==t),h=i>p?i-1:i,f=Math.max(0,Math.min(h,c.length));c.splice(f,0,t);let g=0;return e.map(m=>a.has(m)?c[g++]??m:m)}function JB(e,t,i){if(i.length!==t.length)return[...e];const s=new Set(t);let a=0;return e.map(d=>s.has(d)?i[a++]??d:d)}function QB(e,t,i){const s=e.indexOf(t);if(s===-1)return[...e];const a=e.filter(c=>c!==t),d=i>s?i-1:i,p=Math.max(0,Math.min(d,a.length));return a.splice(p,0,t),a}function e9(e,t,i){if(e.indexOf(t)===-1)return[...e];const a=e.filter(p=>p!==t),d=Math.max(0,Math.min(i,a.length));return a.splice(d,0,t),a}function wd(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function t9(e){const t=wd(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function X_(e){const{currentTitle:t,onCommit:i,onBegin:s}=e,a=L.useRef(null),d=L.useRef(!1),p=L.useRef(!1),[c,h]=L.useState(!1),[f,g]=L.useState("");L.useEffect(()=>{c&&(a.current?.focus(),a.current?.select())},[c]);const m=()=>{s?.(),p.current=!1,g(t),h(!0)},S=()=>{p.current=!0,h(!1),g("")},C=()=>{if(!d.current){d.current=!0;try{i(f)}finally{d.current=!1,p.current=!0,h(!1)}}};return{renaming:c,draftTitle:f,inputRef:a,begin:m,cancel:S,commit:C,setDraftTitle:g,handleKeyDown:_=>{if(_.key==="Enter"){_.preventDefault(),C();return}_.key==="Escape"&&(_.preventDefault(),S())},handleBlur:()=>{if(p.current){p.current=!1;return}C()}}}function xE({entry:e,index:t,isCloseArmed:i,accentValue:s,dragging:a,dragOffsetY:d,dropTarget:p,preview:c=!1,onArmClose:h,onDisarmClose:f,onClose:g,onMinimize:m,onFocus:S,onKeyboardMove:C,onPointerDragStart:T,onOpenAccent:w,onRename:_}){const b=L.useRef(!1),{operation:v,active:y,minimized:k,notificationCount:M,status:A}=e,N=n9(v),R=X_({currentTitle:N,onCommit:P=>_(v.id,P),onBegin:f}),I=["side-bar-chip",y?"side-bar-chip--active":"",k?"side-bar-chip--minimized":"",a?"side-bar-chip--dragging":"",p?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),Y=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),z={"--i":t,...s?{"--user-accent":s}:{},...a?{"--drag-dy":`${Math.round(d)}px`}:{}},q=()=>{if(f(),b.current){b.current=!1;return}S(v.id)},B=P=>{P.stopPropagation()},W=P=>{if(P.stopPropagation(),!i){h(v.id);return}f(),g(v.id)},F=P=>{P.preventDefault(),f(),w(v.id,P.currentTarget.getBoundingClientRect())};return l.jsxs("li",{"data-side-bar-chip-id":v.id,className:I,role:"button",tabIndex:0,"aria-label":y?`${N} (focused)`:`Focus operation ${N}`,"aria-current":y?"true":void 0,title:c?"Click to open in its Theater":y?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:z,onClick:q,onContextMenu:c?void 0:F,onFocus:()=>{i||f()},onPointerDown:P=>T(P,v.id),onPointerUp:()=>{a&&(b.current=!0)},onKeyDown:P=>{if(P.target===P.currentTarget){if(!c&&P.altKey&&P.shiftKey&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),C(v.id,P.key==="ArrowUp"?-1:1);return}(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),q())}},children:[l.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:l.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??l.jsx(a9,{})})}),R.renaming?l.jsx("input",{className:"side-bar-chip-rename-input",ref:R.inputRef,value:R.draftTitle,"aria-label":`Rename operation ${N}`,onChange:P=>R.setDraftTitle(P.target.value),onKeyDown:R.handleKeyDown,onBlur:R.handleBlur,onPointerDown:P=>P.stopPropagation(),onClick:P=>P.stopPropagation()}):l.jsx("span",{className:"side-bar-chip-name",onDoubleClick:c?void 0:R.begin,children:N}),M>0?l.jsx("span",{className:"side-bar-chip-count",children:M}):null,l.jsx("span",{className:`side-bar-chip-status ${i9(A)}`,role:"img","aria-label":lx(A),title:lx(A)}),!c&&!k?l.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:B,onClick:P=>{P.stopPropagation(),f(),m(v.id)},"aria-label":`Minimize operation ${N}`,title:"Minimize operation",children:l.jsx(s9,{})}):null,c?null:l.jsx("button",{type:"button",className:Y,onPointerDown:B,onClick:W,"aria-label":i?`Confirm close operation ${N}`:`Close operation ${N}`,title:i?"Confirm close":"Close operation",children:i?"Close?":l.jsx(r9,{})})]})}function n9(e){return e.title}function i9(e){const t=wd(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function lx(e){return t9(e)}function r9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 s9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function a9(){return l.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function o9({group:e,count:t,collapsed:i,dragging:s,dropTarget:a,dragOffsetY:d,onToggle:p,onContextMenu:c,onPointerDragStart:h}){const f=L.useRef(!1),g=ko(e.color),m=["side-bar-group-header",s?"side-bar-group-header--dragging":"",a?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),S={...g?{"--grp-color":g}:{},...s?{"--drag-dy":`${Math.round(d)}px`}:{}},C=_=>{_.preventDefault(),c(e.id,_.currentTarget.getBoundingClientRect())},T=_=>{_.target instanceof Element&&_.target.closest("button")||h(_,e.id)},w=()=>{s&&(f.current=!0)};return l.jsxs("div",{className:m,style:S,onContextMenu:C,onPointerDown:T,onPointerUp:w,role:"group","aria-label":e.name,children:[l.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>p(e.id),"aria-expanded":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:l.jsx(l9,{collapsed:i})}),l.jsx("span",{className:"side-bar-group-header__name",children:e.name}),l.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function l9({collapsed:e}){return l.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:l.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const wE="fleet-console.operations.side-width",CE="fleet-console.operations.side-collapsed",EE="fleet-console.operations.theater-collapsed",Cd=280,cx=Cd,Pg=new Set,zg=new Set;let fa={width:d9(),collapsed:f9()},Ah=p9();function kE(){return L.useSyncExternalStore(m9,Hg,Hg)}function c9(){return L.useSyncExternalStore(_9,ux,ux)}function u9(e){const t=Math.max(Cd,Math.min(TE(),e));if(fa.width!==t){fa={...fa,width:t};try{typeof window<"u"&&localStorage.setItem(wE,String(t))}catch{}AE()}}function Z_(e){if(fa.collapsed!==e){fa={...fa,collapsed:e};try{typeof window<"u"&&localStorage.setItem(CE,e?"1":"0")}catch{}AE()}}function h9(e,t){const i=new Set(Ah);t?i.add(e):i.delete(e);const s=Array.from(i);if(s.join("\0")!==Ah.join("\0")){Ah=s;try{typeof window<"u"&&localStorage.setItem(EE,JSON.stringify(s))}catch{}g9()}}function TE(){return typeof window<"u"?Math.max(Cd,window.innerWidth-480):800}function d9(){try{if(typeof window>"u")return cx;const e=localStorage.getItem(wE);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Cd,Math.min(TE(),t))}}catch{}return cx}function f9(){try{return typeof window<"u"&&localStorage.getItem(CE)==="1"}catch{return!1}}function p9(){try{if(typeof window>"u")return[];const e=localStorage.getItem(EE),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}function AE(){for(const e of Pg)e()}function Hg(){return fa}function m9(e){return Pg.add(e),()=>Pg.delete(e)}function g9(){for(const e of zg)e()}function ux(){return Ah}function _9(e){return zg.add(e),()=>zg.delete(e)}function RE(e,t){const i=e.find(a=>a.id===t.pluginId)?.kinds.filter(a=>a.type===t.type)??[],s=t.payload.launchKindId;if(typeof s=="string"){const a=i.find(d=>d.id===s);if(a)return a}return i.length===1?i[0]:null}const v9=1500,b9=6,hx=34,dx=18,y9=4;function S9({theaters:e,activeTheaterId:t,operations:i,groups:s,minimized:a,activeOperationId:d,operationNotifications:p,catalog:c,canLaunch:h,addingTheater:f,theaterError:g,renderKindIcon:m,onLaunchKind:S,onResetView:C,onClose:T,onMinimize:w,onFocus:_,onSetAccent:b,onRename:v,onSetGroupId:y,onCreateGroup:k,onSetGroupColor:M,onRenameGroup:A,onReorderGroups:N,onUngroupAll:R,onSelectTheater:I,onAddTheater:Y,onCancelAddTheater:z,onForgetTheater:q}){const B=L.useRef(null),W=L.useRef(null),F=kE(),{width:P,collapsed:K}=F,X=L.useRef(K),O=cE(),H=hE(),j=Sd(),G=L.useRef(null),[V,ne]=L.useState(null),[ie,ve]=L.useState(null),ee=L.useRef(null),$=L.useRef([]),ae=L.useRef([]),ge=L.useRef([]),we=L.useRef([]),de=L.useRef(y),Ce=L.useRef(N),[Le,Me]=L.useState(null),[qe,ke]=L.useState(null),[ye,Oe]=L.useState(!1),[wt,On]=L.useState(!1),Xn=SB(),en=c9(),{operationStatus:ft}=ur();L.useLayoutEffect(()=>{!X.current&&K&&aE(B.current,".command-band-sidebar-toggle"),X.current=K},[K]);const tn=i.filter(me=>me.theaterId===t),Kt=s.filter(me=>me.theaterId===t),Ht=new Set(a),nn=new Set(Xn),pn=h_(tn,O.operationOrder).map(me=>{const ot=RE(c,me),_t=ot?m(me.pluginId,ot):null;return{operation:me,active:d===me.id,minimized:Ht.has(me.id),notificationCount:p[me.id]?1:0,status:ft[me.id],icon:_t}}),sn=LE(pn,Kt,O.operationOrder),Zn=sn.some(me=>me.group!==null),rt=sn.flatMap(me=>me.groupId?[me.groupId]:[]),kn=sn.flatMap(me=>nn.has(me.groupId??"")?[]:me.entries),$t=pn.map(me=>me.operation.id),Rt=L.useCallback(()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},[]),Lt=L.useCallback(()=>{Rt(),ne(null)},[Rt]),wr=L.useCallback(me=>{Rt(),ne(me),G.current=window.setTimeout(()=>{G.current=null,ne(null)},v9)},[Rt]);L.useEffect(()=>Rt,[Rt]),L.useEffect(()=>{V!==null&&(pn.some(me=>me.operation.id===V)||Lt())},[V,pn,Lt]);const wn=Le?.kind==="chip"?pn.find(me=>me.operation.id===Le.operationId)?.operation??null:null,Di=Le?.kind==="group"?s.find(me=>me.id===Le.groupId)??null:null,Dn=Le?.kind==="theater"?e.find(me=>me.id===Le.theaterId)??null:null,ji=(me,ot)=>{const _t=kn.findIndex(Vt=>Vt.operation.id===me);if(_t===-1)return;const Ue=Math.max(0,Math.min(kn.length-1,_t+ot));if(Ue===_t)return;const Ee=kn.map(Vt=>Vt.operation.id),pt=e9(Ee,me,Ue);Sm(JB($t,Ee,pt))},Zi=sn.map(me=>({groupId:me.groupId,entryIds:me.entries.map(ot=>ot.operation.id)}));L.useEffect(()=>{$.current=pn,ae.current=$t,ge.current=Zi,we.current=rt,de.current=y,Ce.current=N});const Mt=me=>{ee.current=me,ve(me)},J=ie?.pointerId??null;L.useEffect(()=>{if(J===null)return;const me=Ue=>{if(Ue.pointerId!==J)return;const Ee=ee.current;if(!Ee)return;if(Ue.buttons===0){Mt(null);return}const pt=Math.hypot(Ue.clientX-Ee.startX,Ue.clientY-Ee.startY);if(!Ee.dragging&&pt<b9)return;if(Ee.dragging&&Ue.preventDefault(),R9(Ue.clientY,W.current),Ee.kind==="chip"){const Jn=VB(Ue.clientY,ge.current,W.current,Ee.sourceId);Mt({...Ee,currentY:Ue.clientY,dragging:!0,dropIndex:Jn.index,dropGroupId:Jn.groupId});return}const Vt=YB(Ue.clientY,we.current,W.current,Ee.sourceGroupId);Mt({...Ee,currentY:Ue.clientY,dragging:!0,dropIndex:Vt})},ot=Ue=>{if(Ue.pointerId!==J)return;const Ee=ee.current;if(Mt(null),!Ee?.dragging)return;if(Ee.kind==="group"){const Xe=QB(we.current,Ee.sourceGroupId,Ee.dropIndex);if(Xe.join("\0")===we.current.join("\0"))return;Ce.current(Xe);return}const{sourceId:pt,sourceGroupId:Vt,dropIndex:Jn,dropGroupId:Wn}=Ee,yi=ge.current,Gn=ae.current;if(Wn!==Vt){const Je=yi.find(Et=>Et.groupId===Wn)?.entryIds??[];Sm(XB(Gn,pt,Jn,Je)),de.current(pt,Wn);return}const Z=yi.find(Xe=>Xe.groupId===Vt)?.entryIds??[],he=Z.indexOf(pt);if(he===-1||Jn===he)return;const Ae=ZB(Gn,pt,Jn,Z);Sm(Ae)},_t=Ue=>{Ue.pointerId===J&&Mt(null)};return window.addEventListener("pointermove",me),window.addEventListener("pointerup",ot),window.addEventListener("pointercancel",_t),()=>{window.removeEventListener("pointermove",me),window.removeEventListener("pointerup",ot),window.removeEventListener("pointercancel",_t)}},[J]);const pe=(me,ot)=>{if(me.button!==0||me.target instanceof Element&&me.target.closest("button"))return;Me(null),Lt();const Ue=pn.find(Ee=>Ee.operation.id===ot)?.operation.groupId??null;Mt({kind:"chip",sourceId:ot,sourceGroupId:Ue,pointerId:me.pointerId,startX:me.clientX,startY:me.clientY,currentY:me.clientY,dragging:!1,dropIndex:$t.indexOf(ot),dropGroupId:Ue})},xe=(me,ot)=>{me.button===0&&(me.target instanceof Element&&me.target.closest("button")||rt.includes(ot)&&(Me(null),Lt(),Mt({kind:"group",sourceGroupId:ot,pointerId:me.pointerId,startX:me.clientX,startY:me.clientY,currentY:me.clientY,dragging:!1,dropIndex:rt.indexOf(ot)})))},He=L.useCallback(me=>{me.preventDefault();const ot=me.clientX,_t=F.width;On(!0);const Ue=pt=>{const Vt=pt.clientX-ot;u9(_t+Vt)},Ee=()=>{On(!1),document.removeEventListener("pointermove",Ue),document.removeEventListener("pointerup",Ee),document.removeEventListener("pointercancel",Ee)};document.addEventListener("pointermove",Ue),document.addEventListener("pointerup",Ee),document.addEventListener("pointercancel",Ee)},[F.width]),Ct=()=>{Z_(!K)},gt=()=>{ke(null),Me(null),Oe(!0)},Ne=()=>{Oe(!1),z()},Re=me=>{Oe(!1),Y(me)},Fe=me=>{me.defaultPrevented||(me.preventDefault(),Me(null),ke({anchor:{x:me.clientX,y:me.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Bt=L.useCallback(()=>{const me=Le?.kind==="theater"?Le.returnFocus:null;Me(null),me?.focus()},[Le]),nt=(me,ot)=>{me.stopPropagation(),ot!==t&&I(ot),Me(null);const _t=me.currentTarget.getBoundingClientRect();ke({anchor:{x:_t.right+8,y:_t.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},mn=me=>{h9(me,!en.includes(me))};return l.jsxs("aside",{className:`operations-side-bar ${K?"is-closed":"is-expanded"}`,ref:B,"data-sidebar-state":K?"closed":"expanded","data-resizing":wt?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${P}px`},inert:K,onContextMenu:Fe,children:[l.jsxs("div",{className:"side-bar-theater-add-row",children:[l.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:gt,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[l.jsx(J_,{}),l.jsx("span",{children:"Add Theater"})]}),l.jsxs("div",{className:"side-bar-formation-group",role:"group","aria-label":"Formation view",children:[l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>C(),disabled:t===null,"aria-label":"Reset canvas view",title:"Reset canvas view",children:l.jsx(w9,{})}),l.jsx("span",{className:"side-bar-formation-divider","aria-hidden":"true"}),l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>xm("grid"),disabled:t===null,"aria-pressed":j&&H==="grid","aria-label":"Formation view — Grid layout",title:"Formation view — Grid layout",children:l.jsx(x9,{})}),l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>xm("columns"),disabled:t===null,"aria-pressed":j&&H==="columns","aria-label":"Formation view — Columns layout",title:"Formation view — Columns layout",children:l.jsx(C9,{})}),l.jsx("button",{type:"button",className:"side-bar-formation-toggle side-bar-formation-seg",onClick:()=>xm("rows"),disabled:t===null,"aria-pressed":j&&H==="rows","aria-label":"Formation view — Rows layout",title:"Formation view — Rows layout",children:l.jsx(E9,{})})]})]}),!K&&g?l.jsx("p",{className:"side-bar-theater-error",children:g}):null,l.jsx("ol",{className:"operations-side-bar-chips",ref:W,"aria-label":"Operations",children:e.map(me=>{const ot=me.id===t,_t=i.filter(Ee=>Ee.theaterId===me.id).length,Ue=en.includes(me.id);if(!ot){const Ee=k9({theaterId:me.id,operations:i,operationOrder:O.operationOrder,minimizedSet:Ht,activeOperationId:null,operationNotifications:p,operationStatus:ft,catalog:c,renderKindIcon:m});return l.jsx(T9,{theater:me,entries:Ue?[]:Ee,groups:s.filter(pt=>pt.theaterId===me.id),operationCount:_t,collapsed:Ue,onSelectTheater:I,onFocus:_,onToggleCollapsed:mn,onOpenActions:(pt,Vt)=>{ke(null),Me({kind:"theater",theaterId:me.id,anchor:pt,returnFocus:Vt})},onOpenLaunch:nt,onContextMenu:pt=>{ke(null),Me({kind:"theater",theaterId:me.id,anchor:pt})}},me.id)}return l.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":me.id,children:[l.jsx(ME,{theater:me,operationCount:_t,active:!0,collapsed:Ue,onSelectTheater:I,onToggleCollapsed:mn,onOpenActions:(Ee,pt)=>{ke(null),Me({kind:"theater",theaterId:me.id,anchor:Ee,returnFocus:pt})},onOpenLaunch:nt,onContextMenu:Ee=>{ke(null),Me({kind:"theater",theaterId:me.id,anchor:Ee})}}),Ue?null:l.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${me.label} operations`,children:sn.map(Ee=>{const pt=Ee.groupId!==null&&nn.has(Ee.groupId),Vt=Ee.group?ko(Ee.group.color):null,Jn=Vt?{"--grp-color":Vt}:void 0,Wn=Ee.groupId?rt.indexOf(Ee.groupId):-1,yi=ie?.kind==="group"&&ie.sourceGroupId===Ee.groupId&&ie.dragging,Gn=ie?.kind==="group"&&ie.dragging&&Ee.groupId!==null&&ie.sourceGroupId!==Ee.groupId&&ie.dropIndex===Wn,je=ie?.kind==="group"&&ie.dragging&&Ee.groupId!==null&&ie.sourceGroupId!==Ee.groupId&&Wn===rt.length-1&&ie.dropIndex===rt.length,Z=[Ee.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Gn?"side-bar-group-section--drop-before":"",je?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return l.jsxs("li",{"data-drop-zone-group-id":Ee.groupId??"__ungrouped__",className:Z,style:Jn,children:[Ee.group?l.jsx(o9,{group:Ee.group,count:Ee.entries.length,collapsed:pt,dragging:yi,dragOffsetY:yi?ie.currentY-ie.startY:0,dropTarget:Gn,onToggle:yB,onContextMenu:(he,Ae)=>Me({kind:"group",groupId:he,anchor:Ae}),onPointerDragStart:xe}):Zn&&Ee.entries.length>0?l.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:l.jsx("span",{children:"Ungrouped"})}):null,pt?null:l.jsx("ol",{className:["side-bar-group-chips",ie?.kind==="chip"&&ie.dragging&&ie.dropGroupId===Ee.groupId&&ie.dropGroupId!==ie.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ee.groupId??"__ungrouped__","aria-label":Ee.group?Ee.group.name:"Ungrouped",children:Ee.entries.map(he=>{const Ae=pn.indexOf(he),Xe=Ee.entries.indexOf(he),Je=O.operationAccent[he.operation.id]??ZS(he.operation),Et=Je?ko(Je):null;return l.jsx(xE,{entry:he,index:Ae,isCloseArmed:V===he.operation.id,accentValue:Et,dragging:ie?.kind==="chip"&&ie.sourceId===he.operation.id&&ie.dragging,dragOffsetY:ie?.kind==="chip"&&ie.sourceId===he.operation.id&&ie.dragging?ie.currentY-ie.startY:0,dropTarget:ie?.kind==="chip"&&ie.dragging===!0&&ie.dropGroupId===Ee.groupId&&ie.dropGroupId===ie.sourceGroupId&&ie.dropIndex===Xe&&ie.sourceId!==he.operation.id,onArmClose:wr,onDisarmClose:Lt,onClose:T,onMinimize:w,onFocus:_,onKeyboardMove:ji,onPointerDragStart:pe,onOpenAccent:(Yt,Xt)=>Me({kind:"chip",operationId:Yt,anchor:Xt}),onRename:v},he.operation.id)})})]},Ee.groupId??"__ungrouped__")})})]},me.id)})}),l.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:He,onDoubleClick:Ct,"aria-hidden":"true"}),qe?js.createPortal(l.jsx(sE,{anchor:qe.anchor,viewportBounds:qe.viewportBounds,placement:"cursor",catalog:c,canLaunch:h,renderKindIcon:m,onLaunchKind:(me,ot)=>{ke(null),S(me,ot)},onClose:()=>ke(null)},`${qe.anchor.x}:${qe.anchor.y}`),document.body):null,Le?.kind==="chip"&&wn?l.jsx(QS,{kind:"chip",operation:wn,groups:s.filter(me=>me.theaterId===wn.theaterId),accentKey:O.operationAccent[wn.id]??ZS(wn),anchor:Le.anchor,actions:{onSetAccent:me=>b(wn.id,me),onSetGroupId:me=>y(wn.id,me),onCreateGroup:me=>k(wn.theaterId,me,wn.id)},onClose:()=>Me(null)}):Le?.kind==="group"&&Di?l.jsx(QS,{kind:"group-header",group:Di,anchor:Le.anchor,actions:{onSetColor:me=>M(Di.id,me),onRename:me=>A(Di.id,me),onUngroupAll:()=>R(Di.id)},onClose:()=>Me(null)}):Le?.kind==="theater"&&Dn?l.jsx(A9,{theater:Dn,groupCount:s.filter(me=>me.theaterId===Dn.id).length,anchor:Le.anchor,onCreateGroup:me=>{k(Dn.id,me),Bt()},onForgetTheater:()=>{q(Dn.id),Bt()},onClose:Bt}):null,l.jsx(oE,{open:ye,onCancel:Ne,onConfirm:Re}),K?null:l.jsx(p3,{})]})}function x9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function w9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.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"}),l.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function C9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function E9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function LE(e,t,i){const s=[...t].sort((c,h)=>c.order-h.order||c.createdAt-h.createdAt),a=s.map(c=>({groupId:c.id,group:c,entries:[]})),d={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)?a.find(g=>g.groupId===h)?.entries.push(c):d.entries.push(c)}return[...a,d]}function k9({theaterId:e,operations:t,operationOrder:i,minimizedSet:s,activeOperationId:a,operationNotifications:d,operationStatus:p,catalog:c,renderKindIcon:h}){return h_(t.filter(f=>f.theaterId===e),i).map(f=>{const g=RE(c,f),m=g?h(f.pluginId,g):null;return{operation:f,active:a===f.id,minimized:s.has(f.id),notificationCount:d[f.id]?1:0,status:p[f.id],icon:m}})}function ME({theater:e,operationCount:t,active:i,collapsed:s,onSelectTheater:a,onToggleCollapsed:d,onOpenActions:p,onOpenLaunch:c,onContextMenu:h}){const f=m=>{m.preventDefault(),h(m.currentTarget.getBoundingClientRect())},g=m=>{m.target===m.currentTarget&&(m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),a(e.id)))};return l.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${i?" is-active":""}`,onClick:()=>a(e.id),onKeyDown:g,onContextMenu:f,"aria-current":i?"true":void 0,"aria-expanded":!s,title:e.label,children:[l.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:NE(e.label)}),l.jsx("span",{className:"side-bar-theater-name",children:e.label}),l.jsx("span",{className:"side-bar-theater-count",children:t}),l.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[l.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":s?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!s,title:s?"Expand":"Collapse",onClick:m=>{m.stopPropagation(),d(e.id)},children:l.jsx(L9,{collapsed:s})}),l.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:m=>{m.stopPropagation(),p(m.currentTarget.getBoundingClientRect(),m.currentTarget)},children:l.jsx(M9,{})}),l.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:m=>c(m,e.id),children:l.jsx(J_,{})})]})]})}function T9({theater:e,entries:t,groups:i,operationCount:s,collapsed:a,onSelectTheater:d,onFocus:p,onToggleCollapsed:c,onOpenActions:h,onOpenLaunch:f,onContextMenu:g}){const m=LE(t,i);let S=y9,C=0;const T=[];for(const w of m){if(w.entries.length===0)continue;const _=w.entries.slice(0,Math.max(0,S));C+=w.entries.length-_.length,S-=_.length,_.length>0&&T.push({...w,entries:_})}return l.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--peek","data-theater-id":e.id,children:[l.jsx(ME,{theater:e,operationCount:s,active:!1,collapsed:a,onSelectTheater:d,onToggleCollapsed:c,onOpenActions:h,onOpenLaunch:f,onContextMenu:g}),T.length>0?l.jsxs("ol",{className:"side-bar-peek-chips","aria-label":`${e.label} preview operations`,children:[T.map(w=>{const _=w.group?ko(w.group.color):null;return l.jsxs("li",{className:w.groupId?"side-bar-group-section side-bar-group-section--peek":"side-bar-ungrouped-section",style:_?{"--grp-color":_}:void 0,children:[w.group?l.jsxs("div",{className:"side-bar-peek-group-label","aria-label":`Group ${w.group.name}`,children:[l.jsx("span",{children:w.group.name}),l.jsx("span",{className:"side-bar-peek-group-count",children:w.entries.length})]}):null,l.jsx("ol",{className:"side-bar-group-chips","aria-label":w.group?w.group.name:"Ungrouped",children:w.entries.map((b,v)=>l.jsx(xE,{entry:b,index:v,isCloseArmed:!1,accentValue:null,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:p,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},b.operation.id))})]},w.groupId??"__ungrouped__")}),C>0?l.jsxs("li",{className:"side-bar-peek-more",children:["+",C," more"]}):null]}):null]})}function A9({theater:e,groupCount:t,anchor:i,onCreateGroup:s,onForgetTheater:a,onClose:d}){const[p,c]=L.useState(!1),[h,f]=L.useState(`Group ${t+1}`),g=L.useRef(!1),m=L.useRef(null),S=L.useRef(null),[C,T]=L.useState(i.bottom+6);L.useLayoutEffect(()=>{const _=S.current?.getBoundingClientRect().height??0,b=window.innerHeight-_-8;T(Math.max(8,Math.min(i.bottom+6,b)))},[i,p]),L.useEffect(()=>{p&&m.current?.select()},[p]),L.useEffect(()=>{const _=b=>{b.key==="Escape"&&(b.preventDefault(),d())};return window.addEventListener("keydown",_),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("keydown",_),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[d]);const w=()=>{const _=h.trim();_&&s(_)};return js.createPortal(l.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:d,children:l.jsxs("div",{ref:S,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:i.left,top:C},onPointerDown:_=>_.stopPropagation(),children:[p?l.jsx("input",{ref:m,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:h,onChange:_=>f(_.target.value),onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:_=>{_.key==="Enter"&&!g.current&&(_.preventDefault(),w()),_.key==="Escape"&&(_.preventDefault(),c(!1))},onBlur:()=>c(!1),"aria-label":"New group name",placeholder:"Group name"}):l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>c(!0),children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l.jsx(J_,{})}),l.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),l.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),l.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:a,children:[l.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l.jsx(O9,{})}),l.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function R9(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+hx?t.scrollTop-=dx:e>i.bottom-hx&&(t.scrollTop+=dx)}function L9({collapsed:e}){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?l.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):l.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function M9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),l.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function J_(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function NE(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(s=>N9(s)):OE(e).filter(s=>/[\p{L}\p{N}]/u.test(s))).slice(0,2).join("").toUpperCase()||"--"}function N9(e){return OE(e).slice(0,1)}function OE(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function O9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),l.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function D9({operationsViewVisible:e}){const t=ur(),i=jo(),s=kE(),a=qw(),d=V3(),p=j9(),c=`${p}${p==="⌘"?"":"+"}B`,h=`${p}${p==="⌘"?"⌥":"+Alt+"}B`,f=t.theaters.find(z=>z.id===t.activeTheaterId)??null,g=t.operations.find(z=>z.id===t.activeOperationId)??null,m=g?i.plugins.find(z=>z.id===g.pluginId):null,S=typeof g?.payload.cliId=="string"?g.payload.cliId:null,C=typeof g?.payload.cliLabel=="string"?g.payload.cliLabel:S,T=g?m?.operationKinds?.find(z=>z.type===g.type)??null:null,w=g&&m?.renderLaunchIcon?m.renderLaunchIcon({id:S??g.type,type:g.type,title:T?.title??g.type}):null,_=Kw(),b=L.useRef(null),v=L.useRef(null),y=L.useRef(null),[k,M]=L.useState(!1),A=X_({currentTitle:g?.title??"",onCommit:z=>{const q=Jy(y.current,t.activeOperationId);y.current=null,q&&dw(q,z).then(()=>_i(null)).then(Mi).catch(()=>{})}});L.useEffect(()=>{!A.renaming||Jy(y.current,t.activeOperationId)||(y.current=null,A.cancel())},[A,t.activeOperationId]),L.useEffect(()=>{if(!k)return;const z=q=>{const B=q.target;!(B instanceof Node)||b.current?.contains(B)||v.current?.contains(B)||M(!1)};return document.addEventListener("pointerdown",z),()=>document.removeEventListener("pointerdown",z)},[k]),L.useEffect(()=>{aL(k,_.isPathContextDeckOpen)&&M(!1)},[k,_.isPathContextDeckOpen]);const N=()=>{M(!1),b.current?.focus()},R=()=>{const z=!k;M(z),yh(oL(z,_.isPathContextDeckOpen))},I=z=>{f&&Ww(f.id,q=>jw(f.id,z,q))},Y=()=>{g&&(y.current=g.id,A.begin())};return l.jsxs("header",{className:`command-band${e?" is-operations":" is-utility"}`,style:{"--command-band-left-width":`${s.width}px`,"--command-band-right-width":`${d}px`},children:[l.jsxs("div",{className:`command-band-left${e&&s.collapsed?" is-collapsed":""}`,children:[l.jsx(m3,{className:"command-band-brand"}),e?l.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>Z_(!s.collapsed),"aria-label":`${s.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,title:`${s.collapsed?"Expand sidebar":"Collapse sidebar"} (${c})`,children:l.jsx(fx,{side:"left"})}):null,l.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:Tw,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:l.jsx(I9,{})})]}),l.jsxs("div",{className:"command-band-center",children:[e&&f?l.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${f.label}`,children:[l.jsxs("span",{className:"command-band-theater-segment",children:[l.jsx("span",{className:"command-band-theater-mark",children:NE(f.label)}),f.label]}),g?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),A.renaming?l.jsx("input",{ref:A.inputRef,className:"command-band-rename-input",value:A.draftTitle,"aria-label":`${g.title} 이름 변경`,onChange:z=>A.setDraftTitle(z.target.value),onKeyDown:A.handleKeyDown,onBlur:A.handleBlur}):l.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:Y,title:"Double-click to rename",children:g.title}),C?l.jsxs("span",{className:"command-band-operation-attribute",title:T?.title??C,children:[w?l.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:w}):null,C]}):null]}):null]}):null,e&&f&&_.pathContextHydrated&&_.pathContext?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"command-band-context-separator","aria-hidden":"true"}),l.jsxs("div",{className:"command-band-context",children:[l.jsxs("button",{ref:b,type:"button",className:"command-band-context-trigger",onClick:R,"aria-expanded":k,"aria-haspopup":"dialog",title:_.pathContextError??"Path context — shared with the Activity Rail",children:[l.jsx(B9,{}),_.pathContext.label,l.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),k?l.jsx(Hw,{ref:v,className:"command-band-context-deck",theaterId:f.id,theaterLabel:f.label,context:_.pathContext,isMutating:_.pathContextMutationInProgress,onSelect:I,onClose:N}):null]})]}):null]}),l.jsx("div",{className:"command-band-right",children:e?l.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:Fw,"aria-label":`${a?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,title:`${a?"Collapse Activity Rail":"Expand Activity Rail"} (${h})`,children:l.jsx(fx,{side:"right"})}):null})]})}function j9(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function I9(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function fx({side:e}){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),l.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function B9(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M2.5 4.5a1 1 0 0 1 1-1h3l1.5 1.7h4.5a1 1 0 0 1 1 1v6.3a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}const P9=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function z9({state:e}){const[t,i]=L.useState(!1),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),p=e.theaters.length>0;if(L.useEffect(()=>{if(e.onboardingOpen)return s.current=document.activeElement,a.current?.focus(),()=>{const g=s.current;s.current=null,g?.focus?.()}},[e.onboardingOpen]),L.useEffect(()=>{if(!e.onboardingOpen)return;const g=m=>{t||(m.key==="Escape"?(m.preventDefault(),Ml()):m.key==="Tab"&&H9(m,d.current),m.stopImmediatePropagation())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const c=()=>{i(!0)},h=()=>{i(!1)},f=async g=>{i(!1),Cw();try{const m=await hw(g),S=await uw(m);Ew(S)}catch(m){Vm(m instanceof Error?m.message:String(m))}};return l.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[l.jsx("button",{type:"button",className:"commissioning-scrim",onClick:Ml,"aria-label":"Close setup guide"}),l.jsxs("section",{className:"commissioning-card",ref:d,children:[l.jsxs("header",{className:"commissioning-header",children:[l.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),l.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),l.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),l.jsxs("ol",{className:"commissioning-steps",children:[l.jsxs("li",{className:`commissioning-step commissioning-step--primary ${p?"is-complete":"is-current"}`,children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:p?"✓":"01"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Register a Theater"}),l.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),p?l.jsx(hc,{ref:g=>{a.current=g},className:"commissioning-primary-action",to:"/operations",onClick:Ml,children:"Go to Operations →"}):l.jsx("button",{ref:g=>{a.current=g},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:c,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?l.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),l.jsxs("li",{className:"commissioning-step",children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Open an Operation"}),l.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."}),l.jsx(hc,{className:"commissioning-secondary-link",to:"/operations",onClick:Ml,children:"Go to Operations"})]})]}),l.jsxs("li",{className:"commissioning-step",children:[l.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),l.jsxs("div",{className:"commissioning-step-body",children:[l.jsx("h3",{children:"Monitor Carriers"}),l.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),l.jsxs("footer",{className:"commissioning-footer",children:[l.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),l.jsx("button",{type:"button",className:"commissioning-skip",onClick:Ml,children:"Skip for now"})]})]}),l.jsx(oE,{open:t,onCancel:h,onConfirm:f})]})}function H9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(P9)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}const $9="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",px="operation-search-listbox",DE="__unassigned__";function F9({state:e}){const t=Rc(),[i,s]=L.useState(""),[a,d]=L.useState(0),p=L.useRef(null),c=L.useRef(null),h=L.useRef(null),f=L.useRef(new Map),g=L.useMemo(()=>VL(e),[e]),m=L.useMemo(()=>uL(g,i),[g,i]),S=L.useMemo(()=>hL(m),[m]),C=L.useMemo(()=>mw(i),[i]),T=mx(a,m.length),w=m[T]?gx(m[T].operationId):void 0;if(L.useEffect(()=>{if(!e.operationSearchOpen)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=v,h.current?.focus()}},[e.operationSearchOpen]),L.useEffect(()=>{if(!e.operationSearchOpen){s(""),d(0);return}d(0)},[e.operationSearchOpen,i]),L.useEffect(()=>{if(!e.operationSearchOpen)return;const v=m[T];v&&f.current.get(v.operationId)?.scrollIntoView({block:"nearest"})},[T,m,e.operationSearchOpen]),!e.operationSearchOpen)return null;const _=v=>{pc(v),t("/operations"),Hp()},b=v=>{if(v.key==="Escape"){v.preventDefault(),Hp();return}if(v.key==="ArrowDown"||v.key==="ArrowUp"){v.preventDefault(),d(y=>mx(y+(v.key==="ArrowDown"?1:-1),m.length));return}if(v.key==="Enter"){const y=m[T];if(!y)return;v.preventDefault(),_(y.operationId);return}v.key==="Tab"&&q9(v,c.current)};return l.jsx("div",{className:"operation-search-overlay",onMouseDown:v=>{v.target===v.currentTarget&&Hp()},children:l.jsxs("section",{ref:c,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:b,children:[l.jsxs("div",{className:"operation-search-field",children:[l.jsx(K9,{}),l.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:i,onChange:v=>s(v.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":px,"aria-activedescendant":w,"aria-autocomplete":"list",spellCheck:!1}),l.jsx("kbd",{children:"esc"})]}),l.jsx("div",{id:px,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:S.length>0?S.map(v=>{const y=W9(v.theaterId);return l.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":y,children:[l.jsx("h2",{id:y,className:"operation-search-section-heading",children:wm(v.theaterLabel,C)}),v.entries.map(k=>{const M=m.indexOf(k),A=M===T;return l.jsxs("button",{id:gx(k.operationId),ref:N=>{N?f.current.set(k.operationId,N):f.current.delete(k.operationId)},type:"button",className:`operation-search-result ${A?"is-active":""}`,role:"option","aria-selected":A,onMouseEnter:()=>d(M),onClick:()=>_(k.operationId),children:[l.jsxs("span",{className:"operation-search-result-text",children:[l.jsx("strong",{children:wm(k.operationName,C)}),l.jsx("small",{children:U9(k)})]}),l.jsx("span",{className:"operation-search-theater",children:wm(k.theaterLabel,C)})]},k.operationId)})]},v.theaterId??DE)}):l.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function mx(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function U9(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function W9(e){return`operation-search-heading-${jE(e??DE)}`}function gx(e){return`operation-search-option-${jE(e)}`}function jE(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function wm(e,t){if(t.length===0)return e;const i=[];let s=0;for(;s<e.length;){const a=G9(e,t,s);if(!a){i.push(e.slice(s));break}a.start>s&&i.push(e.slice(s,a.start)),i.push(l.jsx("mark",{children:e.slice(a.start,a.end)},`${a.start}-${a.end}`)),s=a.end}return i}function G9(e,t,i){const s=e.toLocaleLowerCase();let a=null;for(const d of t){const p=s.indexOf(d,i);p!==-1&&(!a||p<a.start)&&(a={start:p,end:p+d.length})}return a}function q9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll($9)).filter(d=>d.offsetParent!==null);if(i.length===0)return;const s=i[0],a=i[i.length-1];if(e.shiftKey&&document.activeElement===s){e.preventDefault(),a?.focus();return}!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s?.focus())}function K9(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.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 V9({open:e,title:t,message:i,tone:s="info",onDismiss:a}){return e?l.jsx("div",{className:"app-toast-host",children:l.jsxs("div",{className:`app-toast app-toast--${s}`,role:"status","aria-live":"polite",children:[l.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),l.jsxs("div",{className:"app-toast-body",children:[l.jsx("p",{className:"app-toast-title",children:t}),i?l.jsx("p",{className:"app-toast-message",children:i}):null]}),a?l.jsx("button",{type:"button",className:"app-toast-close",onClick:a,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function IE(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await BE(t),PE(await t.json(),t.status)}async function Y9(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await BE(i);const s=await i.json();if(!s||typeof s!="object"||!("state"in s))throw new dt(i.status,"Invalid global settings mutation response");return{state:PE(s.state,i.status)}}async function BE(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 dt(e.status,t)}function PE(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!X9(i.consoleStaticPort)||i.theme!=="instrument"&&i.theme!=="maritime"&&i.theme!=="carbon"||!Z9(i.language))throw new dt(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme,uiFont:yL(i.uiFont),language:i.language}}function X9(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function Z9(e){return e==="auto"||e==="en"||e==="ko"}const $g=new Set;let Cc={loading:!1,state:null,savingField:null,error:null};function Q_(){return L.useSyncExternalStore(Q9,id,id)}function id(){return Cc}function J9(e){pa({loading:!1,state:e,error:null})}function Q9(e){return $g.add(e),()=>{$g.delete(e)}}async function eP(e){pa({loading:!0,error:null});try{const t=await IE(e);pa({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;pa({loading:!1,error:zE(t)})}}async function Ro(e,t){if(Cc.savingField!==null)return!1;const i=Cc.state,s=i?{...i,[e]:t}:null;pa({state:s,savingField:e,error:null});try{const a=await Y9({[e]:t});return pa({state:a.state,savingField:null,error:null}),!0}catch(a){return pa({state:i,savingField:null,error:zE(a)}),!1}}function pa(e){Cc={...Cc,...e};for(const t of $g)t()}function zE(e){return e instanceof Error?e.message:String(e)}let wo=null,ec=0;function HE(e){wo?.abort();const t=new AbortController,i=++ec;return wo=t,TL(),UR({...e,signal:t.signal}).then(s=>{i===ec&&AL(s)}).catch(s=>{t.signal.aborted||i!==ec||RL(s instanceof Error?s.message:String(s))}).finally(()=>{i===ec&&(wo=null)})}function tP(){wo!==null&&(wo.abort(),wo=null,ec+=1)}function $E(e,t=nP()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function nP(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const FE=[{id:"fleet-cli",label:"Fleet CLI"},{id:"fleet-console",label:"Fleet Console"},{id:"fleet-desktop",label:"Fleet Desktop"},{id:"fleet-plugin",label:"Fleet Plugin"},{id:"fleet-core",label:"Fleet Core"}],Cm={id:"overview",label:"Overview"},iP={id:"all-updates",label:"All updates"},rP={id:"other-updates",label:"Other updates"};function UE(e){const t=e.sections.some(s=>s.items.some(a=>a.product===void 0)),i=FE.filter(s=>e.sections.some(a=>a.items.some(d=>d.product===s.id)));return i.length===0?[Cm,iP]:t?[Cm,...i,rP]:[Cm,...i]}function sP(e,t){return t==="overview"?[]:e.sections.map(i=>({...i,items:i.items.filter(s=>t==="all-updates"||t==="other-updates"?s.product===void 0:s.product===t)})).filter(i=>i.items.length>0)}function aP(e){const t=FE.flatMap(s=>{const a=e.sections.flatMap(d=>d.items.filter(p=>p.product===s.id));return a.length===0?[]:[{id:s.id,label:s.label,count:a.length,summary:a[0].text}]}),i=e.sections.flatMap(s=>s.items.filter(a=>a.product===void 0));return i.length===0?t:[...t,{id:t.length===0?"all-updates":"other-updates",label:t.length===0?"Pre-product-grouping updates":"Other updates",count:i.length,summary:i[0].text}]}function oP(e,t){return UE(e).some(i=>i.id===t)}const lP=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Wl=10;function cP({state:e}){const t=L.useRef(null),i=L.useRef([]),s=L.useRef(null),a=L.useRef(null),d=L.useRef(new Map),[p,c]=L.useState("overview"),h=Q_(),f=$E(h.state?.language??"auto"),g=e.selectedReleaseNoteKey??io(e.releaseNotes[0]?.version??"",0),m=e.releaseNotes.findIndex((R,I)=>io(R.version,I)===g),S=e.releaseNotes[m]??e.releaseNotes[0],C=S?io(S.version,m>=0?m:0):"",T=S?UE(S):[];L.useEffect(()=>{c("overview")},[C]),L.useEffect(()=>{S&&!oP(S,p)&&c("overview")},[p,S]),L.useEffect(()=>{const R=I=>{const Y=I.target instanceof HTMLElement?I.target:null;if(!Y||Y.closest(".whatsnew-card"))return;const z=i.current.filter(q=>q!==Y&&q.isConnected);i.current=[...z.slice(-4),Y]};return document.addEventListener("focusin",R,!0),()=>document.removeEventListener("focusin",R,!0)},[]);const w=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!w&&t.current===null&&(t.current=document.activeElement),L.useEffect(()=>{if(!e.whatsNewOpen||w)return;const R=I=>{I.key==="Escape"?(I.preventDefault(),Vu()):fP(I,a.current,c)?I.preventDefault():I.key==="Tab"&&dP(I,a.current),I.stopImmediatePropagation()};return s.current?.focus(),window.addEventListener("keydown",R,!0),()=>{window.removeEventListener("keydown",R,!0);const I=t.current?.isConnected?t.current:[...i.current].reverse().find(Y=>Y.isConnected);t.current=null,I?.focus?.()}},[e.whatsNewOpen,w]),!e.whatsNewOpen||w||S===void 0)return null;const _=()=>{HE({force:!0,locale:f})},b=async R=>{await Ro("language",R)},v=Math.max(1,Math.ceil(e.releaseNotes.length/Wl)),y=Math.min(v-1,Math.floor((m>=0?m:0)/Wl)),k=y*Wl,M=e.releaseNotes.slice(k,k+Wl),A=R=>{const I=y+R;if(I<0||I>=v)return;const Y=I*Wl,z=e.releaseNotes[Y];z&&t1(io(z.version,Y))},N=R=>{c(R),requestAnimationFrame(()=>d.current.get(R)?.focus())};return l.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[l.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Vu,"aria-label":"Close What's new"}),l.jsxs("section",{className:"whatsnew-card",ref:a,children:[l.jsxs("header",{className:"whatsnew-header",children:[l.jsxs("div",{className:"whatsnew-heading-row",children:[l.jsx("h2",{id:"whatsnew-title",children:"What's new"}),l.jsxs("span",{className:"whatsnew-version-badge",children:["v",S.version]})]}),l.jsxs("div",{className:"whatsnew-meta-row",children:[S.date?l.jsxs("time",{className:"whatsnew-date",dateTime:S.date,children:["Released ",S.date]}):l.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?l.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),l.jsx("button",{ref:s,type:"button",className:"whatsnew-close",onClick:Vu,"aria-label":"Close What's new",children:"x"}),l.jsxs("div",{className:"whatsnew-body",children:[l.jsxs("div",{className:"whatsnew-version-selector",children:[l.jsx("select",{"aria-label":"Release version",value:C,onChange:R=>t1(R.currentTarget.value),children:M.map((R,I)=>{const Y=k+I;return l.jsxs("option",{value:io(R.version,Y),children:[R.version==="Unreleased"?"Unreleased":`v${R.version}`,R.date?` · ${R.date}`:""]},io(R.version,Y))})}),v>1?l.jsxs("div",{className:"whatsnew-pagination",children:[l.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>A(-1),disabled:y===0,"aria-label":"Newer versions",children:"‹"}),l.jsxs("span",{className:"whatsnew-page-status",children:[y+1," / ",v]}),l.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>A(1),disabled:y>=v-1,"aria-label":"Older versions",children:"›"})]}):null,l.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(R=>l.jsx("button",{type:"button",className:f===R?"is-active":"","aria-pressed":f===R,disabled:h.savingField==="language",onClick:()=>{b(R)},children:R==="en"?"EN":"한국어"},R))}),l.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:_,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),l.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":"Release update categories",children:T.map(R=>l.jsx("button",{ref:I=>{I?d.current.set(R.id,I):d.current.delete(R.id)},id:`whatsnew-tab-${R.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":R.id,"aria-selected":p===R.id,"aria-controls":"whatsnew-tab-panel",tabIndex:p===R.id?0:-1,onClick:()=>c(R.id),children:R.label},R.id))}),e.releaseNotesError?l.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,l.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${p}`,children:p==="overview"?l.jsx("div",{className:"whatsnew-overview","aria-label":"Release update overview",children:aP(S).map(R=>l.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>N(R.id),children:[l.jsx("span",{className:"whatsnew-overview-label",children:R.label}),l.jsxs("span",{className:"whatsnew-overview-count",children:[R.count," ",R.count===1?"update":"updates"]}),l.jsx("span",{className:"whatsnew-overview-summary",children:R.summary})]},R.id))}):sP(S,p).map((R,I)=>l.jsx(uP,{section:R,index:I},R.heading))})]}),l.jsx("footer",{className:"whatsnew-footer",children:l.jsx("button",{type:"button",className:"whatsnew-done",onClick:Vu,children:"Close"})})]})]})}function uP({section:e,index:t}){const i=e.heading.toLowerCase().replaceAll(" ","-"),s={"--whatsnew-delay":`${t*55}ms`};return l.jsxs("section",{className:`whatsnew-section whatsnew-section--${i}`,style:s,children:[l.jsx("h3",{children:l.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),l.jsx("ul",{children:e.items.map((a,d)=>l.jsx("li",{children:l.jsx(hP,{item:a})},`${a.text}:${d}`))})]})}function hP({item:e}){return l.jsxs(l.Fragment,{children:[e.packageTags.map((t,i)=>l.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${i}`)),l.jsx("span",{children:e.text})]})}function io(e,t){return`${e}:${t}`}function dP(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(lP)),s=i[0],a=i[i.length-1];!s||!a||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a&&(e.preventDefault(),s.focus()))}function fP(e,t,i){if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight"&&e.key!=="Home"&&e.key!=="End")return!1;const s=e.target instanceof HTMLElement?e.target.closest(".whatsnew-tab[role='tab']"):null;if(!s||!t)return!1;const a=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),d=a.indexOf(s);if(d<0||a.length===0)return!1;const p=e.key==="Home"?0:e.key==="End"?a.length-1:(d+(e.key==="ArrowRight"?1:-1)+a.length)%a.length,c=a[p],h=c.dataset.tabId;return h?(i(h),c.focus(),!0):!1}function pP(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function mP(e,t=window){const i=s=>{if(!(Ow()||pP(t.document))){if((s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"){s.preventDefault(),s.stopImmediatePropagation(),e.toggleOperationSearch();return}if((s.metaKey||s.ctrlKey)&&s.code==="KeyB"&&s.altKey&&!s.shiftKey&&(s.metaKey||s.key.toLowerCase()==="b")){s.preventDefault(),s.stopImmediatePropagation(),e.toggleRailChrome();return}(s.metaKey||s.ctrlKey)&&s.code==="KeyB"&&!s.altKey&&!s.shiftKey&&(s.preventDefault(),s.stopImmediatePropagation(),e.setSideBarCollapsed(!e.getSideBarCollapsed()))}};return t.addEventListener("keydown",i,!0),()=>t.removeEventListener("keydown",i,!0)}function Ed(e=()=>{}){return{...Ux(e),notifications:{emit:i=>zL(i),dismiss:i=>WL(i)},status:{set:(i,s)=>PL(i,s),clear:i=>ww(i)}}}const gP=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function WE(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await tv(t),GE(await t.json(),t.status)}async function _P(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await tv(t),yP(await t.json(),t.status)}async function Em(e,t,i){return ev(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function vP(e,t,i,s){return ev(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,s)}async function bP(e,t,i){return ev(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function ev(e,t,i,s){const a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:s});await tv(a);const d=await a.json();if(!d||typeof d!="object"||!("state"in d))throw new dt(a.status,"Invalid carrier settings mutation response");return{state:GE(d.state,a.status)}}async function tv(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 dt(e.status,t)}function GE(e,t){qE(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new dt(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(s=>SP(s,t))}}function yP(e,t){qE(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new dt(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(s=>xP(s,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function SP(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 dt(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=>CP(s,t))}}}function xP(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 dt(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(s=>wP(s,t)),defaultModel:i.defaultModel}}function wP(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new dt(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new dt(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 CP(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 dt(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function qE(e,t){const i=[e];for(;i.length>0;){const s=i.pop();if(!(!s||typeof s!="object"))for(const[a,d]of Object.entries(s)){if(gP.has(a))throw new dt(t,"Carrier settings response leaked a restricted field");d&&typeof d=="object"&&i.push(d)}}}const EP={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Fg=new Set;let Un={loading:!1,state:null,options:null,activeCarrierId:null,draft:EP,savingActionId:null,error:null};function KE(){return L.useSyncExternalStore(kP,_x,_x)}function _x(){return Un}function kP(e){return Fg.add(e),()=>{Fg.delete(e)}}async function vx(e){br({loading:!0,error:null});try{const[t,i]=await Promise.all([WE(e),_P(e)]);VE(t,i)}catch(t){if(e?.aborted)return;br({loading:!1,error:XE(t)})}}function TP(e){const t=Un.state?.carriers.find(i=>i.carrierId===e);br({activeCarrierId:e,draft:t?nv(t,Un.options):Un.draft,error:null})}function mo(e){br({draft:{...Un.draft,...e},error:null})}function Ug(e,t){const i=Un.draft.taskforce[e]??{model:"",effort:""};br({draft:{...Un.draft,taskforce:{...Un.draft.taskforce,[e]:{...i,...t}}},error:null})}function AP(){const e=YE();e&&br({draft:nv(e,Un.options),error:null})}async function RP(e){const t=YE();return t?LP("save-all",async()=>{const i=Un.draft;let s=null;i.displayName!==t.displayName&&(s=(await Em(t.carrierId,{displayName:i.displayName})).state);const a=i.cliType!==t.cliType;return a&&(s=(await Em(t.carrierId,{cli:i.cliType})).state),(a||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(s=(await Em(t.carrierId,{model:NP(i)})).state),s=await OP(t,e,s),{state:s??await WE()}}):!1}function VE(e,t){const i=DP(e,Un.activeCarrierId),s=e.carriers.find(a=>a.carrierId===i)??null;br({loading:!1,state:e,options:t,activeCarrierId:i,draft:s?nv(s,t):Un.draft,error:null})}async function LP(e,t){br({savingActionId:e,error:null});try{const i=await t();return VE(i.state,Un.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),br({savingActionId:null}),!0}catch(i){return br({savingActionId:null,error:XE(i)}),!1}}function nv(e,t){const i=Object.fromEntries((t?.cliTypes??[]).map(s=>{const a=e.taskforce.backends.find(d=>d.cliType===s.id);return[s.id,{model:a?.model??s.defaultModel,effort:a?.effort??MP(s.id,a?.model??s.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function MP(e,t,i){return i?.cliTypes.find(d=>d.id===e)?.models.find(d=>d.modelId===t)?.effort?.default??null}function NP(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function YE(){return Un.state?.carriers.find(e=>e.carrierId===Un.activeCarrierId)??null}async function OP(e,t,i){const s=new Set(t.map(a=>a.cliType));for(const a of e.taskforce.backends)s.has(a.cliType)||(i=(await bP(e.carrierId,a.cliType)).state);for(const a of t){const d=e.taskforce.backends.find(p=>p.cliType===a.cliType);d&&d.model===a.model&&(d.effort||"")===(a.effort||"")||(i=(await vP(e.carrierId,a.cliType,{model:a.model,...a.effort?{effort:a.effort}:{}})).state)}return i}function DP(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function br(e){Un={...Un,...e};for(const t of Fg)t()}function XE(e){return e instanceof Error?e.message:String(e)}const jP=50,IP=2400,BP={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 PP(){const e=KE(),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,[a,d]=L.useState(!1),[p,c]=L.useState([]),[h,f]=L.useState("idle"),g=e.savingActionId==="save-all",m=t?WP(t,e.draft,p):!1,S=t?.taskforce.backends.map(w=>`${w.cliType}:${w.model}:${w.effort??""}`).join("|")??"";L.useEffect(()=>{const w=new AbortController;return vx(w.signal),()=>w.abort()},[]),L.useEffect(()=>{d(!1),c(t?.taskforce.backends.map(w=>w.cliType)??[]),f("idle")},[t?.carrierId,S]),L.useEffect(()=>{if(h!=="saved")return;const w=window.setTimeout(()=>f("idle"),IP);return()=>window.clearTimeout(w)},[h]);function C(){t&&(AP(),c(t.taskforce.backends.map(w=>w.cliType)),d(!1),f("idle"))}async function T(){if(!t)return;if(f("saving"),!await RP(qP(p,e.draft.taskforce))){f("idle");return}d(!1),f("saved")}return l.jsxs("main",{className:"carrier-settings-page",children:[l.jsxs("section",{className:"carrier-settings-hero","aria-labelledby":"carrier-settings-title",children:[l.jsxs("div",{children:[l.jsx("p",{className:"bridge-kicker",children:"Configure Carrier settings"}),l.jsx("h2",{id:"carrier-settings-title",children:"Carrier Settings"})]}),l.jsxs("div",{className:"carrier-settings-hero-actions",children:[l.jsx("div",{className:`carrier-settings-save-status ${h==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:h==="saving"||g?"Saving…":h==="saved"?"Saved ✓":""}),t?l.jsxs("div",{className:"carrier-settings-save-actions",children:[l.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||g,onClick:()=>{T()},children:"Save"}),l.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||g,onClick:C,children:"Discard"})]}):null,l.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{vx()},children:"Refresh"})]})]}),e.error?l.jsx("p",{className:"carrier-settings-error",role:"alert",children:e.error}):null,l.jsxs("section",{className:"carrier-settings-grid",children:[l.jsxs("div",{className:"carrier-settings-list","aria-label":"Carrier list",children:[e.loading&&!e.state?l.jsx("p",{className:"carrier-settings-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?l.jsx("p",{className:"carrier-settings-empty",children:"No carriers registered."}):null,e.state?.carriers.map(w=>l.jsx(zP,{carrier:w,active:w.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>TP(w.carrierId)},w.carrierId))]}),t&&e.options&&i?l.jsxs("div",{className:"carrier-settings-detail",style:QE(t.carrierId),children:[l.jsxs("div",{className:"carrier-settings-detail-head",children:[l.jsxs("div",{className:"carrier-settings-detail-title-block",children:[l.jsxs("div",{className:"carrier-settings-captain-id",children:[l.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),l.jsx("div",{className:`carrier-settings-name-line ${a?"is-editing":""}`,children:a?l.jsxs(l.Fragment,{children:[l.jsx("input",{id:"carrier-display-name",className:"carrier-settings-input carrier-settings-name-input",value:e.draft.displayName,maxLength:jP,onChange:w=>mo({displayName:w.target.value})}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:g,onClick:()=>{d(!1)},children:l.jsx(VP,{})}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{mo({displayName:t.displayName}),d(!1)},children:l.jsx(YP,{})})]}):l.jsxs(l.Fragment,{children:[l.jsx("h3",{className:"carrier-settings-captain-name",children:t.displayName}),l.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Edit display name",onClick:()=>{mo({displayName:t.displayName}),d(!0)},children:l.jsx(KP,{})})]})}),l.jsx("div",{className:"carrier-settings-captain-role",children:t.role})]}),l.jsxs("div",{className:"carrier-settings-cli-badge",children:[l.jsx("span",{className:"ind","aria-hidden":"true"}),t.cliType]})]}),l.jsxs("div",{className:"carrier-settings-body",children:[l.jsxs("div",{className:"carrier-settings-control-group",children:[l.jsx("div",{className:"carrier-settings-resp-title",children:"Identity"}),l.jsx("div",{className:"carrier-settings-mission",children:t.roleDescription})]}),l.jsxs("div",{className:"carrier-settings-control-group",children:[l.jsx("div",{className:"carrier-settings-resp-title",children:"Runtime"}),l.jsxs("div",{className:"carrier-settings-runtime",children:[l.jsx("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--cli",children:l.jsxs("div",{className:"carrier-settings-field carrier-settings-field--wide",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:"carrier-cli",children:"CLI"}),l.jsx("select",{id:"carrier-cli",className:"carrier-settings-select",value:e.draft.cliType,onChange:w=>$P(w.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(w=>l.jsx("option",{value:w.id,children:w.displayName},w.id))})]})}),l.jsxs("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--model",children:[l.jsx(ZE,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:w=>FP(i,w)}),l.jsx(JE,{id:"carrier-effort",model:s,value:e.draft.effort,onChange:w=>mo({effort:w})})]})]})]}),l.jsx(HP,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:p,onRowsChange:c})]})]},t.carrierId):l.jsx("div",{className:"carrier-settings-detail",children:l.jsx("p",{className:"carrier-settings-empty",children:"Select a carrier."})})]})]})}function zP({carrier:e,active:t,minBackends:i,onSelect:s}){const a=e.taskForceBackendCount>=i;return l.jsxs("button",{type:"button",className:`carrier-settings-row ${t?"is-active":""}`,style:QE(e.carrierId),onClick:s,children:[l.jsx("span",{className:"carrier-settings-captain-dot","aria-hidden":"true"}),l.jsxs("span",{className:"carrier-settings-row-text",children:[l.jsx("span",{className:"carrier-settings-row-name",children:e.displayName}),l.jsx("span",{className:"carrier-settings-row-role",children:e.role})]}),l.jsx("span",{className:"carrier-settings-row-live","aria-hidden":"true",children:l.jsx("span",{className:`carrier-settings-live-dot ${a?"is-live":""}`})})]})}function ZE({id:e,label:t,models:i,value:s,disabled:a=!1,onChange:d}){return l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:t}),l.jsx("select",{id:e,className:"carrier-settings-select",value:s,disabled:a,onChange:p=>d(p.target.value),children:i.map(p=>l.jsx("option",{value:p.modelId,children:p.name},p.modelId))})]})}function JE({id:e,model:t,value:i,disabled:s=!1,onChange:a}){return t?.effort?l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:"Effort"}),l.jsx("select",{id:e,className:"carrier-settings-select",value:i||t.effort.default,disabled:s,onChange:d=>a(d.target.value),children:t.effort.levels.map(d=>l.jsx("option",{value:d,children:d},d))})]}):l.jsxs("div",{className:"carrier-settings-field",children:[l.jsx("span",{className:"carrier-settings-label",children:"Effort"}),l.jsx("p",{className:"carrier-settings-help",children:"Not supported for this model."})]})}function HP({carrier:e,cliOptions:t,minBackends:i,savingActionId:s,rows:a,onRowsChange:d}){const p=KE(),c=e.taskforce.backends.length,[h,f]=L.useState(c>0),[g,m]=L.useState(!1),[S,C]=L.useState(""),T=e.taskForceBackendCount>=i,w=t.filter(b=>!a.includes(b.id)),_=S||w[0]?.id||"";return l.jsxs("div",{className:`carrier-settings-control-group carrier-settings-control-group--taskforce ${h?"is-expanded":""}`,children:[l.jsxs("div",{className:"carrier-settings-section-head",children:[l.jsxs("div",{children:[l.jsx("p",{className:"carrier-settings-resp-title",children:"Task Force"}),l.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.`})]}),l.jsx("div",{className:"carrier-settings-tf-head-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":h,onClick:()=>f(b=>!b),children:h?"Hide":"Configure"})})]}),h?l.jsxs("div",{className:"carrier-settings-tf-list",children:[a.length===0?l.jsx("p",{className:"carrier-settings-tf-empty",children:"No Task Force backend drafted."}):null,a.map(b=>{const v=t.find(A=>A.id===b);if(!v)return null;const y=p.draft.taskforce[v.id]??{model:v.defaultModel,effort:""},k=v.models.find(A=>A.modelId===y.model)??v.models[0]??null,M=e.taskforce.backends.some(A=>A.cliType===v.id);return l.jsxs("div",{className:`carrier-settings-tf-item ${M?"is-active":""}`,children:[l.jsxs("div",{className:"carrier-settings-tf-title",children:[l.jsx("span",{className:`carrier-settings-live-dot ${M?"is-live":""}`,"aria-hidden":"true"}),l.jsx("strong",{children:v.displayName})]}),l.jsx(ZE,{id:`tf-${v.id}-model`,label:"Model",models:v.models,value:y.model,onChange:A=>UP(v,A)}),l.jsx(JE,{id:`tf-${v.id}-effort`,model:k,value:y.effort,onChange:A=>Ug(v.id,{effort:A})}),l.jsx("div",{className:"carrier-settings-tf-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:s==="save-all",onClick:()=>d(a.filter(A=>A!==v.id)),children:"Remove"})})]},v.id)}),l.jsxs("div",{className:"carrier-settings-tf-add-row",children:[g&&w.length>0?l.jsx("select",{className:"carrier-settings-select carrier-settings-tf-add-select",value:_,onChange:b=>C(b.target.value),"aria-label":"Task Force CLI to add",children:w.map(b=>l.jsx("option",{value:b.id,children:b.displayName},b.id))}):null,l.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:w.length===0||s==="save-all",onClick:()=>{if(!g){m(!0);return}const b=_,v=t.find(k=>k.id===b),y=v?.models.find(k=>k.modelId===v.defaultModel)??v?.models[0]??null;!v||!y||(Ug(v.id,{model:y.modelId,effort:y.effort?.default??""}),d(a.includes(v.id)?a:[...a,v.id]),C(""),m(!1))},children:"Add"})]})]}):null]})}function $P(e,t){const i=t.find(a=>a.id===e),s=i?.models.find(a=>a.modelId===i.defaultModel)??i?.models[0]??null;mo({cliType:e,model:s?.modelId??"",effort:s?.effort?.default??""})}function FP(e,t){const i=e.models.find(s=>s.modelId===t);mo({model:t,effort:i?.effort?.default??""})}function UP(e,t){const i=e.models.find(s=>s.modelId===t);Ug(e.id,{model:t,effort:i?.effort?.default??""})}function WP(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:GP(e,i,t.taskforce)}function GP(e,t,i){if(t.length!==e.taskforce.backends.length)return!0;const s=new Set(t);for(const a of e.taskforce.backends){if(!s.has(a.cliType))return!0;const d=i[a.cliType];if(!d||d.model!==a.model||(d.effort||"")!==(a.effort||""))return!0}return!1}function qP(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 QE(e){return{"--cap-color":BP[e]??"var(--brass)"}}function KP(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.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"}),l.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function VP(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function YP(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),l.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}async function XP(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await ZP(t),JP(await t.json(),t.status).routes}async function ZP(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 dt(e.status,t)}function JP(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new dt(t,"Invalid backend API catalog response");return{routes:i.routes.map(s=>QP(s,t))}}function QP(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 dt(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const Wg=new Set;let Gg={loading:!1,state:null,error:null};function ez(){return L.useSyncExternalStore(tz,bx,bx)}function bx(){return Gg}function tz(e){return Wg.add(e),()=>{Wg.delete(e)}}async function nz(e){km({loading:!0,error:null});try{const t=await XP(e);km({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;km({loading:!1,error:iz(t)})}}function km(e){Gg={...Gg,...e};for(const t of Wg)t()}function iz(e){return e instanceof Error?e.message:String(e)}function rz(){const e=ez(),[t,i]=L.useState(!0),s=L.useMemo(()=>oz(e.state??[]),[e.state]),a=e.state?.length??0,d=s.length;return L.useEffect(()=>{const p=new AbortController;return nz(p.signal),()=>p.abort()},[]),l.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[l.jsx("div",{className:`backend-api-control carrier-settings-control-group--taskforce ${t?"is-expanded":""}`,children:l.jsxs("div",{className:"carrier-settings-section-head",children:[l.jsxs("div",{className:"backend-api-head",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),l.jsx("p",{className:"global-settings-help",children:a>0?`${a} loopback route${a===1?"":"s"} across ${d} categor${d===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),l.jsx("div",{className:"carrier-settings-tf-head-actions",children:l.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":t,onClick:()=>i(p=>!p),children:t?"Hide":"Show"})})]})}),e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?l.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?l.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(p=>l.jsx(sz,{group:p},p.category)):null,e.state&&s.length===0?l.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,l.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 sz({group:e}){return l.jsxs("div",{className:"backend-api-group",children:[l.jsxs("div",{className:"backend-api-group-head",children:[l.jsx("span",{children:e.category}),l.jsx("span",{children:e.entries.length})]}),l.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>l.jsx(az,{entry:t},`${t.method}:${t.path}`))})]})}function az({entry:e}){return l.jsxs("div",{className:"backend-api-row",children:[l.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),l.jsx("code",{className:"backend-api-path",children:e.path}),l.jsx("span",{className:"backend-api-summary",children:e.summary}),l.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function oz(e){const t=new Map;for(const i of e){const s=i.category.trim()||"Uncategorized",a=t.get(s);a?a.push(i):t.set(s,[i])}return Array.from(t.entries()).map(([i,s])=>({category:i,entries:s}))}const lz=[{id:"instrument",label:"Instrument",swatch:["oklch(16.5% 0.016 245)","oklch(80% 0.085 78)","oklch(77% 0.085 200)"]},{id:"maritime",label:"Maritime",swatch:["oklch(20% 0.045 248)","oklch(78% 0.13 75)","oklch(82% 0.13 195)"]},{id:"carbon",label:"Carbon",swatch:["oklch(18% 0.007 255)","oklch(76% 0.115 62)","oklch(80% 0.105 205)"]}],cz=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],uz=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],hz=1024,dz=65535,fz=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function pz(){const e=Q_(),t=e.state,i=e.savingField!==null,[s,a]=L.useState("general"),d=jo(),p=gz(d.plugins),c=_z(p);return L.useEffect(()=>{const h=new AbortController;return eP(h.signal),()=>h.abort()},[]),l.jsxs("main",{className:"global-settings-page",children:[l.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[l.jsxs("div",{children:[l.jsx("p",{className:"bridge-kicker",children:"Console"}),l.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),l.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:i?"Saving…":""})]}),e.error?l.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,l.jsxs("section",{className:"global-settings-grid",children:[l.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[l.jsx("p",{className:"global-settings-nav-group",children:"Console"}),fz.map(h=>l.jsxs("button",{type:"button",className:`global-settings-nav-item ${h.id===s?"is-active":""}`,"aria-pressed":h.id===s,onClick:()=>a(h.id),children:[l.jsx("span",{className:"global-settings-nav-label",children:h.label}),l.jsx("span",{className:"global-settings-nav-eyebrow",children:h.eyebrow})]},h.id)),p.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),c.map(h=>l.jsxs("div",{className:"global-settings-plugin-group",children:[l.jsx("p",{className:"global-settings-plugin-heading",children:h.pluginLabel}),h.sections.map(f=>l.jsxs("button",{type:"button",className:`global-settings-nav-item ${f.id===s?"is-active":""}`,"aria-pressed":f.id===s,onClick:()=>a(f.id),children:[l.jsx("span",{className:"global-settings-nav-label",children:f.sectionTitle}),l.jsx("span",{className:"global-settings-nav-eyebrow",children:f.pluginLabel})]},f.id))]},h.pluginId))]}):null]}),l.jsx("div",{className:"global-settings-detail",children:mz(s,t,i,p)},s)]})]})}function mz(e,t,i,s){if(e.includes(":")){const a=s.find(d=>d.id===e);return a?.render?l.jsx(t_,{fallback:l.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:a.render()}):l.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return l.jsxs(l.Fragment,{children:[l.jsx(bz,{state:t,saving:i}),l.jsx(yz,{state:t,saving:i}),l.jsx(Sz,{state:t,saving:i})]});case"backend-api":return l.jsx(rz,{})}}function gz(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:vz(t.id),sectionTitle:i.title,render:i.render})))}function _z(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 vz(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function bz({state:e,saving:t}){const i=e?.theme??"instrument",s=a=>{if(id().savingField!==null)return;const d=i;Ph(a),Ro("theme",a).then(p=>{p||Ph(d)})};return l.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),l.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),l.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:lz.map(a=>{const d=a.id===i;return l.jsxs("button",{type:"button","aria-pressed":d,className:`theme-card ${d?"is-active":""}`,disabled:t,onClick:()=>s(a.id),children:[l.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:a.swatch.map(p=>l.jsx("i",{style:{background:p}},p))}),l.jsx("span",{className:"theme-card-label",children:a.label}),l.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:d?l.jsx(Cz,{}):null})]},a.id)})})]}),l.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function yz({state:e,saving:t}){const i=e?.uiFont??nc,[s,a]=L.useState([]),[d,p]=L.useState(!0),[c,h]=L.useState(null);L.useEffect(()=>{const m=new AbortController;return Jw({signal:m.signal}).then(S=>{a(S.fonts.filter(C=>C.uiSuitable).map(({family:C,monospace:T})=>({family:C,monospace:T}))),h(null)}).catch(S=>{m.signal.aborted||(a([]),h(S instanceof Error?S.message:"Installed fonts could not be loaded."))}).finally(()=>{m.signal.aborted||p(!1)}),()=>m.abort()},[]);const f=m=>{if(id().savingField!==null)return;const S=i;Km(m),Ro("uiFont",m).then(C=>{C||Km(S)})},g=m=>{const S=m.source==="builtin"?{source:"builtin",id:m.id,size:i.size}:{source:"system",familyName:m.familyName,size:i.size};f(S)};return l.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[l.jsxs("div",{className:"global-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),l.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),l.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||i.source==="builtin"&&i.id==="manrope"&&i.size===go.defaultValue,onClick:()=>f(nc),children:"Reset to Fleet default"})]}),l.jsx(Xw,{builtIns:Bh.map(({id:m,label:S,family:C,aliases:T,description:w})=>({id:m,label:S,family:C,aliases:T,description:w})),installedFonts:s,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:_w(nc),previewText:"Fleet typography keeps operations readable.",size:i.size,sizeRange:go,loading:d,error:c,disabled:!e||t,onSelectionChange:g,onSizeCommit:m=>f({...i,size:m})}),l.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function Sz({state:e,saving:t}){const i=ur();return l.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?l.jsxs(l.Fragment,{children:[l.jsx(wz,{state:e,saving:t,consoleState:i}),l.jsx(xz,{state:e,saving:t})]}):l.jsx("p",{className:"global-settings-help",children:"Loading settings."}),l.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function xz({state:e,saving:t}){return l.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),l.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),l.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:uz.map(i=>{const s=e.language===i.id;return l.jsx("button",{type:"button","aria-pressed":s,className:`segmented-option ${s?"is-active":""}`,disabled:t,onClick:()=>{Ro("language",i.id)},children:i.label},i.id)})}),l.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function wz({state:e,saving:t,consoleState:i}){const[s,a]=L.useState(e.consoleStaticPort?.toString()??""),d=i.effectivePort,p=i.portMode==="static"&&!i.portHonored,c=i.requestedPort,h=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=s.trim(),g=Number(f),m=f.length>0,S=m&&yx(g),C=e.consolePortMode==="static"&&m&&!S;return L.useEffect(()=>{a(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),l.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[l.jsxs("div",{className:"global-settings-row-text",children:[l.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",l.jsx("span",{className:"new-badge",children:"New"})]}),l.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."})]}),l.jsxs("div",{className:"console-port-control",children:[l.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:cz.map(T=>{const w=e.consolePortMode===T.id;return l.jsx("button",{type:"button","aria-pressed":w,className:`segmented-option ${w?"is-active":""}`,disabled:t,onClick:()=>{Ro("consolePortMode",T.id)},children:T.label},T.id)})}),l.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:l.jsxs("div",{className:"console-port-reveal-inner",children:[l.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),l.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;a(w);const _=Number(w.trim());yx(_)&&Ro("consoleStaticPort",_)}}),l.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${C?"is-invalid":""}`,children:"1024–65535"})]})}),l.jsxs("div",{className:`console-port-effective ${p?"is-fallback":""}`,"aria-live":"polite",children:[l.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),l.jsxs("div",{children:[l.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),l.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",l.jsx("span",{children:d||"..."}),p?" · Dynamic":""]})]})]}),p&&c?l.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",l.jsx("strong",{children:c})," was unavailable — the console fell back to a ",l.jsx("strong",{children:"Dynamic"})," port and is running on ",l.jsxs("strong",{children:["127.0.0.1:",d||"..."]}),"."," ",h?l.jsxs(l.Fragment,{children:["Next restart will try ",l.jsx("strong",{children:e.consoleStaticPort}),"."]}):l.jsx(l.Fragment,{children:"Next restart will use a dynamic port."})]}):null,l.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function yx(e){return Number.isInteger(e)&&e>=hz&&e<=dz}function Cz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Ez(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 kz(e,t){return{...Ez(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const Sx=256,xx=176,Tm=12,ph=220,e5="fleet-console.map.radarCollapsed";function Tz({operations:e,pluginOperations:t,viewport:i,canvasSize:s,onJump:a}){const d=L.useRef(null),p=L.useRef(!1),c=L.useRef(null),[h,f]=L.useState(Az),g=Sd();if(L.useEffect(()=>{if(g){c.current===null&&(c.current=h,f(!0));return}c.current!==null&&(f(c.current),c.current=null)},[h,g]),s.width<=0||s.height<=0||i.zoom<=0)return null;const m=[...Object.entries(e).map(([F,P])=>({id:F,x:P.x,y:P.y,width:P.width,height:P.height})),...Object.entries(t).map(([F,P])=>({id:F,x:P.geometry.x,y:P.geometry.y,width:P.geometry.width,height:P.geometry.height}))];if(m.length===0)return null;const S=()=>{f(F=>{const P=!F;return g||Rz(P),P})};if(h)return l.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:l.jsx(Mz,{})});const C=Sx-Tm*2,T=xx-Tm*2,w={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let _=Math.min(w.x,...m.map(F=>F.x)),b=Math.min(w.y,...m.map(F=>F.y)),v=Math.max(w.x+w.width,...m.map(F=>F.x+F.width)),y=Math.max(w.y+w.height,...m.map(F=>F.y+F.height));_-=ph,b-=ph,v+=ph,y+=ph;const k=v-_,M=y-b,A=Math.min(C/k,T/M),N=(C-k*A)/2,R=(T-M*A)/2,I=F=>N+(F-_)*A,Y=F=>R+(F-b)*A,z=F=>{const P=d.current?.getBoundingClientRect();if(!P)return;const K=F.clientX-P.left,X=F.clientY-P.top;a({x:_+(K-N)/A,y:b+(X-R)/A})},q=F=>{F.stopPropagation(),p.current=!0,F.currentTarget.setPointerCapture(F.pointerId),z(F)},B=F=>{p.current&&(F.stopPropagation(),z(F))},W=F=>{p.current=!1;try{F.currentTarget.releasePointerCapture(F.pointerId)}catch{}};return l.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:Sx,height:xx},children:[l.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),l.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:l.jsx(Lz,{})}),l.jsxs("div",{ref:d,className:"canvas-minimap-inner",style:{inset:Tm},onPointerDown:q,onPointerMove:B,onPointerUp:W,onPointerCancel:W,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[m.map(F=>l.jsx("div",{className:"canvas-minimap-operation",style:{left:I(F.x),top:Y(F.y),width:Math.max(2,F.width*A),height:Math.max(2,F.height*A)}},F.id)),l.jsx("div",{className:"canvas-minimap-view",style:{left:I(w.x),top:Y(w.y),width:w.width*A,height:w.height*A}})]})]})}function Az(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(e5)==="true"}catch{return!1}}function Rz(e){if(!(typeof window>"u"))try{window.localStorage.setItem(e5,String(e))}catch{}}function Lz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Mz(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[l.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),l.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),l.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function Nz({viewport:e}){return l.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[l.jsx("div",{className:"operations-canvas-sea"}),l.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const wx=8,Oz=120;function Dz({anchor:e,accentKey:t,onSelect:i,onClose:s}){const[a,d]=L.useState(void 0);L.useLayoutEffect(()=>{const c=Math.max(8,Math.min(e.left,window.innerWidth-8)),h=e.bottom+wx,f=h+Oz>window.innerHeight;d(f?{position:"fixed",left:c,top:"auto",bottom:Math.round(window.innerHeight-e.top+wx)}:{position:"fixed",left:c,top:Math.round(h)})},[e]),L.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 js.createPortal(l.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:s,children:a?l.jsxs("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:a,onPointerDown:c=>c.stopPropagation(),children:[l.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:[l.jsx("span",{}),"None"]}),bd.map(c=>l.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":c.label,"aria-pressed":t===c.key,onClick:()=>p(c.key),children:l.jsx("span",{style:{background:c.color}})},c.key))]}):null}),document.body)}const jz=["n","ne","e","se","s","sw","w","nw"],Am=320,Rm=200,Iz=1500;function Bz({operation:e,active:t,geometry:i,zoom:s,status:a,minimized:d=!1,maximized:p=!1,interactionDisabled:c=!1,accentKey:h=null,children:f,onActivate:g,onClose:m,onMinimize:S,onMaximize:C,onRename:T,onSetAccent:w,onGeometryChange:_,onGeometryCommit:b}){const v=L.useRef(null),y=L.useRef(null),k=L.useRef(null),M=L.useRef(null),A=L.useRef(null),N=L.useRef(!1),[R,I]=L.useState(null),[Y,z]=L.useState(!1),q=e.title,B=X_({currentTitle:e.title,onBegin:()=>{K()},onCommit:ye=>{T(ye),N.current=!0}}),W=h?ko(h):null,F=["canvas-operation",t?"is-active":"",d?"is-minimized":"",p?"is-maximized":"",zz(a)].filter(Boolean).join(" ");L.useEffect(()=>()=>{A.current!==null&&window.clearTimeout(A.current)},[]),L.useEffect(()=>{if(B.renaming||!N.current)return;N.current=!1;const ye=window.requestAnimationFrame(()=>y.current?.focus());return()=>window.cancelAnimationFrame(ye)},[B.renaming]);const P=()=>{A.current!==null&&(window.clearTimeout(A.current),A.current=null)},K=()=>{P(),z(!1)},X=()=>{P(),z(!0),A.current=window.setTimeout(()=>{A.current=null,z(!1)},Iz)},O=ye=>{K(),!(p||c)&&ye.button===0&&(ye.preventDefault(),ye.stopPropagation(),g(),k.current={pointerId:ye.pointerId,startX:ye.clientX,startY:ye.clientY,geometry:i,latest:i},ye.currentTarget.setPointerCapture(ye.pointerId))},H=ye=>{if(p||c)return;const Oe=k.current;if(!Oe||Oe.pointerId!==ye.pointerId)return;ye.preventDefault(),ye.stopPropagation();const wt={...Oe.geometry,x:Oe.geometry.x+(ye.clientX-Oe.startX)/s,y:Oe.geometry.y+(ye.clientY-Oe.startY)/s};Oe.latest=wt,_(wt)},j=ye=>{if(p||c){k.current=null;return}const Oe=k.current;!Oe||Oe.pointerId!==ye.pointerId||(ye.preventDefault(),ye.stopPropagation(),k.current=null,ye.currentTarget.releasePointerCapture(ye.pointerId),b(Oe.latest))},G=(ye,Oe)=>{p||c||(Oe.preventDefault(),Oe.stopPropagation(),g(),M.current={direction:ye,pointerId:Oe.pointerId,startX:Oe.clientX,startY:Oe.clientY,geometry:i,latest:i},Oe.currentTarget.setPointerCapture(Oe.pointerId))},V=ye=>{if(p||c)return;const Oe=M.current;if(!Oe||Oe.pointerId!==ye.pointerId)return;ye.preventDefault(),ye.stopPropagation();const wt=Pz(Oe.geometry,Oe.direction,(ye.clientX-Oe.startX)/s,(ye.clientY-Oe.startY)/s);Oe.latest=wt,_(wt)},ne=ye=>{if(p||c){M.current=null;return}const Oe=M.current;!Oe||Oe.pointerId!==ye.pointerId||(ye.preventDefault(),ye.stopPropagation(),M.current=null,ye.currentTarget.releasePointerCapture(ye.pointerId),b(Oe.latest))},ie=ye=>{ye.stopPropagation()},ve=ye=>{ye.stopPropagation(),K()},ee=ye=>{ye.stopPropagation(),g()},$=ye=>{ye.stopPropagation()},ae=()=>{K();const ye=typeof document<"u"?document.activeElement:null;ye instanceof HTMLElement&&v.current?.contains(ye)&&ye.blur(),S()},ge=()=>{K(),C?.()},we=ye=>{K(),g(),I(ye)},de=ye=>{ye.stopPropagation(),K(),g()},Ce=()=>{if(!Y){X();return}K(),m()},Le=ye=>{ye.stopPropagation(),B.begin()},Me=ye=>{ye.key!=="Enter"&&ye.key!=="F2"||(ye.preventDefault(),ye.stopPropagation(),B.begin())},qe=ye=>{ye.key==="Escape"&&(N.current=!0),B.handleKeyDown(ye)},ke={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...W?{"--user-accent":W}:{}};return l.jsxs("article",{ref:v,className:F,style:ke,onPointerDown:g,"data-canvas-operation":!0,"aria-label":`Operation ${q}`,inert:d?!0:void 0,children:[!p&&!c?l.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:O,onPointerMove:H,onPointerUp:j,onPointerCancel:j,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,l.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:O,onPointerMove:H,onPointerUp:j,onPointerCancel:j,"data-canvas-blocker":!0,children:[!t&&B.renaming?l.jsx("input",{ref:B.inputRef,className:"canvas-operation-identity-input",value:B.draftTitle,"aria-label":`Rename operation ${q}`,onChange:ye=>B.setDraftTitle(ye.target.value),onKeyDown:qe,onBlur:B.handleBlur,onPointerDown:ve}):t?null:l.jsx("button",{ref:y,type:"button",className:"canvas-operation-identity-name",onPointerDown:ve,onDoubleClick:Le,onKeyDown:Me,"aria-label":`Rename operation ${q}`,title:`${q} — Double-click, Enter, or F2 to rename`,children:q}),w?l.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:ie,onClick:ye=>we(ye.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${q}`,"aria-haspopup":"menu",title:"Set accent",children:l.jsx("span",{className:Cx(a),"aria-hidden":"true"})}):l.jsx("span",{className:Cx(a),onPointerDown:de,"aria-hidden":"true"}),l.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:ie,onClick:ae,"aria-label":`Minimize operation ${q}`,title:"Minimize operation",children:l.jsx(Hz,{})}),C?l.jsx("button",{type:"button",className:`canvas-operation-icon-button ${p?"is-active":""}`,onPointerDown:ie,onClick:ge,"aria-label":p?`Restore operation ${q}`:`Maximize operation ${q}`,"aria-pressed":p,title:p?"Restore operation":"Maximize operation",children:p?l.jsx(Fz,{}):l.jsx($z,{})}):null,l.jsx("button",{type:"button",className:`canvas-operation-icon-button ${Y?"is-armed-close":""}`,onPointerDown:ie,onClick:Ce,"aria-label":Y?`Confirm close operation ${q}`:`Close operation ${q}`,title:Y?"Confirm close":"Close operation",children:Y?"Close?":l.jsx(Uz,{})})]}),l.jsx("div",{className:"canvas-operation-terminal",onPointerDown:ee,onWheel:$,"data-canvas-blocker":!0,children:f}),!p&&!c&&jz.map(ye=>l.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${ye}`,onPointerDown:Oe=>G(ye,Oe),onPointerMove:V,onPointerUp:ne,onPointerCancel:ne,"data-canvas-blocker":!0,"aria-hidden":"true"},ye)),R&&w?l.jsx(Dz,{anchor:R,accentKey:h,onSelect:w,onClose:()=>I(null)}):null]})}function Pz(e,t,i,s){let{x:a,y:d,width:p,height:c}=e;return t.includes("e")&&(p+=i),t.includes("s")&&(c+=s),t.includes("w")&&(a+=i,p-=i),t.includes("n")&&(d+=s,c-=s),p<Am&&(t.includes("w")&&(a-=Am-p),p=Am),c<Rm&&(t.includes("n")&&(d-=Rm-c),c=Rm),{...e,x:a,y:d,width:p,height:c}}function zz(e){const t=wd(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function Cx(e){const t=wd(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"tenant-beacon is-idle"}function Hz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function $z(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Fz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Uz(){return l.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:l.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 Wz({rect:e,viewport:t}){const i=kz(e,t);return l.jsx("div",{className:"canvas-rubber-band",style:{left:i.x,top:i.y,width:i.width,height:i.height},"aria-hidden":"true"})}const Gz=.25,qz=2,Kz=200,Vz=150,Ex=5,Yz=.0018;function Xz({viewport:e,disabled:t=!1,consumePointerDown:i=!1,onViewportChange:s,onZoom:a,onCreate:d,onConsumePointerDown:p,onClick:c}){const h=L.useRef(null),f=L.useRef(e),[g,m]=L.useState(null),[S,C]=L.useState(!1),[T,w]=L.useState(!1);L.useEffect(()=>{f.current=e},[e]),L.useEffect(()=>{const A=R=>{R.key==="Shift"&&w(!0),!Zz(R.target)&&R.code==="Space"&&(R.preventDefault(),C(!0))},N=R=>{R.key==="Shift"&&w(!1),R.code==="Space"&&C(!1)};return window.addEventListener("keydown",A),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",A),window.removeEventListener("keyup",N)}},[]);const _=A=>{if(t||kx(A.target)||A.button!==0&&A.button!==1)return;if(A.preventDefault(),i){p?.();return}const N=Mm(A),R=A.shiftKey&&A.button===0&&!S?"create":"pan";h.current={pointerId:A.pointerId,mode:R,startScreen:N,currentScreen:N,startViewport:f.current},A.currentTarget.setPointerCapture(A.pointerId),R==="create"&&m(Lm(N,N,f.current))},b=A=>{const N=h.current;if(!N||N.pointerId!==A.pointerId)return;A.preventDefault();const R=Mm(A);if(h.current={...N,currentScreen:R},N.mode==="pan"){s({...N.startViewport,x:N.startViewport.x+R.x-N.startScreen.x,y:N.startViewport.y+R.y-N.startScreen.y});return}m(Lm(N.startScreen,R,f.current))},v=A=>{M(A,!0)},y=A=>{M(A,!1)},k=A=>{if(t||kx(A.target))return;A.preventDefault();const N=Mm(A),R=f.current,I=Jz(R.zoom*Math.exp(-A.deltaY*Yz),Gz,qz),Y=Ec(N,R);a({x:N.x-Y.x*I,y:N.y-Y.y*I,zoom:I})},M=(A,N)=>{const R=h.current;if(!R||R.pointerId!==A.pointerId||(h.current=null,A.currentTarget.releasePointerCapture(A.pointerId),m(null),!N))return;const I=Math.abs(R.currentScreen.x-R.startScreen.x),Y=Math.abs(R.currentScreen.y-R.startScreen.y);if(I<Ex&&Y<Ex){c?.();return}if(R.mode!=="create")return;const z=Lm(R.startScreen,R.currentScreen,f.current),q={x:z.x,y:z.y,width:Math.max(z.width,Kz),height:Math.max(z.height,Vz)};d(q,R.currentScreen)};return{rubberBand:g,spaceActive:S,shiftActive:T,onPointerDown:_,onPointerMove:b,onPointerUp:v,onPointerCancel:y,onWheel:k}}function Lm(e,t,i){const s=Ec(e,i),a=Ec(t,i),d=Math.min(s.x,a.x),p=Math.min(s.y,a.y);return{x:d,y:p,width:Math.abs(s.x-a.x),height:Math.abs(s.y-a.y)}}function Mm(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function kx(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function Zz(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function Jz(e,t,i){return Math.min(i,Math.max(t,e))}const Qz="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",eH=560,tH=360;function nH({state:e,catalog:t,canLaunch:i,renderKindIcon:s,onLaunchKind:a,onLaunchAtGeometry:d,onClose:p,onFocus:c,onRename:h,onSetAccent:f}){const g=L.useRef(null),m=cE(),S=hE(),C=Sd(),T=uE(),w=dE(),_=e.activeOperationId,[b,v]=L.useState(null),y=jo(),[k,M]=L.useState({width:0,height:0}),A=!e.activeTheaterId||e.addingTheater;L.useEffect(()=>{const V=g.current;if(!V||typeof ResizeObserver>"u")return;const ne=()=>M({width:V.clientWidth,height:V.clientHeight});ne();const ie=new ResizeObserver(ne);return ie.observe(V),()=>ie.disconnect()},[]);const N=Xz({viewport:m.viewport,disabled:A||C,onViewportChange:jg,onZoom:fE,onCreate:V=>{if(v(null),e.activeTheaterId&&i){const ne=lH(t);if(!ne)return;const ie={...sH(V),zIndex:ga()};d(ne.pluginId,ne.kind,ie)}},consumePointerDown:b!==null,onConsumePointerDown:()=>{v(null)},onClick:rH}),R=(V,ne)=>{const ie=b?.canvasPoint;v(null),ie&&a(V,ne,ie)},I=V=>{if(V.target instanceof Element&&V.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;V.preventDefault();const ne=g.current?.getBoundingClientRect();if(!ne)return;const ie={x:V.clientX-ne.left,y:V.clientY-ne.top};v({anchor:ie,canvasPoint:Ec(ie,m.viewport)})},Y=new Set(w);L.useEffect(()=>{e.activeOperationId&&Y.has(e.activeOperationId)&&gi(null)},[w,e.activeOperationId]);const z=Object.fromEntries(Object.entries(m.operations).filter(([V])=>!Y.has(V))),q=(e.operations??[]).filter(V=>V.theaterId===e.activeTheaterId),B=q,W=q.length>0,F=y.operationKinds,K=T!==null&&q.some(V=>V.id===T&&!Y.has(V.id))?T:null,X=kw(q,e.groups.filter(V=>V.theaterId===e.activeTheaterId),m.operationOrder,[]).filter(V=>!Y.has(V.id)).map(V=>V.id),O=C?xB({x:0,y:0,width:k.width,height:k.height},X.length,void 0,void 0,void 0,void 0,S):[],H=new Map(X.map((V,ne)=>[V,O[ne]])),j=K||C?1:m.viewport.zoom,G=oH(m.operations)+1;return l.jsxs("main",{className:`operations-canvas ${N.spaceActive?"is-panning":""} ${N.shiftActive?"is-creating":""} ${K?"is-panel-maximized":""} ${C?"is-formation-view":""}`,onPointerDown:N.onPointerDown,onPointerMove:N.onPointerMove,onPointerUp:N.onPointerUp,onPointerCancel:N.onPointerCancel,onWheel:N.onWheel,onContextMenu:I,ref:g,children:[l.jsx(Nz,{viewport:m.viewport}),l.jsx("div",{style:{transform:K||C?"none":`translate(${Math.round(m.viewport.x)}px, ${Math.round(m.viewport.y)}px) scale(${m.viewport.zoom})`},className:"operations-canvas-world",children:B.map(V=>{const ne=m.operations[V.id]??V.geometry??Nm(V),ie=K===V.id,ve=H.get(V.id),ee=ie?aH(k,G):ve?{...ne,...ve}:ne;return uH(V,{active:_===V.id,geometry:ee,operationKindRegistry:F,status:e.operationStatus[V.id],theme:e.activeTheme,viewportZoom:j,minimized:Y.has(V.id),maximized:ie,formation:C,accentKey:m.operationAccent[V.id]??cH(V),onActivate:()=>{gi(V.id),!ie&&!C&&Ig(V.id,m.operations[V.id]??V.geometry??Nm(V))},onClose:()=>{e.activeOperationId===V.id&&gi(null),K===V.id&&Xr(),p(V.id)},onMinimize:()=>{e.activeOperationId===V.id&&gi(null),pE(V.id)},onMaximize:()=>{ie?Xr():(gi(V.id),lc(V.id))},onRename:$=>{h(V.id,$)},onSetAccent:$=>{f(V.id,$)},onGeometryChange:$=>{!ie&&!C&&Ig(V.id,$)},onGeometryCommit:$=>{!ie&&!C&&dH(V.id,To().operations[V.id]??$)}})})}),W?null:l.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[l.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),l.jsx("p",{children:e.activeTheaterId?Qz:"Add a Theater from the top bar to start operations."})]}),N.rubberBand?l.jsx(Wz,{rect:N.rubberBand,viewport:m.viewport}):null,b?l.jsx(sE,{anchor:b.anchor,viewportBounds:iH(g.current),placement:"cursor",catalog:t,canLaunch:i&&!C,renderKindIcon:s,onLaunchKind:R,onClose:()=>v(null)},`${b.anchor.x}:${b.anchor.y}`):null,l.jsx(Tz,{operations:z,pluginOperations:Object.fromEntries(q.filter(V=>!Y.has(V.id)).map(V=>[V.id,{theaterId:V.theaterId,geometry:m.operations[V.id]??V.geometry??Nm(V)}])),viewport:m.viewport,canvasSize:k,onJump:V=>jg({x:k.width/2-V.x*m.viewport.zoom,y:k.height/2-V.y*m.viewport.zoom,zoom:m.viewport.zoom})})]})}function iH(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function rH(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}gi(null)}function sH(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Nm(e){return e.geometry??{x:0,y:0,width:eH,height:tH,zIndex:0}}function aH(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function oH(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function lH(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 cH(e){return typeof e.accent=="string"?e.accent:null}function uH(e,t){const i=t.operationKindRegistry.find(d=>d.pluginId===e.pluginId&&d.type===e.type),s=t.geometry;if(!i?.render)return null;const a=Ed(()=>{_i(null).then(Mi).catch(()=>{})});return l.jsx(Bz,{operation:e,active:t.active,geometry:s,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,interactionDisabled:t.formation,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:l.jsx(t_,{fallback:l.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:l.jsx(hH,{active:t.active,capabilities:a,descriptor:i,geometry:s,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function hH({active:e,capabilities:t,descriptor:i,geometry:s,operation:a,theme:d,viewportZoom:p,onActivate:c,onClose:h,onGeometryChange:f}){return i.render?i.render({operationId:a.id,theaterId:a.theaterId,pluginId:a.pluginId,type:a.type,operation:a,geometry:s,active:e,zoom:p,theme:d,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:f}):null}async function dH(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function t5(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 n5(e,t){const i=new Set(t.map(s=>s.id));return e.filter(s=>i.has(s.operationId))}function i5(e,t){const i=[],s=[];for(const a of e)t.has(a.operationId)?s.push(a):i.push(a);return{hidden:i,visible:s}}function qg(e){const t=new Map;for(const i of[...e].sort((s,a)=>a.lastRaisedSeq-s.lastRaisedSeq)){const s=i.theaterId??"__unknown__",a=t.get(s)??{theaterId:i.theaterId,theaterLabel:i.theaterLabel,notifications:[]};a.notifications.push(i),t.set(s,a)}return[...t.values()].sort((i,s)=>{const a=i.notifications[0]?.lastRaisedSeq??0;return(s.notifications[0]?.lastRaisedSeq??0)-a})}function r5(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const fH={ended:"Ended","input-waiting":"Waiting for input"},pH={id:"alerts",title:"Alerts",icon:()=>l.jsx(gH,{}),render:()=>l.jsx(mH,{})};function mH(){const e=ur(),t=Rc(),[i,s]=L.useState(!1),a=L.useMemo(()=>n5(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),d=t5(e),p=i5(a,d).hidden,c=r5(p,e.notificationPreferences),h=qg(c),f=qg(p),g=Kg(h,"input-waiting"),m=Kg(h,"ended"),S=h.length===0,C=L.useCallback(T=>{pc(T.operationId),t("/operations")},[t]);return l.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[l.jsxs("div",{className:"alerts-panel-toolbar",children:[l.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[g>0?l.jsx("span",{className:"notification-tally is-input-waiting",children:g}):null,m>0?l.jsx("span",{className:"notification-tally is-ended",children:m}):null,S?l.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),l.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:l.jsx(yH,{})})]}),i?l.jsx(_H,{groups:f}):null,S?l.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):l.jsx("div",{className:"notification-dock-deck",children:h.map(T=>l.jsxs("section",{className:"notification-cluster-group",children:[l.jsxs("header",{className:"notification-cluster-group-head",children:[l.jsx("span",{className:"notification-cluster-theater",children:T.theaterLabel}),l.jsx("span",{className:"notification-cluster-group-count",children:T.notifications.length})]}),l.jsx("ul",{className:"notification-cluster-roster",children:T.notifications.map(w=>l.jsxs("li",{className:`notification-row is-${w.kind}`,children:[l.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),l.jsxs("span",{className:"notification-row-body",children:[l.jsx("span",{className:"notification-row-op",children:w.operationLabel}),l.jsx("span",{className:"notification-row-state",children:fH[w.kind]})]}),l.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 gH(){const e=ur();Gw();const t=L.useMemo(()=>n5(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),i=t5(e),s=i5(t,i).hidden,a=r5(s,e.notificationPreferences),d=qg(a),p=d.reduce((f,g)=>f+g.notifications.length,0),c=Kg(d,"input-waiting"),h=p===0?"muted":c>0?"awaiting":"ended";return l.jsxs("span",{className:`alerts-icon is-${h}`,"aria-hidden":"true",children:[l.jsx(bH,{}),p>0?l.jsx("span",{className:"alerts-icon-badge",children:p}):null]})}function _H({groups:e}){const t=ur(),i=vH(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return l.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[l.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:s=>GL(s.currentTarget.checked)}),l.jsx("span",{children:"Mute all"})]}),l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:s=>qL(s.currentTarget.checked)}),l.jsx("span",{children:"Do not disturb"})]}),i.length>0?l.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,i.map(s=>l.jsxs("label",{className:"notification-cluster-setting",children:[l.jsx("input",{type:"checkbox",checked:s.theaterId?t.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&KL(s.theaterId)}}),l.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function vH(e,t,i){const s=new Map;for(const a of e)a.theaterId&&s.set(a.theaterId,a);for(const a of Object.keys(t))s.has(a)||s.set(a,{theaterId:a,theaterLabel:i.find(d=>d.id===a)?.label??a,notifications:[]});return[...s.values()]}function Kg(e,t){let i=0;for(const s of e)for(const a of s.notifications)a.kind===t&&(i+=1);return i}function bH(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[l.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"}),l.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function yH(){return l.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[l.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"}),l.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 SH(e,t){const s=new URLSearchParams().toString();return Io(va(e,`/search${s?`?${s}`:""}`))}async function xH(e,t,i){return Io(va(e,`/entry/${encodeURIComponent(t)}`))}async function s5(e,t="pending"){return Io(va(e,`/drydock?status=${encodeURIComponent(t)}`))}async function wH(e,t){return Io(va(e,`/drydock/${encodeURIComponent(t)}`))}async function CH(e,t,i,s){const a={action:i};return s!==void 0&&(a.reason=s),TH(va(e,`/drydock/${encodeURIComponent(t)}/decision`),a)}async function EH(e){return Io(va(e,"/conflicts"))}async function kH(e,t){return Io(va(e,`/conflicts/${encodeURIComponent(t)}`))}function va(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function Io(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await a5(e,t));return t.json()}async function TH(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 a5(e,i));return i.json()}async function a5(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Vg=new Set,rd={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function tc(){return rd}function o5(e){return Vg.add(e),()=>Vg.delete(e)}function Tx(e){Rh({currentWorkspaceId:e})}async function sd(){Rh({loading:!0,error:null});try{const e=rd.currentWorkspaceId,[t,i]=await Promise.all([SH(e),s5(e,"pending").catch(()=>null)]);Rh({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){Rh({loading:!1,error:AH(e)})}}function Rh(e){Object.assign(rd,e);for(const t of Vg)t(rd)}function AH(e){return e instanceof Error?e.message:String(e)}const RH=120;function rr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function LH(e,t){if(!t)return rr(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?rr(e):rr(e.slice(0,i))+`<mark>${rr(e.slice(i,i+t.length))}</mark>`+rr(e.slice(i+t.length))}function MH(e){return`<span class="codex-nav-tag">${rr(e)}</span>`}function NH(e,t,i){const s=t?e.tags.some(c=>c.toLowerCase().includes(t.toLowerCase())):!1,a=e.tags.slice(0,3).map(MH).join(""),d=rr(e.status??"current"),p=rr(e.updated??"");return`<button
|
|
215
|
+
class="codex-nav-entry${i?" is-current":""}"
|
|
216
|
+
data-entry-id="${rr(e.id)}"
|
|
217
|
+
type="button"
|
|
218
|
+
${i?'aria-current="page"':""}
|
|
219
|
+
title="${rr(e.title)}"
|
|
220
|
+
>
|
|
221
|
+
<span class="t">${LH(e.title,s?"":t)}</span>
|
|
222
|
+
${a?`<span class="tg">${a}</span>`:""}
|
|
223
|
+
<span class="meta">${d} · ${p}</span>
|
|
224
|
+
</button>`}function OH(e,t){if(!t)return e;const i=t.toLowerCase();return e.filter(s=>s.title.toLowerCase().includes(i)||s.tags.some(a=>a.toLowerCase().includes(i)))}function DH(e,t){let i="",s=null,a=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
|
+
Review queue <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 d=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 f(C){const T=OH(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">${rr(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=>NH(w,i,w.id===s)).join("")}function g(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,f(tc()),t.onRequest({kind:"entry",id:s});return}const _=T.closest("[data-action]");if(_?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(_?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function m(){a!==null&&clearTimeout(a),a=setTimeout(()=>{i=d.value,f(tc())},RH)}e.addEventListener("click",g),d.addEventListener("input",m);const S=o5(C=>f(C));return f(tc()),{destroy(){S(),e.removeEventListener("click",g),d.removeEventListener("input",m),a!==null&&clearTimeout(a),e.innerHTML=""},setTheater(C){i="",s=null,d&&(d.value=""),f(tc())}}}function jH(e,t){t.initialTheaterId&&Tx(t.initialTheaterId);const i=DH(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),s=o5(()=>{});sd();const a=i.destroy.bind(i);return{destroy(){s(),a()},setTheater(d){Tx(d),sd(),i.setTheater(d)}}}function It(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Lo(e){return It(e).replace(/"/g,""")}function IH(e){const t=e.tags.map(s=>`<span class="chip chip-tag">${It(s)}</span>`).join(""),i=PH(e);return`
|
|
249
|
+
<div class="meta-chips">
|
|
250
|
+
${t}
|
|
251
|
+
${i}
|
|
252
|
+
<span class="chip">Updated ${It(BH(e.updated))}</span>
|
|
253
|
+
</div>
|
|
254
|
+
`}function l5(e){return e.map(t=>`<span class="chip chip-muted">${It(t)}</span>`).join("")}function BH(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function PH(e){const t=zH(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Lo(t.title)}">${It(t.label)}</span>`:""}function zH(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 HH="active";function Ax(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Lo(t.id)}" data-toc-id="${Lo(t.id)}">${It(t.text)}</a>`).join("")}function Rx(e,t,i){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const s=[...i.querySelectorAll("[data-toc-id]")],a=new Set(t.map(f=>f.id)),d=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>a.has(f.id));if(s.length===0||d.length===0)return()=>{};const p=e.closest(".codex-reading-sheet-read"),c=new Set,h=new IntersectionObserver(f=>{for(const m of f){const S=m.target instanceof HTMLElement?m.target.id:"";S&&(m.isIntersecting?c.add(S):c.delete(S))}const g=$H(d,c)??FH(d,p)??d[0]?.id??null;Lx(s,g)},{root:p,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of d)h.observe(f);return Lx(s,d[0]?.id??null),()=>h.disconnect()}function $H(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function FH(e,t){const i=t?t.getBoundingClientRect().top:0;let s=null;for(const a of e)if(a.getBoundingClientRect().top-i<=80)s=a.id;else break;return s}function Lx(e,t){for(const i of e){const s=!!(t&&i.dataset.tocId===t);i.classList.toggle(HH,s),s?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function Mx(e){return`/entry/${encodeURIComponent(e)}`}const c5={create_wiki:"+",update_wiki:"↻"},u5={create_wiki:"Create",update_wiki:"Update"};function UH(e,t){let i=!1,s=null,a=t,d="idle",p=null,c=null,h=null;I_(e);function f(b){const v=b.target;if(!(v instanceof Element))return;const y=v.closest("[data-patch-id]");if(y){b.preventDefault();const A=y.dataset.patchId||void 0;a.onPatchOpen?.(A);return}const k=v.closest("[data-entry-id]");if(k?.dataset.entryId){b.preventDefault(),a.onRelatedClick(k.dataset.entryId);return}const M=v.closest("[data-drydock-action]");if(M){b.preventDefault(),g(M.dataset.drydockAction);return}}function g(b){if(b){if(b==="back"){a.onPatchOpen?.(void 0);return}if(b==="approve"){d="approving",p=null,S();return}if(b==="approve-confirm"){m("approve",void 0);return}if(b==="reject"){d="rejecting",p=null,S();return}if(b==="reject-submit"){const v=e.querySelector("#queue-reject-reason")?.value.trim();if(!v){p="Rejection reason is required.",S();return}m("reject",v);return}if(b==="cancel"){d="idle",p=null,S();return}}}async function m(b,v){if(h){d="submitting",p=null,S();try{await CH(a.theaterId,h,b,v),a.onDecided?.()}catch(y){d=b==="approve"?"approving":"rejecting",p=y instanceof Error?y.message:String(y),S()}}}function S(){const b=e.querySelector("[data-decision-bar-wrap]");b&&(b.innerHTML=h5(d,p))}e.addEventListener("click",f);function C(){s?.(),s=null}async function T(b){if(!i){Om(e,t.tocContainer),C();try{const v=await xH(a.theaterId,b);if(i)return;const{index:y}=tc(),{html:k,toc:M}=Sc(v.body,{omitDuplicateTitle:v.frontmatter.title,resolveWikiLink:N=>Mx(N)});e.innerHTML=`
|
|
255
|
+
<article class="document">
|
|
256
|
+
<header class="document-header">
|
|
257
|
+
${WH(v.frontmatter.title)}
|
|
258
|
+
<h1>${It(v.frontmatter.title)}</h1>
|
|
259
|
+
${IH(v.frontmatter)}
|
|
260
|
+
</header>
|
|
261
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
262
|
+
${k}
|
|
263
|
+
</div>
|
|
264
|
+
${GH(v.frontmatter.id,v.frontmatter.tags,y)}
|
|
265
|
+
</article>
|
|
266
|
+
`,t.tocContainer.innerHTML=Ax(M);const A=e.querySelector("article");A&&M.length>0&&(s=Rx(A,M,t.tocContainer))}catch(v){i||Dm(e,t.tocContainer,v)}}}async function w(b){if(!i){Om(e,t.tocContainer),C(),c=null,h=null,d="idle",p=null;try{if(b){const v=await wH(a.theaterId,b);if(i)return;c=v.meta,h=b;const{html:y,toc:k}=Sc(v.wikiEntry.body,{omitDuplicateTitle:v.wikiEntry.title,resolveWikiLink:A=>Mx(A)});e.innerHTML=VH(v,y),t.tocContainer.innerHTML=Ax(k);const M=e.querySelector("article");M&&k.length>0&&(s=Rx(M,k,t.tocContainer))}else{const v=await s5(a.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=qH(v.items,"Review queue — Pending patches")}}catch(v){i||Dm(e,t.tocContainer,v)}}}async function _(b){if(!i){Om(e,t.tocContainer),C();try{if(b){const v=await kH(a.theaterId,b);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=ZH(v)}else{const v=await EH(a.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=JH(v)}}catch(v){i||Dm(e,t.tocContainer,v)}}}return t.kind==="entry"&&t.initialEntryId?T(t.initialEntryId):t.kind==="drydock"?w(t.subId):t.kind==="conflicts"&&_(t.subId),{destroy(){i=!0,e.removeEventListener("click",f),C()},async setEntry(b){await T(b)},async navigateSub(b){t.kind==="drydock"?await w(b):t.kind==="conflicts"&&await _(b)},refreshCallbacks(b){a={...a,...b}}}}function Om(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Dm(e,t,i){const s=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${It(s)}</div>`,t.innerHTML=""}function WH(e){return`
|
|
267
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
268
|
+
<ol>
|
|
269
|
+
<li><span>Codex</span></li>
|
|
270
|
+
<li><span aria-current="page">${It(e)}</span></li>
|
|
271
|
+
</ol>
|
|
272
|
+
</nav>
|
|
273
|
+
`}function GH(e,t,i){const s=new Set(t),a=i.filter(d=>d.id!==e).map(d=>({entry:d,matchingTags:d.tags.filter(p=>s.has(p))})).filter(d=>d.matchingTags.length>0).sort((d,p)=>p.matchingTags.length-d.matchingTags.length||d.entry.title.localeCompare(p.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return a.length===0?"":`
|
|
274
|
+
<section class="related-list">
|
|
275
|
+
<h2>Related entries</h2>
|
|
276
|
+
<div class="related-items">
|
|
277
|
+
${a.map(d=>`<button class="related-card" type="button" data-entry-id="${Lo(d.entry.id)}">
|
|
278
|
+
<strong>${It(d.entry.title)}</strong>
|
|
279
|
+
<span>${l5(d.matchingTags)}</span>
|
|
280
|
+
</button>`).join("")}
|
|
281
|
+
</div>
|
|
282
|
+
</section>
|
|
283
|
+
`}function qH(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
|
|
284
|
+
<article class="document">
|
|
285
|
+
<header class="document-header">
|
|
286
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
287
|
+
<ol>
|
|
288
|
+
<li><span>Codex</span></li>
|
|
289
|
+
<li><span aria-current="page">Review queue</span></li>
|
|
290
|
+
</ol>
|
|
291
|
+
</nav>
|
|
292
|
+
<h1>${It(t)}</h1>
|
|
293
|
+
</header>
|
|
294
|
+
<div class="queue-row-list">
|
|
295
|
+
${e.map(KH).join("")}
|
|
296
|
+
</div>
|
|
297
|
+
</article>
|
|
298
|
+
`}function KH(e){const t=e.op??"create_wiki",i=c5[t]??"?",s=u5[t]??"Patch",a=e.target??e.id,p=[QH(e.meta.createdAt)].filter(Boolean);return`
|
|
299
|
+
<button class="queue-row" type="button" data-patch-id="${Lo(e.id)}" aria-label="${Lo(s+": "+a)}">
|
|
300
|
+
<span class="queue-row-badge" aria-hidden="true">
|
|
301
|
+
<span class="op-badge">${i}</span>
|
|
302
|
+
</span>
|
|
303
|
+
<span class="queue-row-body">
|
|
304
|
+
<span class="queue-row-target">${It(a)}</span>
|
|
305
|
+
${e.summary?`<span class="queue-row-summary">${It(e.summary)}</span>`:""}
|
|
306
|
+
${p.length>0?`<span class="queue-row-meta">${p.map(It).join(" · ")}</span>`:""}
|
|
307
|
+
</span>
|
|
308
|
+
</button>
|
|
309
|
+
`}function VH(e,t){const{patch:i,meta:s,wikiEntry:a,targetExists:d}=e,p=i.frontmatter.op,c=c5[p]??"?",h=u5[p]??"Patch",f=d?"기존 문서 대체":"신규 문서 생성",g=s.status==="pending";return`
|
|
310
|
+
<article class="document">
|
|
311
|
+
<header class="document-header">
|
|
312
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
313
|
+
<ol>
|
|
314
|
+
<li><span>Codex</span></li>
|
|
315
|
+
<li><span>Review queue</span></li>
|
|
316
|
+
<li><span aria-current="page">${It(h)}</span></li>
|
|
317
|
+
</ol>
|
|
318
|
+
</nav>
|
|
319
|
+
<button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
|
|
320
|
+
<h1><span class="op-badge">${c}</span> ${It(a.title)}</h1>
|
|
321
|
+
<p class="eyebrow">${It(i.frontmatter.target)} · v${a.version} · ${It(f)}</p>
|
|
322
|
+
${YH(i.frontmatter.proposer,a.tags)}
|
|
323
|
+
</header>
|
|
324
|
+
<div class="markdown-body" id="codex-reader-body">
|
|
325
|
+
${t}
|
|
326
|
+
</div>
|
|
327
|
+
<div class="queue-decision-section" data-decision-bar-wrap>
|
|
328
|
+
${g?h5("idle",null):XH(s)}
|
|
329
|
+
</div>
|
|
330
|
+
</article>
|
|
331
|
+
`}function YH(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${It(e)}</span>`),t.length>0&&i.push(l5(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function h5(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
|
|
332
|
+
<p class="queue-decision-confirm">Apply this patch to the wiki?</p>
|
|
333
|
+
<div class="queue-action-buttons">
|
|
334
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
|
|
335
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
336
|
+
</div>
|
|
337
|
+
${t?`<p class="queue-action-error">${It(t)}</p>`:""}
|
|
338
|
+
`:e==="rejecting"?`
|
|
339
|
+
<div class="queue-reject-form">
|
|
340
|
+
<textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
|
|
341
|
+
<div class="queue-action-buttons">
|
|
342
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
|
|
343
|
+
<button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
|
|
344
|
+
</div>
|
|
345
|
+
${t?`<p class="queue-action-error">${It(t)}</p>`:""}
|
|
346
|
+
</div>
|
|
347
|
+
`:`
|
|
348
|
+
<div class="queue-action-buttons">
|
|
349
|
+
<button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
|
|
350
|
+
<button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
|
|
351
|
+
</div>
|
|
352
|
+
`}function XH(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",s=t?"queue-decision-decided--approve":"queue-decision-decided--reject",a=e.reason?` · ${It(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${i}${a}</p>`}function ZH(e){return`
|
|
353
|
+
<article class="document">
|
|
354
|
+
<header class="document-header">
|
|
355
|
+
<nav class="breadcrumb" aria-label="Entry location">
|
|
356
|
+
<ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
|
|
357
|
+
</nav>
|
|
358
|
+
<h1>${It(e.id)}</h1>
|
|
359
|
+
<p class="eyebrow">Conflict · ${It(e.meta?.status??"open")}</p>
|
|
360
|
+
</header>
|
|
361
|
+
<div class="markdown-body">
|
|
362
|
+
${e.current?`<h2>Current</h2><pre><code>${It(e.current)}</code></pre>`:""}
|
|
363
|
+
${e.proposed?`<h2>Proposed</h2><pre><code>${It(e.proposed)}</code></pre>`:""}
|
|
364
|
+
</div>
|
|
365
|
+
</article>
|
|
366
|
+
`}function JH(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
|
|
367
|
+
<article class="document">
|
|
368
|
+
<header class="document-header">
|
|
369
|
+
<h1>Conflicts</h1>
|
|
370
|
+
</header>
|
|
371
|
+
<div class="markdown-body">
|
|
372
|
+
<ul class="queue-list">
|
|
373
|
+
${e.map(t=>`<li class="queue-item">
|
|
374
|
+
<strong>${It(t.title||t.id)}</strong>
|
|
375
|
+
<span class="eyebrow">${It(t.status)}</span>
|
|
376
|
+
</li>`).join("")}
|
|
377
|
+
</ul>
|
|
378
|
+
</div>
|
|
379
|
+
</article>
|
|
380
|
+
`}function QH(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 aa=null,kc=null,d5=null,Ms=null,oa=null,Rs=null,Lh=null,jm=null,Mh,Yg=0;function Nx(e){d5=e}function e$(e,t){const i=i$();i.parentElement!==e&&e.appendChild(i),kc||(kc=jH(i,{initialTheaterId:t,onRequest:s=>d5?.(s)}))}function t$(e){kc?.setTheater(e)}function f5(e,t,i){const s=r$(),a=s$(),d=s.parentElement,p=i.kind==="entry"&&Lh==="entry"&&i.initialEntryId===jm;d&&d!==e&&(Yg=d.scrollTop),s.parentElement!==e&&e.appendChild(s),a.parentElement!==t&&t.appendChild(a),!Rs||Lh!==i.kind?(Rs?.destroy(),Rs=UH(s,{...i,tocContainer:a}),Lh=i.kind,Mh=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==jm?Rs.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==Mh&&(Mh=i.subId,Rs.navigateSub(i.subId)),jm=i.kind==="entry"?i.initialEntryId??null:null,Rs.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const c=p?Yg:0;requestAnimationFrame(()=>{e.scrollTop=c})}function n$(){const e=Ms?.parentElement;e&&(Yg=e.scrollTop)}function p5(){Rs?.destroy(),Rs=null,Lh=null,Mh=void 0,Ms?.parentElement&&Ms.parentElement.removeChild(Ms),oa?.parentElement&&oa.parentElement.removeChild(oa)}function Ox(){p5(),kc?.destroy(),kc=null,aa?.parentElement&&aa.parentElement.removeChild(aa)}function i$(){return aa||(aa=document.createElement("div"),aa.className="codex-host"),aa}function r$(){return Ms||(Ms=document.createElement("div"),Ms.className="codex-reader-host"),Ms}function s$(){return oa||(oa=document.createElement("div"),oa.className="codex-toc-host"),oa}const a$={id:"codex",title:"Codex",icon:()=>l.jsx(h$,{}),pathAware:!0,render:e=>l.jsx(o$,{theaterId:e.theaterId,pathContext:e.pathContext})};function o$({theaterId:e,pathContext:t}){const i=ur(),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),p=L.useRef(""),[c,h]=L.useState(null),f=i.codexReader,g=f!==null,m=i.codexReaderExpanded,S=i.theaters.find(v=>v.id===i.activeTheaterId)??null,C=i.theaters.length>0,T=`${e??""}\0${t.relPath??""}`,w=c?.contextKey===T&&c.hasWiki?c.id:null,_=w!==null,b=f?`${f.kind}:${f.kind==="entry"?f.entryId:f.kind==="drydock"?f.patchId??"":f.id??""}`:null;return L.useEffect(()=>{if(p.current=T,$p(),!e){h({contextKey:T,hasWiki:!1,id:null});return}c$(e,t.relPath).then(v=>{p.current===T&&h({contextKey:T,...v})}).catch(()=>{p.current===T&&h({contextKey:T,hasWiki:!1,id:null})})},[T,t.relPath,e]),L.useEffect(()=>{c?.contextKey===T&&!c.hasWiki&&Ox()},[T,c]),L.useEffect(()=>()=>Ox(),[]),L.useEffect(()=>{if(!_||!w)return;const v=s.current;if(v)return e$(v,w),Nx(y=>{y.kind==="entry"?qr({kind:"entry",entryId:y.id}):y.kind==="drydock"?qr({kind:"drydock",patchId:y.patchId}):y.kind==="conflicts"&&qr({kind:"conflicts",id:y.id})}),()=>{Nx(null)}},[_,w,g]),L.useEffect(()=>{_&&w&&t$(w)},[_,w]),L.useEffect(()=>{if(!_||!w||!g||m||!a.current||!d.current||!f)return;const v=f.kind,y=v==="drydock"?f.patchId:v==="conflicts"?f.id:void 0;f5(a.current,d.current,{initialEntryId:v==="entry"?f.entryId:"",kind:v,subId:y,theaterId:w,onRelatedClick:k=>qr({kind:"entry",entryId:k}),onClose:()=>$p(),onPatchOpen:k=>qr({kind:"drydock",patchId:k}),onDecided:()=>{sd(),qr({kind:"drydock",patchId:void 0})}})},[_,w,g,m,b]),L.useEffect(()=>{g||p5()},[g]),_?g?l.jsxs("div",{className:"codex-rail-host is-split",children:[l.jsxs("div",{className:"codex-doc-pane",children:[l.jsxs("div",{className:"codex-doc-pane-head",children:[l.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:bh,children:"⤢ Expand"}),l.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:$p,children:"✕"})]}),l.jsx("div",{ref:a,className:"codex-doc-scroll"}),l.jsx("div",{ref:d,className:"codex-doc-toc-inline"})]}),l.jsx("div",{ref:s,className:"codex-nav-pane"})]}):l.jsx("div",{ref:s,className:"codex-rail-host"}):l.jsx(l$,{activeTheater:S,contextLabel:t.label,hasTheaters:C})}function l$({activeTheater:e,contextLabel:t,hasTheaters:i}){return i?l.jsxs("section",{className:"codex-empty-state",children:[l.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),l.jsx("h1",{children:t||e?.label||"This context"}),l.jsx("p",{children:"This selected context does not have Fleet Wiki data mounted."})]}):l.jsxs("section",{className:"codex-empty-state",children:[l.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),l.jsx("h1",{children:"Add a Theater"}),l.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function c$(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t})});if(!i.ok)throw new Error("codex_workspace_unavailable");return u$(await i.json())}function u$(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("invalid_codex_workspace");const t=e;if(Object.keys(t).length!==2||typeof t.hasWiki!="boolean")throw new Error("invalid_codex_workspace");if(t.hasWiki&&typeof t.id=="string"&&/^[0-9a-f]{12}$/.test(t.id))return{hasWiki:!0,id:t.id};if(!t.hasWiki&&t.id===null)return{hasWiki:!1,id:null};throw new Error("invalid_codex_workspace")}function h$(){return l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),l.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),l.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function m5(e,t=Date.now()){const i=Date.parse(e);if(!Number.isFinite(i))return"Unknown";const s=Math.max(0,Math.floor((t-i)/1e3));if(s<60)return"just now";const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const d=Math.floor(a/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function d$(e,t){return!Number.isFinite(t)||t<=0?null:Number.isFinite(e)?Math.round(Math.min(1,Math.max(0,e/t))*100):0}function f$(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function p$(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function m$(e,t,i){return i.tasksTotal<=0?"none":i.tasksDone>=i.tasksTotal?"complete":e.slice(0,t).every(p$)?"ready":"blocked"}const g$=360,_$={id:"plans",title:"Plans",icon:w$,pathAware:!0,render:e=>l.jsx(v$,{...e})};function v$(e){const t=JSON.stringify([e.theaterId,e.pathContext.relPath]);return l.jsx(b$,{...e},t)}function b$(e){const{pathContext:t,requestExtraWidth:i,theaterId:s}=e,a=t.relPath,[d,p]=L.useState({kind:"no-theater"}),[c,h]=L.useState({kind:"loading"}),[f,g]=L.useState(null),[m,S]=L.useState(0),[C,T]=L.useState(0),w=f?.theaterId===s&&f.relPath===a?f.name:null;L.useEffect(()=>{let k=!1;return g(null),h({kind:"loading"}),s?(p({kind:"loading"}),qR(s,a).then(M=>{k||p({kind:"ready",plans:M.plans})}).catch(()=>{k||p({kind:"error"})}),()=>{k=!0}):(p({kind:"no-theater"}),()=>{k=!0})},[a,s,m]),L.useEffect(()=>{let k=!1;return!s||!w?()=>{k=!0}:(h({kind:"loading"}),KR(s,a,w).then(M=>{k||h({kind:"ready",plan:M})}).catch(()=>{k||h({kind:"error"})}),()=>{k=!0})},[C,a,w,s]),L.useLayoutEffect(()=>(i?.(w?g$:null),()=>i?.(null)),[i,w]);const _=L.useCallback(k=>{s&&g({theaterId:s,relPath:a,name:k})},[a,s]),b=L.useCallback(()=>g(null),[]),v=L.useCallback(()=>S(k=>k+1),[]),y=L.useCallback(()=>T(k=>k+1),[]);return l.jsx("div",{className:"plans-panel-shell",children:l.jsxs("div",{className:`plans-root${w?" is-reader-open":""}`,children:[w&&l.jsx(S$,{state:c,onClose:b,onRetry:y}),w&&l.jsx("div",{className:"plans-divider","aria-hidden":"true"}),l.jsx(y$,{selectedName:w,state:d,onRetry:v,onSelect:_})]})})}function y$({selectedName:e,state:t,onRetry:i,onSelect:s}){return t.kind==="no-theater"?l.jsx("div",{className:"plans-list-pane",children:l.jsx(Dx,{children:"Select a Theater to browse plans."})}):t.kind==="loading"?l.jsx("div",{className:"plans-list-pane",children:l.jsx("div",{className:"plans-loading",children:"Loading plans…"})}):t.kind==="error"?l.jsx("div",{className:"plans-list-pane",children:l.jsx(g5,{message:"Unable to load plans.",onRetry:i})}):t.plans.length===0?l.jsx("div",{className:"plans-list-pane",children:l.jsx(Dx,{detail:"Execution plans in .fleet/plans/ appear here.",children:"No plans yet."})}):l.jsx("div",{className:"plans-list-pane",children:l.jsx("div",{className:"plans-list","aria-label":"Plans",children:t.plans.map(a=>{const d=d$(a.tasksDone,a.tasksTotal),p=d===100;return l.jsxs("button",{type:"button",className:`plans-row${e===a.name?" is-selected":""}`,onClick:()=>s(a.name),children:[l.jsx("span",{className:"plans-row-name",children:a.name}),l.jsxs("span",{className:"plans-row-meta",children:[a.waveCount," waves · ",a.tasksDone,"/",a.tasksTotal," tasks · ",m5(a.updatedAt),a.executionMode==="parallel"?" · parallel":""]}),d!==null&&l.jsx("span",{className:"plans-progress-track","aria-label":`${d}% complete`,children:l.jsx("span",{className:`plans-progress-fill${p?" is-complete":""}`,style:{width:`${d}%`}})})]},a.name)})})})}function S$({state:e,onClose:t,onRetry:i}){return e.kind==="loading"?l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsx("span",{className:"plans-reader-title",children:"Plan"}),l.jsx(Xg,{onClose:t})]}),l.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsx("span",{className:"plans-reader-title",children:"Plan"}),l.jsx(Xg,{onClose:t})]}),l.jsx(g5,{message:"Unable to load plan.",onRetry:i})]}):l.jsx(x$,{plan:e.plan,onClose:t})}function x$({plan:e,onClose:t}){const i=L.useMemo(()=>{const d=new DOMParser().parseFromString(Sc(e.content).html,"text/html");return Im(d.body),d.body.innerHTML},[e.content]),s=L.useRef(null),a=L.useCallback(d=>{const p=d.target.closest('[data-action="copy-code"]');if(!p)return;const c=p.closest("pre")?.getAttribute("data-code");if(!c)return;navigator.clipboard?.writeText(c);const h=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=h},1200)},[]);return L.useEffect(()=>{const d=s.current;if(!d)return;I_(d),Im(d);const p=new MutationObserver(()=>Im(d));return p.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>p.disconnect()},[i]),l.jsxs("div",{className:"plans-reader-pane",children:[l.jsxs("div",{className:"plans-reader-head",children:[l.jsxs("div",{className:"plans-reader-heading",children:[l.jsx("h2",{className:"plans-reader-title",children:e.title}),l.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&l.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",m5(e.updatedAt)]})]}),l.jsx(Xg,{onClose:t})]}),l.jsxs("div",{className:"plans-reader-body",children:[l.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,p)=>{const c=f$(d.tasksDone,d.tasksTotal);return l.jsxs("span",{className:`plans-wave is-${c}`,children:[l.jsx("span",{className:"plans-wave-heading",children:d.heading}),d.tasksTotal>0&&l.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&l.jsx("span",{className:"plans-lane-list",children:d.lanes.map((h,f)=>{const g=m$(e.waves,p,h);return l.jsxs("span",{className:`plans-lane is-${g}`,children:[l.jsx("span",{className:"plans-lane-id",children:h.id??h.heading}),h.tasksTotal>0&&l.jsxs("span",{className:"plans-lane-count",children:[h.tasksDone,"/",h.tasksTotal]}),g==="ready"&&l.jsx("span",{className:"plans-lane-ready",children:"READY"})]},h.id??`${d.index}-${f}`)})})]},d.index)})}),l.jsx("div",{ref:s,className:"plans-markdown markdown-body",onClick:a,dangerouslySetInnerHTML:{__html:i}})]})]})}function Xg({onClose:e}){return l.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Dx({children:e,detail:t}){return l.jsxs("div",{className:"plans-empty",children:[l.jsx("span",{children:e}),t&&l.jsx("span",{className:"plans-empty-detail",children:t})]})}function g5({message:e,onRetry:t}){return l.jsxs("div",{className:"plans-error-state",children:[l.jsx("span",{children:e}),l.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Im(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(i)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const i=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),s=t.tagName==="IMG"?"Image":"Media",a=t.ownerDocument.createElement("span");a.className="plans-md-blocked-image",a.textContent=i?`${s} blocked: ${i}`:`${s} blocked`,t.replaceWith(a)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const i=t.getAttribute("href")??t.getAttribute("xlink:href")??"";i!==""&&!i.startsWith("#")&&t.remove()}}function w$(){return l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const C$=[pH,a$,_$];function E$(e="right"){const{railPanels:t}=jo();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const k$=360;function T$(e){const{codexReader:t}=ur();return e==="codex"&&t!==null?k$:0}const _5=240,A$=312,v5="fleet-console.rail.panelWidth",R$={kind:"root",relPath:null,label:"Theater-wide"};function L$(){try{const e=localStorage.getItem(v5);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=_5)return t}}catch{}return A$}function M$({theaterId:e,api:t}){const i=L.useRef(null),s=Gw(),a=qw(),d=L.useRef(a),p=E$(),c=C$,f=[...c,...p].find(B=>B.id===s)??null,g=f!==null,{pathContextTheaterId:m,pathContext:S,pathContextHydrated:C,pathContextLoading:T,pathContextMutationInProgress:w,pathContextError:_,isPathContextDeckOpen:b}=Kw(),v=e!==null&&m===e&&C&&S!==null,y=T$(s)+(f?.preferredExtraWidth??0)+Y3(),k=L.useRef(y);k.current=y;const[M,A]=L.useState(L$),N=L.useRef(M),[R,I]=L.useState(!1);L.useLayoutEffect(()=>{const B=i.current;if(!B)return;const W=()=>a1(B.getBoundingClientRect().width);W();const F=new ResizeObserver(W);return F.observe(B),()=>{F.disconnect(),a1(0)}},[]),L.useLayoutEffect(()=>{d.current&&!a&&aE(i.current,".command-band-rail-toggle"),d.current=a},[a]),L.useEffect(()=>{Uw(e),e&&K3(e,B=>I3(e,B))},[e]);const Y=L.useCallback(B=>{B.preventDefault();const W=B.clientX,F=N.current;I(!0);const P=X=>{const O=W-X.clientX,H=window.innerWidth-148-k.current,j=Math.max(_5,Math.min(H,F+O));N.current=j,A(j)},K=()=>{document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",K),I(!1);try{localStorage.setItem(v5,String(N.current))}catch{}};document.addEventListener("pointermove",P),document.addEventListener("pointerup",K)},[]),z=L.useMemo(()=>({theaterId:e,pathContext:S??R$,api:t,requestExtraWidth:B=>{s!==null&&q3(s,B)}}),[e,S,t,s]),q=L.useCallback(B=>{e&&Ww(e,W=>jw(e,B,W))},[e]);return l.jsxs("div",{ref:i,className:`right-rail${g?" is-open":""}${a?" is-expanded":" is-closed"}${R?" is-dragging":""}${b?" is-context-deck-open":""}`,"data-rail-chrome":a?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!a,style:{"--right-rail-panel-width":`${g?M+y:0}px`},children:[l.jsxs("div",{className:"right-rail-panel-slot",style:g?{width:M+y}:void 0,children:[g&&l.jsx("div",{className:"right-rail-resize-handle",onPointerDown:Y,"aria-hidden":"true"}),f&&l.jsx(N$,{activePanel:f,activeId:s,ctx:z,theaterId:e,hasHydratedPathContext:v,isPathContextDeckOpen:b,pathContextLoading:T,pathContextMutationInProgress:w,pathContextError:_,onSelectPathContext:q})]}),l.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:l.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[c.map(B=>l.jsx(jx,{panel:B,isActive:s===B.id},B.id)),c.length>0&&p.length>0?l.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,p.map(B=>l.jsx(jx,{panel:B,isActive:s===B.id},B.id))]})})]})}const N$=L.memo(function({activePanel:t,activeId:i,ctx:s,theaterId:a,hasHydratedPathContext:d,isPathContextDeckOpen:p,pathContextLoading:c,pathContextMutationInProgress:h,pathContextError:f,onSelectPathContext:g}){const m=L.useRef(null),S=L.useRef(null),C=L.useRef(!1),T=t.pathAware===!0,w=L.useSyncExternalStore(xw,()=>fc().theaters.find(y=>y.id===a)?.label??"Theater"),_=F3(T,a,d);L.useEffect(()=>{if(C.current&&!p){const y=requestAnimationFrame(()=>m.current?.focus());return C.current=p,()=>cancelAnimationFrame(y)}C.current=p},[p]),L.useEffect(()=>{if(!p)return;const y=k=>{const M=k.target;!(M instanceof Node)||m.current?.contains(M)||S.current?.contains(M)||yh(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[p]);const b=L.useCallback(()=>yh(!1),[]),v=L.useCallback(y=>{g(y)},[g]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"right-rail-panel-head",children:[T?l.jsxs("button",{ref:m,className:`rail-context-title-trigger${p?" is-open":""}`,type:"button",disabled:!d||c||h,"aria-expanded":p,"aria-haspopup":"dialog",title:f??t.title,onClick:()=>yh(!p),children:[l.jsx("span",{className:"rail-context-title-text",children:t.title}),l.jsx("span",{className:"rail-context-label",title:a===null?"Theater-wide":d?s.pathContext.label:"Loading…",children:a===null?"Theater-wide":d?s.pathContext.label:"Loading…"}),l.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"right-rail-panel-title",children:t.title}),l.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),l.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:W3,children:"✕"}),T&&d&&p&&a?l.jsx(Hw,{ref:S,theaterId:a,theaterLabel:w,context:s.pathContext,isMutating:h,onSelect:v,onClose:b}):null]}),l.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:_?t.render(s):l.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function jx({panel:e,isActive:t}){const i=L.useCallback(()=>U3(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon;return l.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 O$='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function D$(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=ur(),s=L.useRef(null),a=L.useRef(null),d=L.useRef(null),p=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,c=e!==null&&t,h=L.useCallback(()=>{n$(),UL()},[]);return L.useEffect(()=>{if(!c)return;const f=e;document.body.setAttribute("data-codex-reading","true");const g=document.querySelector(".operations-canvas"),m=document.querySelector(".operations-side-bar");g?.setAttribute("inert",""),m?.setAttribute("inert","");const S=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),h();return}C.key==="Tab"&&j$(s.current,C)};return window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0),document.body.removeAttribute("data-codex-reading"),g?.removeAttribute("inert"),m?.removeAttribute("inert");const C=f?.kind==="entry"?f.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]),L.useEffect(()=>{if(!c||!a.current||!d.current||!e)return;const f=e.kind,g=f==="drydock"?e.patchId:f==="conflicts"?e.id:void 0;f5(a.current,d.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:g,theaterId:i,onRelatedClick:m=>{qr({kind:"entry",entryId:m}),bh()},onClose:h,onPatchOpen:m=>{qr({kind:"drydock",patchId:m}),bh()},onDecided:()=>{sd(),qr({kind:"drydock",patchId:void 0}),bh()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[c,p]),c?js.createPortal(l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"codex-reading-scrim",onClick:h,"aria-hidden":"true"}),l.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[l.jsxs("div",{className:"codex-reading-sheet-head",children:[l.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),l.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:h,children:"✕"})]}),l.jsxs("div",{className:"codex-reading-sheet-body",children:[l.jsx("div",{ref:a,className:"codex-reading-sheet-read"}),l.jsx("aside",{ref:d,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function j$(e,t){if(!e)return;const i=[...e.querySelectorAll(O$)].filter(d=>!d.closest("[inert]"));if(i.length===0)return;const s=i[0],a=i[i.length-1];t.shiftKey?document.activeElement===s&&(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),s.focus())}const I$=Ed().api,Zg=560,Jg=360,Bm=new Set;function B$({state:e,claimBootPanelMinimization:t}){const i=L.useRef(null),s=uE(),a=Sd(),d=dE(),p=jo(),[c,h]=L.useState([]),f=L.useMemo(()=>P$(e).map(W=>W.id),[e.operations,e.activeTheaterId]),g=L.useRef(e);g.current=e,L.useEffect(()=>{kB(e.activeTheaterId)},[e.activeTheaterId]),L.useEffect(()=>{if(!e.activeTheaterId){h([]);return}Hx().then(h).catch(()=>{})},[e.activeTheaterId]),L.useEffect(()=>{const W={current:s},F={current:a},P=K=>{if(!o3()||!K.altKey||K.metaKey||K.ctrlKey)return;const X=document.activeElement;if(X instanceof HTMLElement&&X.matches("input, textarea, [contenteditable='true']")&&!X.closest(".xterm"))return;if(K.code==="KeyF"&&!K.shiftKey){K.preventDefault(),K.stopImmediatePropagation(),TB();return}if(K.shiftKey||K.key!=="ArrowLeft"&&K.key!=="ArrowRight")return;const O=g.current,H=To(),j=kw(O.operations.filter(ne=>ne.theaterId===O.activeTheaterId),O.groups.filter(ne=>ne.theaterId===O.activeTheaterId),H.operationOrder,H.collapsedGroups).map(ne=>ne.id);if(j.length===0)return;K.preventDefault(),K.stopImmediatePropagation();const G=W.current??g.current.activeOperationId,V=$L(j,G,K.key==="ArrowRight"?1:-1);if(V){if(F.current){fh(V),gi(V);return}if(W.current){gi(V),lc(V);return}pc(V)}};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[a,s]),L.useEffect(()=>{for(const P of f)CB(P);if(!e.operationsHydrated||(EB(f),!e.activeTheaterId))return;const W=t(e.activeTheaterId);if(W===null)return;const F=g.current.pendingOperationFocus;wB(F?W.filter(P=>P!==F):W)},[t,f,e.activeTheaterId,e.operationsHydrated]),L.useEffect(()=>{const W=e.pendingOperationFocus;if(W===null)return;if(a){fh(W),gi(W),zp();return}if(Og()!==null){lc(W),zp();return}Xr();const F=Ix(i.current);F&&rx(W,F),zp()},[a,e.pendingOperationFocus]);const m=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(W=>W.theaterId===e.activeTheaterId);const S=L.useCallback((W,F)=>p.plugins.find(K=>K.id===W)?.renderLaunchIcon?.(F)??null,[p.plugins]),C=L.useCallback((W,F,P)=>{if(!g.current.activeTheaterId)return;const K={...Bx(P),zIndex:ga()};Pm(W,F,K,g.current.activeTheaterId,p.plugins)},[p.plugins]),T=L.useCallback((W,F)=>{if(!g.current.activeTheaterId)return;const P=H$(i.current),K={...Bx(P),zIndex:ga()};Pm(W,F,K,g.current.activeTheaterId,p.plugins)},[p.plugins]),w=L.useCallback((W,F,P)=>{g.current.activeTheaterId&&Pm(W,F,P,g.current.activeTheaterId,p.plugins)},[p.plugins]),_=L.useCallback(()=>{fE({x:0,y:0,zoom:1})},[]),b=L.useCallback(W=>{const F=g.current.operations.find(H=>H.id===W);if(!F)return;if(F.theaterId!==g.current.activeTheaterId){pc(W);return}if(Dg()){fh(W),gi(W);return}const P=Og();if(P!==null&&P!==W){gi(W),lc(W);return}const K=To(),X=K.operations[W]??F.geometry??z$(F);K.operations[W]||Ig(W,X),fh(W),gi(W);const O=Ix(i.current);O&&rx(W,O)},[]),v=L.useCallback(W=>{g.current.activeOperationId===W&&gi(null),pE(W)},[]),y=L.useCallback((W,F)=>{vh(W,{accent:F}).then(()=>_i(null)).then(Mi).catch(()=>{})},[]),k=L.useCallback((W,F)=>{dw(W,F).then(()=>_i(null)).then(Mi).catch(()=>{})},[]),M=L.useCallback((W,F)=>{vh(W,{groupId:F}).then(()=>_i(null)).then(Mi).catch(()=>{})},[]),A=L.useCallback((W,F,P)=>{YR({theaterId:W,name:F,color:"blue"}).then(K=>P?vh(P,{groupId:K.id}).then(()=>{}):void 0).then(()=>Promise.all([_i(null).then(Mi),ia().then(ra)])).catch(()=>{})},[]),N=L.useCallback((W,F)=>{F&&Pp(W,{color:F}).then(()=>ia()).then(ra).catch(()=>{})},[]),R=L.useCallback((W,F)=>{Pp(W,{name:F}).then(()=>ia()).then(ra).catch(()=>{})},[]),I=L.useCallback(W=>{const F=new Map(g.current.groups.map(K=>[K.id,K])),P=W.flatMap((K,X)=>{const O=F.get(K);return!O||O.order===X?[]:[Pp(K,{order:X})]});P.length!==0&&Promise.allSettled(P).then(()=>ia()).then(ra).catch(()=>{})},[]),Y=L.useCallback(W=>{XR(W).then(()=>Promise.all([_i(null).then(Mi),ia().then(ra)])).catch(()=>{})},[]),z=L.useCallback(W=>{if(Bm.has(W))return;Bm.add(W);const F=g.current.operations.find(K=>K.id===W)?.pluginId,P=(F?p.plugins.find(K=>K.id===F):null)??null;$$(W,P).finally(()=>Bm.delete(W))},[p.plugins]),q=L.useCallback(async W=>{Cw();try{const F=await hw(W),P=await uw(F);Ew(P)}catch(F){Vm(F instanceof Error?F.message:String(F))}},[]),B=L.useCallback(async W=>{const F=()=>Promise.all([_i(null).then(Mi),ia().then(ra)]).then(()=>{}).catch(()=>{});try{await VR(W),i1(W),await F()}catch(P){if(P instanceof dt&&P.status===404){i1(W),await F();return}Vm(P instanceof Error?P.message:String(P))}},[]);return l.jsxs("div",{className:"console-body is-canvas",children:[l.jsx(S9,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:d,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:c,canLaunch:m,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:S,onLaunchKind:T,onResetView:_,onClose:z,onMinimize:v,onFocus:b,onSetAccent:y,onRename:k,onSetGroupId:M,onCreateGroup:A,onSetGroupColor:N,onRenameGroup:R,onReorderGroups:I,onUngroupAll:Y,onSelectTheater:BL,onAddTheater:q,onCancelAddTheater:HL,onForgetTheater:B}),l.jsx("div",{className:"operations-center-stage",ref:i,children:l.jsx(nH,{state:e,catalog:c,canLaunch:m,renderKindIcon:S,onLaunchKind:C,onLaunchAtGeometry:w,onClose:z,onFocus:b,onRename:k,onSetAccent:y})}),l.jsx(M$,{theaterId:e.activeTheaterId,api:I$}),l.jsx(D$,{})]})}function P$(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Ym)}function Ix(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function z$(e){return e.geometry??{x:0,y:0,width:Zg,height:Jg,zIndex:0}}function H$(e){const t=To(),i=e?.clientWidth??800,s=e?.clientHeight??600;return Ec({x:i/2,y:s/2},t.viewport)}function Bx(e){return{x:e.x-Zg/2,y:e.y-Jg/2,width:Zg,height:Jg}}async function Pm(e,t,i,s,a){const d=a.find(m=>m.id===e),c=Ed(()=>{_i(null).then(Mi).catch(()=>{})});let h=null;if(d?.launch?h=(await d.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 _i(null).then(Mi).catch(()=>{}),!h)return;const f=bB()===s,g=fc().operations.some(m=>m.id===h);f&&g&&Og()!==null?(gi(h),lc(h)):pc(h)}async function $$(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await _i(null).then(Mi).catch(()=>{})}const F$=3e4;let mh=1e3,Gl=null,zm=null,Hm=!1;function b5(){Gl!==null&&(clearTimeout(Gl),Gl=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const s=JSON.parse(i.data);U$(s.operation)&&IL(s.operation)}catch{}}),e.addEventListener("update:available",()=>{Tc()}),e.onopen=()=>{mh=1e3,Tc()},e.onerror=()=>{e.close(),Gl=setTimeout(()=>{Gl=null,mh=Math.min(mh*2,F$),_i().then(Mi).catch(()=>{}).finally(b5)},mh)}}function Tc(){if(zm){Hm=!0;return}zm=FR(fc().activeTheaterId).then(kL).catch(()=>{}).finally(()=>{zm=null,Hm&&(Hm=!1,Tc())})}function U$(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const W$=6e3;function G$(){const e=ur(),t=L.useRef(new Set),i=L.useRef(null),s=cr(),a=jo(),d=Q_(),p=$E(d.state?.language??"auto"),h=s.pathname.startsWith("/operations"),f=L.useCallback(g=>i.current===null||t.current.has(g)?null:(t.current.add(g),i.current),[]);return L.useEffect(()=>{const g=Ed(()=>{_i().then(Mi).catch(()=>{})}),m=a.plugins.map(S=>S.install?.(g)).filter(S=>typeof S=="function");return()=>{for(const S of m)S()}},[a.plugins]),L.useEffect(()=>{EL(h)},[h]),L.useEffect(()=>{const g=new AbortController;$R(g.signal).then(C=>{DL(C),n1()}).catch(C=>{g.signal.aborted||(it({theaterError:C instanceof Error?C.message:String(C)}),n1())});const m=Date.now();_i(null,g.signal).then(C=>{i.current=C.filter(T=>T.ts.createdAt<m).map(T=>T.id),jL(C)}).catch(()=>{}),ia(null,g.signal).then(ra).catch(()=>{}),Tc();const S=window.setTimeout(Tc,W$);return()=>{window.clearTimeout(S),g.abort()}},[]),L.useEffect(()=>(HE({locale:p}),tP),[p]),L.useEffect(()=>mP({getSideBarCollapsed:()=>Hg().collapsed,setSideBarCollapsed:Z_,toggleOperationSearch:Tw,toggleRailChrome:Fw}),[]),l.jsxs("div",{className:"console-shell",children:[l.jsx(D9,{operationsViewVisible:h}),l.jsx("main",{className:"console-route-content",children:l.jsxs(aR,{children:[l.jsx(ro,{path:"/",element:l.jsx(Xy,{to:"/operations",replace:!0})}),l.jsx(ro,{path:"/operations",element:l.jsx(B$,{state:e,claimBootPanelMinimization:f})}),l.jsx(ro,{path:"/carrier-settings",element:l.jsx(PP,{})}),l.jsx(ro,{path:"/settings",element:l.jsx(pz,{})}),l.jsx(ro,{path:"*",element:l.jsx(Xy,{to:"/operations",replace:!0})})]})}),l.jsx(F9,{state:e}),l.jsx(cP,{state:e}),l.jsx(z9,{state:e}),l.jsx(V9,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Nh,"react/jsx-runtime":ET,"@fleet-console/sdk/plugin/browser":GT,"@fleet-console/sdk/settings/browser":JT,"@fleet-console/sdk/operations/browser":OT,"@fleet-console/sdk/notifications/browser":eA,"@fleet-console/sdk/react/browser":nA};Ph("instrument");ML();try{const e=await IE();Ph(e.theme),Km(e.uiFont),J9(e)}catch{}const q$=await FI();b5();const Px=document.querySelector("#app");Px&&lA.createRoot(Px).render(l.jsx(L.StrictMode,{children:l.jsx(LR,{basename:"/console",children:l.jsx($I,{value:q$,children:l.jsx(G$,{})})})}));export{r8 as _,K$ as a,Qg as g,jt as k,ac as p};
|